Friday, June 8, 2018

Rename Logical volume and mount point on SUSE Linux

Rename Logical volume and mount point on SUSE Linux.

while doing day today administration task on SUSE linux one day i got task to rename existing LV name and mount point.when i got this task first thought in my mind was ,is it possible while File system is in mounted state ??.so answer to this is NO.

Here is the scenario

Filesystem                              Type  Size      Used   Avail   Use%   Mounted on
/dev/mapper/vg01-lvopt_IBM ext3  9.8G      2.8G    6.5G  30%       /opt/IBM
Rename LV name from lvopt_IBM to lvopt_IBMNew and chnage mount point to /opt/IBMNew
solution:

1.First take fstab file backup using command
  cp /etc/fstab /etc/org_fstab

2.mkdir -p /opt/IBMNew   //make sure that same name directory not exist in mentioned path.

3.umount /opt/IBM

4.lvrename vg01  lvopt_IBM   lvopt_IBMNew

syntax: lvrename [vg name]  old_lv_name   new_lv_name

5.Change /etc/fstab entry with New LV and mount point name

old 

/dev/vg01/lvopt_IBM  /opt/IBM             ext3       defaults              1 2

New

/dev/vg01/lvopt_IBMNew  /opt/IBMNew            ext3       defaults              1 2

6. mount /opt/IBMNew  

Check mounted file system using command 

df -hT /opt/IBMNew
Filesystem                              Type  Size      Used   Avail   Use%   Mounted on
/dev/mapper/vg01-lvopt_IBMNew ext3  9.8G      2.8G    6.5G  30%       /opt/IBMNew

Thanks .


No comments:

Post a Comment