Moving Freebsd to a new Server

Warren Block wblock at wonkity.com
Thu Jun 7 14:24:03 UTC 2007


On Thu, 7 Jun 2007, Ian Lord wrote:

> Basically, I need a way to dump the hd to file, transfer the file over
> whatever media (dvd, network, etc) and restore on the new machine.

Personally, I do a minimal install of FreeBSD on the target machine 
first.  That lets you set the partitions the way you want and gives you 
a complete set of tools.

As always, back up the source machine before starting.

Dump the /, /var, and /usr filesystems from the source machine into 
files, and any others with contents you need.  For example:

dump -0af /tmp/slash.dump /

Of course, the output should be on a different filesystem than the one 
being dumped, and ideally a separate disk to avoid head thrashing (/tmp 
shown below, but most people don't have enough space in /tmp to do it. 
You can use NFS or ssh or other methods to use remote files.)

On later versions of FreeBSD, you should give dump the -L option to use 
a snapshot of the filesystem.

Giving dump more memory with -C can also help, although it runs multiple 
instances, so too much will cause swapping.

Ultimately, for a typical FreeBSD 6.2 machine:

dump -C8 -L -0af /tmp/slash.dump /
dump -C8 -L -0af /tmp/var.dump /var
dump -C8 -L -0af /tmp/usr.dump /usr

Get those files onto the target machine, again in an unused filesystem 
or separate disk, and restore:

cd /usr
restore -ruf /tmp/usr.dump
cd /var
restore -ruf /tmp/var.dump
cd /
restore -ruf /tmp/slash.dump

Now is a good time to fix anything that will be different in /etc/fstab, 
like references to ad0 that should be ad2.

Reboot and fix anything else that needs to be changed.

-Warren Block * Rapid City, South Dakota USA


More information about the freebsd-questions mailing list