Subject: Re: Easy install?
To: None <rmsmith@csc.com, mcguire@rocinante.digex.net>
From: Johnny Billquist konsult <qmwjyb@emw.ericsson.se>
List: port-vax
Date: 03/14/1996 10:20:28
> > Another bob question:
> > (I want to bring up another uV running NetBSD, using RD54)
> > Can I do a disklabel on another RD54 and then just do a dd from
> > ra0 to ra1?
> > 
> > (am I being dumb here or is this a slick way to dupe my drive, and
> > bring up another system?)
> 
>   I wouldn't use dd...Here's what I'd do (what I _have_ done to dupe
> my systems):
> 
>   Connect another drive to your system, say as ra1.  Use disklabel to
> partition it and write your bootblock and stuff.  Use newfs to create
> filesystems on your new partitions.

So far I agree...

>   Then...This is assuming you've followed the filesystem layout
> guidelines in Ragge's early notes, and have root on ra0a, swap on
> ra0b, and /usr on ra0e...Do this:
> 
> % mount /dev/ra0a /mnt
> % cd /
> % tar -clf - . | (cd /mnt; tar -xvBpf -)
> ...
> [the files scroll by]
> ...
> % mkdir /mnt/usr        /* <--- don't forget this!! */
> % umount /mnt
> % mount /dev/ra0e /mnt
> % cd /usr
> % tar -clf - . | (cd /mnt; tar -xvBpf -)
> ...
> [the files scroll by]
> ...
> % umount /mnt

I would recommend using dump/restore instead of tar. Dump should be quicker
for one thing, since it bypasses the filesystem when dumping.
You also can be sure that you will only get the filesystem you want,
since dump never works across several filesystems, which tar does.
Finally, dump preserve inode numbers, so that hard links are
preserved as well. tar don't handle that.

Actually, the example seems a little wrong. For one thing, I would assume
that it's ra1 that should mounted and unmounted. And I must admit, I'm a
little surprised the above example even works, since tar should have
added the files under /mnt while copying from /...
This might lead to a recursive copy. :-)

Also, this should end up copying /usr onto /dev/ra1a, under /mnt/usr.
While this isn't an error per se, it does use up some disk, which will
be invisible once you mount another filesystem under that usr-dir.

>   Then, I'd fsck both /dev/ra0a and /dev/ra0e just in case.  See
> what's happening there?

Ummm, not ra1a and ra1e?

And finally, a word on dd.

dd is almost never a good solution for copying from one disk to another.
Since dd does a block for block copy, you should only try it between
identical types of disks, otherwise, something are sure to go wrong.
And just because dd does a block for block copy, any previously written
disk label will be clobbered if you write to a partition that hold the whole
dirve, since the disk label is just some data on a block too.
So, if you try copying partitions with dd, they better be of the same
size, and not start at the start of the disk.

Finally, from experimenting way back, I found dd to just about the most
inefficient way of copying things there is. It has no buffering, only
does as many blocks per copy as you ask for, and it also copies block
with no meaningful data, which you really could skip.

	Johnny