Assorted FreeBSD Tips and Tricks

Migrating partitions between disks on a live system

This tip allows you to migrate an active partition on a Live system, with minimal or no downtime.

Additionally, if data is being shuffled across partitions and disks, odds are space is a precious comodity. Therefore this system does not require any additional storage space as the dumped image is never saved anywhere, it is immediately used.

Partition New Disk

Format Destination Partition
newfs /dev/disk-slice-partition

Mount Destination Partition as temporary mount, eg /mnt
mount /dev/disk-slice-partition /mnt

Change Directory into Temporary Mount Point
cd /mnt

Dump existing partition and restore it to current directory
dump -aL0 -f - <partition> | restore rvf -

(For those feeling impatient while doing this procedure, sending a SIGTERM signal, generated using ^T, will force dump to give you a percentage complete and ETA estimate to you)