newmab1
January 16th, 2005, 02:02
I have installed a new HD along with my current one, and set it as the slave. I would like to copy my current HD to the new HD then boot from the new HD. Any tips on how to acomplish this?

bmw
January 16th, 2005, 11:12
I assume that you have partitioned (*BSD partitions!) the new drive. Then here's my recipe:

First, create a new dir, say "clone", on old-HD. Create mount-points for all the partitions other than root under clone. Eg:
/clone
/clone/tmp
/clone/var
/clone/usr
Mount the partitions of new-HD on those mount-points starting with root ...
# mount /dev/ad1s1a /clone
# mount /dev/ad1s1d /clone/tmp
# mount /dev/ad1s1e /clone/var
# mount /dev/ad1s1g /clone/usr
Now, you run tar to clone the old-HD to the new-HD, being careful not to create an infinite-loop of copying!
# cd /
# tar -cf - -X /clone . | (cd /clone; tar xvfp - )
That causes one copy of tar to read your old-HD and pipe all the contents to another copy of tar which unpacks it all onto your new-HD. The reason you use tar rather than "cp -Rp" is because tar preserves hard-links and creates device nodes.

(Note: this is from memory and manpages; backup your old-HD (if you care about it) and test the "tar -cf - -X /clone" bit because it might need tweaking.)


Now you have two choices for "booting off the new drive": open up the machine and swap the drives around - that's the brute-force way. :-)

Or make sure you have the fancy FreeBSD boot-manager installed on the old-HD. That's the boot manager that displays the: F1 FreeBSD; F2 Linux; menu. You should be able to get that to recognize your new drive and let you boot from it. Check the online FreeBSD Handbook for info on that.