Last Updated: 21 Nov 2020

   |   

Author: (external edit)

FreeBSD Disk Upgrade / Swap Procedure

This outlines how to move data from one disk to another, newer, bigger disk. There may be better/more advanced ways to do this, but this uses simple tools and works pretty well.

  • First plugin the new disk to a secondary SATA/IDE port
  • Boot from the FreeBSD CD-ROM, and go to 'Configure', then 'fdisk'. Set it to use all disk, then 'W' to write the data
  • REBOOT, still with FBSD CD-ROM, go to 'Configure' and disklabel. Setup the disk how you want (unless you need something special, e.g. for EV, 'auto' default are probably fine.) Press 'w' to save your changes. For reasons unknown, the reboot is necessary between fdisk and disklabel.
  • Take out the CD-ROM, and boot into single user mode (from the original OS)
  • Mount existing file systems:
    • mount -a
  • Mount the secondary drive in a mount partition. If your new drive is on /dev/ad16, you'd type:
    • mount /dev/ad16s1a /mnt
    • mount /dev/ad16s1d /mnt/var
    • mount /dev/ad16s1e /mnt/usr
  • Verify old and new filesystems are mounted with df -h
  • Use dump/restore to copy data on the various partitions over:
    • cd /mnt
    • dump -0 -f - / | restore -r -f -
    • cd /mnt/var
    • dump -0 -f - /var | restore -r -f -
    • cd /mnt/usr
    • dump -0 -f - /usr | restore -r -f -
  • Once the copy is finished, turn off the machine, disconnect the old drive, and plug the new drive into its SATA port. You need to use the same port as the old drive, or else you'll have to edit the fstab file on the new drive to get the system to boot.
  • Make sure the OS boots, and everything looks good. And you're done!

Discussion

Enter your comment. Wiki syntax is allowed: