moving an entire system
sonicy at otenet.gr
Thu Nov 19 13:51:44 UTC 2009
n dhert wrote:
> I want to move the contents of a freebsd72 system entirely to different
> hardware (also Intel 64-bit), using dump/restore
> These are the filesystems now:
> /dev/da0s1a 2026030 650876 1213072 35% /
> /dev/da0s1e 20308398 652820 18030908 3% /tmp
> /dev/da0s1f 95719170 12449998 75611640 14% /usr
> /dev/da0s1d 20308398 2960282 15723446 16% /var
> /dev/da1p1 2175407698 168279068 1833096016 8% /home
> How should one proceed? I have an 286 Gb external USB disk formatted with a
> slice large enough to hold all dumps of all fileystems, mounted on /seagate
> /dev/da2s1a 283810126 12 260463064 0% /seagate
> a. put the original machine in single-user mode
> b. use dump (could L be left out if machine is in single-user mode?)
> /sbin/dump -0aL -f /seagate/dumpofroot.dmp /dev/da0s1a
> /sbin/dump -0aL -f /seagate/dumpoftmp.dmp /dev/da0s1e
> /sbin/dump -0aL -f /seagate/dumpofusr.dmp /dev/da0s1f
> /sbin/dump -0aL -f /seagate/dumpofvar.dmp /dev/da0s1d
> /sbin/dump -0aL -f /seagate/dumpofhome.dmp /dev/da1p1
so far so good. You probably don't need to dump /tmp.
> c. on the target machine, do a complete install of freeBSD72 from CD with
> same partition layout as original machine
No need. Just boot using the DVD or LiveFS and select the fixit option,
and the 'Use the Live CD/DVD filesystem'
> (On the target machine /home will be on /dev/da0s1g (no longer on
> d. target machine, plug in the external USB disk and mount it
> # mkdir /seagate
> # mount /dev/da2s1a /seagate
> e. restore file systems
> How exactly ? is this ok for /home :
> # umount /home
> # /sbin/newfs /dev/da0s1g
> # /sbin/mount /dev/da0s1g /mnt
> # cd /mnt
> # /sbin/restore rf /seagate/dumpofhome.dmp
> # umount /mnt
> # mount /dev/da0s1g /home
> for /tmp, /usr and /var?
> It is safe to use same procedure? or else, how to do ?
> And what for / file system ???
> will same procedure work ?
First off, use the fdisk option of sysinstall to create a slice. Press
w to exit, so the slice table is immediately written to disk. You may
also use sysinstall to create the individual partitions, although this
can be accomplished with bsdlabel once you are at the prompt.
Install the MBR and boot blocks (assuming /dev/da0 is your boot disk and
/dev/da0s1 is the FreeBSD slice):
fdisk -B /dev/da0
bsdlabel -B /dev/da0s1
newfs all the new partitions, using -U for soft updates where needed.
Usually soft updates are used in /var /usr and /tmp
newfs -U /dev/da0s1d
newfs -U /dev/da0s1e
newfs -U /dev/da0s1f
and so on. You may also add journaling (gjournal) at this point, it is
actually quite easy.
You will need two temporary mount points, one for your external drive
and one for the partition you will be restoring. The /mnt is available
as a mount point in the LiveFS cd, create another temporary one:
Now, mount your backup in /seagate:
mount /dev/da2s1a /seagate
Mount one of the new partitions in /mnt:
mount /dev/da0s1a /mnt
TMPDIR=/seagate restore -rvf /seagate/dumpofroot.dmp
Note: restore will need some tmp space, hence the TMPDIR
Before you umount /, edit at least /mnt/etc/fstab and fix your device
entries with the new ones.
Repeat with all other partitions. Don't forget to newfs the /tmp
partition that you will not be restoring.
I hope you get the general idea, you will have to adjust this slightly
for your needs.
After the first normal boot:
chmod -R 1777 /tmp
chmod -R 1777 /var/tmp
(set sticky bit on temp space)
More information about the freebsd-questions