[comp.unix.wizards] Disk to disk copies

eichelbe@nadc.arpa (J. Eichelberger) (04/27/88)

We are running 4.3BSD UNIX on a VAX 11/780.

I'm having a problem with performing some copies of one file system to
another.  I'd like to copy file system "a" to file system "b", with the last
modification, last access, and CREATION TIME for each file on file system
"a" to be copied to each corresponding file on file system "b".

Our first approach was the use of "dd".  To be specific, we wanted to copy
a "c" partition on an RA81 disk #1 to a "c" partition on RA81 disk #2. But,
here's the question - will "too much" be copied, like bad blocks and system
areas of the disk, which should be specific to the particular disk?

If anyone knows how to do what I need to do, please send a letter directly
to me.

Jon Eichelberger
eichelbe@nadc.arpa

jcs@tarkus.UUCP (John C. Sucilla) (04/30/88)

In article <13119@brl-adm.ARPA> eichelbe@nadc.arpa (J. Eichelberger) writes:
>Our first approach was the use of "dd".  To be specific, we wanted to copy
>a "c" partition on an RA81 disk #1 to a "c" partition on RA81 disk #2. But,
>here's the question - will "too much" be copied, like bad blocks and system
>areas of the disk, which should be specific to the particular disk?

Hey, send that answer over here too!
Thanks.



-- 
John "C" Sucilla
{ihnp4}!tarkus!jcs

Don't let reality stop you.... 

bob@cloud9.UUCP (Bob Toxen) (05/03/88)

In article <77@tarkus.UUCP>, jcs@tarkus.UUCP (John C. Sucilla) writes:
> In article <13119@brl-adm.ARPA> eichelbe@nadc.arpa (J. Eichelberger) writes:
> >(Paraphrased) Will a dd to copy disk devices directly (blocked or raw)
> >copy bad block information (which you don't want to copy)?

Not in most installations.  That should be handled at a lower level.
If you have a utility to read bad blocks, see if you have any.  Then
do a dd to /dev/null and see if you get any read errors on the console.

This is also a handy way to see if you've developed any new bad blocks.
A dd of raw disks with a very large blocking factor (or of disk to/from
tape) is a fast way of cpying.
-- 

Bob Toxen	{ucbvax!ihnp4,harvard,cloud9!es}!anvil!cavu!bob
Stratus Computer, Marlboro, MA
Pilot to Copilot: What's a mountain goat doing way up here in a cloud bank?

haynes@ucscc.UCSC.EDU (99700000) (05/04/88)

BTW, if you copy disk-to-disk on the 'a' partition on something
like a Sun that uses disk labels, be aware that you also copy
the label.  We have a habit of copying the root to a spare partition
every night; and when we got our first Sun we wondered why the
partitioning we had so carefully made on the second drive kept
coming unglued, reverting to the (different) partitioning on the
first drive...

haynes@ucscc.ucsc.edu
haynes@ucscc.bitnet
..ucbvax!ucscc!haynes

larry@sgistl.SGI.COM (Larry Autry) (05/05/88)

In article <3149@saturn.ucsc.edu>, haynes@ucscc.UCSC.EDU (99700000) writes:
-> BTW, if you copy disk-to-disk on the 'a' partition on something
-> like a Sun that uses disk labels, be aware that you also copy
-> the label.
-> 
-> haynes@ucscc.ucsc.edu
-> haynes@ucscc.bitnet
-> ..ucbvax!ucscc!haynes

Here is a label.  There is only one on the disk.

	fs     base          size
	       sectors(cylinders)
	a:    320(   1),  18880(  59) Root   <- no label here
	b:  19200(  60),  32000( 100) Swap     
	c:  51200( 160),  64000( 200)           
	d: 115200( 360), 142720( 446)       
	f:  51200( 160), 206720( 646)
	g:    320(   1), 257600( 805)
	h:      0(   0), 257920( 806)        <- label is here

Partition 'h' includes the label.  You need to 'dd' copy a partition 
that does not include cylinder (or track) 0.  Cylinder 0 is
normally the location of bad block information as well.  From my
experience, it is ok to copy partition 'c' on a disk to partition 'c' on
another.  You are well advised not to copy partition 'h' if 'h' on your 
system is the definition of the entire disk including the label.  Unless I
am mistaken, all hard disks used with Un*x need to have labels.  
If Sun's disk starts at '0' then that may be problem in this case.  

-- 
					Larry Autry
larry@sgistl.sgi.com
       or
{ucbvax,sun,ames,pyramid,decwrl}!sgi!sgistl!larry

") (05/05/88)

haynes@ucscc.UCSC.EDU (Jim Haynes) writes:
) We have a habit of copying the root to a spare partition
) every night [with dd] ...

I sya, the way to back up your root partition is with rdist.  After
all, the root and swap areas or compiled in to a configured vmunix,
so you don't want the backup drive's vmunix (nor /etc/fstab) to be
identical to the primary drives.  I do a nightly:
================ from /usr/adm/daily:
if [ -d /backuproot/lost+found ]; then
	echo "Running rdist:"
	date >> /usr/adm/rdist-errs
	rdist -f /usr/local/lib/Distfile backuproot 2>&1 | \
		tee -a /usr/adm/rdist-errs
else
	if [ -d /bentuproot/lost+found ]; then
		echo "Running reverse rdist:"
		date >> /usr/adm/rdist-errs
		rdist -f /usr/local/lib/Distfile reversebackup 2>&1 | \
			tee -a /usr/adm/rdist-errs
	else
		echo "/backuproot not mounted -- skipping rdist"
	fi
fi
================
Either the backup root partition is mounted on /backuproot or, if we
are running on the backup root, the primary root is mounted on
/bentuproot (if mounted at all).

================ /usr/local/lib/Distfile:
ROOTFILES = ( /.cshrc /.login /.plan /.profile /.rhosts /PhoneNumbers /Rates
		/bin /boot /private /etc /kadb /lib
		/mbox /stand /sys /tftpboot /genvmunix /vmunix* )
# It's a pity we can't rdist /dev !

EXROOT = ( /vmunix /etc/fstab /etc/rc.dump )

ROOTSPECIAL = ( /vmunix.xy2 )
ETCSPECIAL = ( /etc/fstab.xy2 /etc/rc.dump.xy2 )

backuproot:
${ROOTFILES} -> oddjob
	install -w -R /backuproot ;
	except ${EXROOT} ;
	special ${ROOTSPECIAL}	"name=/backuproot/`basename $FILE .xy2` ;
				 rm $name;	ln $name.xy2 $name";
	special ${ETCSPECIAL}	"name=/backuproot/etc/`basename $FILE .xy2` ;
				 rm $name;	ln $name.xy2 $name";

REVROOTSPECIAL = ( /vmunix.xy0 )
REVETCSPECIAL = ( /etc/fstab.xy0 /etc/rc.dump.xy0 )

reversebackup:
${ROOTFILES} -> oddjob
	install -w -R /bentuproot ;
	except ${EXROOT} ;
	special ${REVROOTSPECIAL} "name=/bentuproot/`basename $FILE .xy0` ;
				 rm $name;	ln $name.xy0 $name";
	special ${REVETCSPECIAL} "name=/bentuproot/etc/`basename $FILE .xy0` ;
				 rm $name;	ln $name.xy0 $name";
================
				Matt Crawford