Tuesday, 1 March 2022

How to Change or Rename a Regular Mount Point in CentOS 7



Sometimes mount point renaming require on a machine for any user request or any application requirements.

This article describes How to Change or Rename a Regular Mount Point in CentOS 7.

Step 1. Validate Existing Mount Point: Run the following command to verify the existing file system /mount point on the machine.

[root@slave-dns ~]# df -hT /appdata/
Filesystem                     Type  Size  Used Avail Use% Mounted on
/dev/mapper/vg_data-lv_appdata xfs   8.0G   33M  8.0G   1% /appdata
[root@slave-dns ~]#

Step 2. Directory Creation: Run the following command to a directory to mount the file system.

[root@linuxcnf ~]# mkdir /dbdata
[root@linuxcnf ~]#

Step 3. Unmounting File System: Run the following command to unmount the existing /aapdata mount point. Make sure any process is not utilizing the file system.

[root@linuxcnf ~]# umount /appdata/
[root@linuxcnf ~]#

Step 4. LV Renaming: [Optional] Run the following command to rename logical volume name. This step can be skipped if logical volume renaming not require.

[root@linuxcnf ~]# lvrename /dev/vg_data/lv_appdata /dev/vg_data/lv_dbdata
  Renamed "lv_appdata" to "lv_dbdata" in volume group "vg_data"
[root@linuxcnf ~]#
 
Step 4. Mounting File System: Now run the following command to mount the new /dbdata mount point.

[root@linuxcnf ~]# mount /dev/vg_data/lv_dbdata /dbdata/
[root@linuxcnf ~]#

 Step 5. Fstab Entry: Run the following command to open and edit the /etc/fstab file and replace existing mount point /appdata to /dbdata in the file to auto mount across reboot.

[root@linuxcnf ~]# vi /etc/fstab
..................
/dev/mapper/vg_data-lv_data     /dbdata         xfs     defaults        0 0

Step 6. Verify: Run the following command to verify the new mount point is mounted or not:

[root@linuxcnf ~]# df -hT /dbdata/
Filesystem                    Type  Size  Used Avail Use% Mounted on
/dev/mapper/vg_data-lv_dbdata xfs   8.0G   33M  8.0G   1% /dbdata
[root@linuxcnf ~]#

Done!!! The mount point and logical volume renaming is successful done on CentOS 7.

No comments:

Post a Comment