In FreeBSD, it is possible to move the /usr or /var file systems to another hard disk. The steps below will guide you through the process:
- Backup the contents of the
/usror/varfile system to the new hard disk. You can usersyncfor this purpose:sudo rsync -avz /usr /mnt/new_disk
In the above command, replace
/usrwith/varif you are moving the/varfile system. Replace/mnt/new_diskwith the mount point of the new hard disk. - Unmount the old
/usror/varfile system:sudo umount /usr
In the above command, replace
/usrwith/varif you are moving the/varfile system. - Edit the
/etc/fstabfile and change the mount point of the/usror/varfile system to the new hard disk:# Before
/dev/ada0p3 /usr ufs rw 2 2# After
/dev/ada1p3 /usr ufs rw 2 2
In the above example,
/dev/ada0p3is the old partition and/dev/ada1p3is the new partition. Replace/usrwith/varif you are moving the/varfile system. - Mount the new
/usror/varfile system:sudo mount /usr
In the above command, replace
/usrwith/varif you are moving the/varfile system. - Reboot the system to ensure that the new file system is mounted correctly:
sudo reboot
After the system has restarted, verify that the new file system is mounted correctly:
df -h
The output should show the new mount point for
/usror/var.Note: If you encounter any issues during this process, it is recommended to boot the system from an installation disk or a recovery disk to make the changes.