Subject: Re: moving to another drive
To: Joe Laffey <joe@laffeycomputer.com>
From: Frederick Bruckman <fb@enteract.com>
List: port-mac68k
Date: 10/16/1998 18:54:54
On 16 Oct 1998, Joe Laffey wrote:

> I would like to move my entire filesystem to another physical drive. It's a
> recent installation so I'm thinking about just re-installing on the new
> drive and then copying over the /etc files. Is this anything I need to
> watch out for in doing this? 
> 
> What files other than /etc and maybe /var/logss do I need to copy over to
> maintain all of my settings, etc.?

I usually copy the entire contents of /etc, /dev, and /var, for good
measure.

> Can I mount a root partition as a usr partition? (i.e. can I mount my new
> root partition into the existing filesystem to copy files over?)

Sure. To keep from going into a nasty loop, I find I have to exactly
specify all the files and directories at the root level. This also
prevents copying the entire contents of the mounted /kern and /proc
filesystems. This is mostly from memory

	cd / ;
	mount /altroot ; mount /altroot/usr # and so on
	mtree -def /etc/mtree/NetBSD.dist -p /altroot -u
	mkdir /kern ; mkdir /proc
	pax -r -w -pe -v *netbsd* dev etc var home usr /altroot
	cd /altroot/etc ; cp -p fstab fstab.alt
	vi fstab

"mtree" is not strictly necessary; the idea is to write some of the
directories first in order to get a cleaner layout on the disk.  
IIRC, at least one of /kern and /proc is not made automatically by
"mtree"; "mkdir" as necessary. "pax" is capable of copying the special
files in /dev. Alternatively, you could "cd /altroot/dev ; sh
./MAKEDEV". Of course, you would have to tailor the "pax" invocation
to your requirements. (Perhaps your intention is to rearrange
partitions, and to leave some filesystems on the old drive.)

Don't forget to edit the new fstab; it's the one file that's sure to
be wrong on the new disk.

I generally also take precautions, such as doing all this from
single-user mode; testing the new drive in single user mode first; and
then running "fsck -f" on the new partitions before continuing into
multi-user. I might also run "diff -r" on some of the directories to
make sure I didn't miss anything.