Replace a Harddisk

Here, we explain how to move from an old disk to a new one.

gpart destroy ada2

gpart create -s gpt ada2

gpart add -t freebsd-boot -l otrsboot -b 40 -s 512k -a 4k ada2

gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada2

gpart add -t freebsd-ufs -l otrsrootfs -b 1M -s 10G -a 4k ada2

gpart add -t freebsd-swap -l otrsswap -s 16G -a 4k ada2

gpart add -t freebsd-ufs -l otrsvarfs -s 2G -a 4k ada2

gpart add -t freebsd-ufs -l otrstmpfs -s 500M -a 4k ada2

gpart add -t freebsd-ufs -l otrsjotrs -s 100G -a 4k ada2

gpart add -t freebsd-ufs -l otrsjworkstation -s 100G -a 4k ada2

gpart add -t freebsd-ufs -l otrsjails -s 100G -a 4k ada2

part add -t freebsd-ufs -l otrsusrfs-a 4k ada2

gpart show -l da0
newfs -U /dev/gpt/otrsrootfsnewfs -U /dev/gpt/otrsvarfs
newfs -U /dev/gpt/otrstmpfs
newfs -U /dev/gpt/otrsjotrs
newfs -U /dev/gpt/otrsjworkstation
newfs -U /dev/gpt/otrsjails
newfs -U /dev/gpt/otrsusrfs

Mount all partitions in the right places and copy the old stuff to the new disk.

tar czpf - / | tar xzf -