Installing a partition from a partition image

Apologies, if this is a naive question, but I'm not sure of the answer...

If I have a working FreeBSD system can I dd() a partition as a file, ie dd if=/dev/da0s2 of=/mnt/backup/partion.img and subsequently run dd to copy to another partition, will I then have a working system on the target system? ...assuming the new system is correctly partitioned and bootable, and with a correctly amended /etc/fstab
 
using dd will work but you will end up with copy the free space which will be time consuming and you will end up with a bigger .img file. It's better to use dump/restore for UFS or send/receive for ZFS.
 
The "canonical" tools for doing filesystem backups and restore under FreeBSD are dump(8) and restore(8). They are (like many mature unix type tools) not (newbie)user friendly, but they are not very hard to learn either.
 
I copied many times a freebsd partition & installation with just "cp -axf"
It's always useful to know what options people use. I'd never used -x or -f before, but having '-axf' sounds like a good default.

Maybe I should create an alias of 'xcopy' which invokes 'cp -axf'...
 
Back
Top