Easy! Have a look at
dump(8), and
restore(8). I do it all the time. There's a bit more to it than
just that. But they are the bulk of it. Also have a look at
gpart(8), along with
newfs(8), and
mount(8). Those 5 commands are all you need to accomplish the job.
It all depends on how you want to slice up the disk(s) (layout). But here's the jist of it:
I usually use a USB stick to dump my system to. So I'll use that as an example. You can
use just about anything that FreeBSD can mount, and write to (almost). Anyway:
While not strictly required, it's safer; so boot your system to single user mode
reboot -s
Hit enter at the prompt, then
Code:
mount -u /
mount -a -t ufs
swapon -a
plug your USB stick in (we'll assume it registers as
da0
for this example
Code:
gpart destroy -F da0
gpart create -s GPT da0
gpart add -t freebsd-ufs -l USBSTICK
newfs -U /dev/gpt/USBSTICK
mount /dev/gpt/USBSTICK /mnt
OK now you have a fresly formatted USB stick mounted to /mnt
let's dump our filesystems. We'll assume a / /usr /var layout:
Code:
dump -C32 -b64 -0uanL -f /mnt/root.dump /
dump -C32 -b64 -0uanL -f /mnt/var.dump /var
dump -C32 -b64 -0uanL -f /mnt/usr.dump /usr
OK everything you want to pour onto your new system is ready.
Use
gpart(8), and
newfs(8) as we did for the USB stick, but on the drive you intend to put the file systems on, and then use
mount(8) as we did to mount our USB stick, and finally, use
restore(8) to pour the filesystems onto the newly formated drive(s).
There are 2 additional commands you will want to use to make the new drive bootable. So I'll mention them now:
We will also assume your new drive also registers itself as
da0
, just for simplicity, and lack of confusion. In all likelyhood, it will be something like
adaN
, or
adN
. But let's not concern ourselves with that, right now.
Code:
gpart destroy -F da0
gpart create -s GPT da0
gpart add -t freebsd-boot -l gboot -b 64 -s 512K
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da0
OK now it'll be bootable. Let's talk about size. I haven't mentioned that; we'll assume for the sake of example you want a 9 Gigabyte root ( / ):
Code:
gpart add -t freebsd-ufs -l groot -s 9G da0
So now you should have a pretty good idea of how to manage the rest. Read the
man(1) pages I've linked here, they have additional examples. You should then feel well armed for the task.
All the best.
--Chris