To move the /usr
or /var
file system to another hard disk on a FreeBSD system, you will need to do the following:
Make sure that the target hard disk is connected and properly configured on the system.
Create a new file system on the target hard disk. This can be done using the newfs
command.
For example, to create a new UFS file system on the target hard disk, you can run the following command:
# newfs -U /dev/<disk>
Replace <disk>
with the device name of the target hard disk, such as da0
or ada1
.
mount
command.For example, to mount the new file system at the /mnt
mount point, you can run the following command:
# mount /dev/<disk> /mnt
Replace <disk>
with the device name of the target hard disk.
/usr
or /var
file system to the new file system. This can be done using the cp
command.For example, to copy the contents of the /usr
file system to the new file system, you can run the following command:
# cp -Rp /usr/* /mnt
This will copy all the files and directories in the /usr
file system to the /mnt
mount point.
/usr
or /var
file system. This can be done using the umount
command.For example, to unmount the /mnt
and /usr
file systems, you can run the following commands:
# umount /mnt # umount /usr
/etc/fstab
file to reflect the new location of the /usr
or /var
file system. This can be done by editing the /etc/fstab
file and updating the entry for the /usr
or /var
file system to point to the device name of the target hard disk.For example, to move the /usr
file system to the target hard disk, you can update the /etc/fstab
file to look like this:
/dev/<disk> /usr ufs rw 2 2
Replace <disk>
with the device name of the target hard disk.
After the system has been rebooted, the /usr
or /var
file system should be located on the target hard disk.