FreeBSD Move /usr or /var File System To Another Hard Disk

www.lautt‮iru‬.com
FreeBSD Move /usr or /var File System To Another Hard Disk

To move the /usr or /var file system to another hard disk on a FreeBSD system, you will need to do the following:

  1. Make sure that the target hard disk is connected and properly configured on the system.

  2. 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.

  1. Mount the new file system at a temporary mount point. This can be done using the 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.

  1. Copy the contents of the /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.

  1. Unmount the new file system and the original /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
  1. Modify the /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.

  1. Reboot the system to apply the changes.

After the system has been rebooted, the /usr or /var file system should be located on the target hard disk.

Created Time:2017-10-28 20:40:35  Author:lautturi