Subject: Re: Copy HD
To: Joseph Chin <yardie@vt.edu>
From: Kevin P. Neal <kpneal@pobox.com>
List: netbsd-help
Date: 07/17/2001 08:48:03
On Tue, Jul 17, 2001 at 01:48:26AM -0400, Joseph Chin wrote:
> What steps would I need to take to copy my existing system onto a bigger HD.
> I have a DEC 3000/300LX with 540MB HD and I'm in the process of replacing it
> with a 2GB unit. At the same time I also want to expand my /usr partition to
> take advantage of the additional capacity. This is my webserver but I'm
> looking forward to making the box into a fileserver.
Partition the new drive with the size partitions you want. Mount the
new root partition (I assume you are moving root over) at /altroot or
some other mount point (/mnt is a popular place). Mount the other new
partitions at the correct location under /altroot.
You will have to make a directory for each mount before you do the actual
mount. So you will have to do a:
mount /dev/sd?a /altroot; mkdir /altroot/usr; mount /dev/sd?? /altroot/usr
(Or something similar.)
Next you get to move your old filesystems over to the new disk. You can
do this with tar or dump+restore. I usually just use tar for this:
cd / ; tar -cvvf - etc dev root usr var stand boot netbsd |
(cd /altroot ; tar -xpvvf -)
Note that that is all on one line. It would probably be better to use
dump and restore (dumping to stdout and restoring from same) since dump
doesn't cross filesystem boundries (and thus would not recurse into
/altroot accidentally). If you do use tar like I gave above be careful
to not forget to use the "p" option when unpacking (it preserves all
permissions).
Edit /altroot/etc/fstab to make sure the correct partitions get mounted
at reboot. If you are removing the old disk then you may not have to
change the fstab file -- it depends on what partitions you put where
on the new disk.
Last you need to run installboot to setup the bootblocks for the new root
partition. I usually check the man page when doing this, and then I
check it again, and then I stare at it for while. I've left myself with
an unbootable system before when changing the boot blocks, so I'd advise
caution.
--
Kevin P. Neal http://www.pobox.com/~kpn/
'Concerns about "rights" and "ownership" of domains are inappropriate.
It is appropriate to be concerned about "responsibilities" and "service"
to the community.' -- RFC 1591, page 4: March 1994