Skip to content

            Lost ?  |  Need an account:
 
LVM Renaming PDF Print E-mail
(3 votes, average 5.00 out of 5)
Written by Tom Hirt   
Friday, 22 May 2009 12:51

 

Logical Volume Renaming


In this KB, we will show you how to rename a logical volume.  We will assume you already have a logical volume (LV) created on your system.  If you do not already have a LV, and you need help creating your first LV, please see our LVM Configuration KB for details.

Renaming a logical volume is a three step process:

  1. Rename the LV
  2. Remount the file system
  3. Update /etc/fstab

Remounting the file system is necessary in order for the user space to see the name change.

Note: The output of the df command will not display the new name of the file system until it has been remounted.

In the following example, we will rename the logical volume DataLV to TCPDumpLV.  Lets get started!

  1. Begin by listing all the logical volumes on the system

    [root@Linux01 ~]# lvs
    LV VG Attr LSize Origin Snap% Move Log Copy% Convert
    DataLV TCPDumpVolGRP -wi-ao 2.00G

    LogVol00 VolGroup00 -wi-ao 1.00G
    LogVol01 VolGroup00 -wi-ao 1.94G
    LogVol02 VolGroup00 -wi-ao 1.00G

    LogVol03 VolGroup00 -wi-ao 2.00G
    LogVol04 VolGroup00 -wi-ao 3.94G
    [root@Linux01 ~]#

  2. Let's find out where DataLV is mounted

    [root@Linux01 ~]# df -kh
    Filesystem
    Size
    Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol04
    3.9G 2.2G 1.6G 59% /
    /dev/sda1
    99M
    12M 82M 13% /boot
    tmpfs
    1006M
    0 1006M 0% /dev/shm
    /dev/mapper/VolGroup00-LogVol00 992M 41M 901M 5% /home
    /dev/mapper/VolGroup00-LogVol02 992M 69M 872M 8% /tmp
    /dev/mapper/VolGroup00-LogVol03
    2.0G
    150M 1.7G 8% /var
    /dev/mapper/TCPDumpVolGRP-DataLV
    2.0G
    568M 1.4G 30% /Data
    Note: The DataLV is mounted on /Data

  3. Rename DataLV to TCPDumpLV

    [root@Linux01 /]# lvrename TCPDumpVolGRP DataLV TCPDumpLV
    Renamed "DataLV" to "TCPDumpLV" in volume group "TCPDumpVolGRP"
    [root@Linux01 /]#

  4. Verify the logical volume has been renamed

    [root@Linux01 ~]# lvs
    LV VG Attr LSize Origin Snap% Move Log Copy% Convert
    TCPDumpLV TCPDumpVolGRP -wi-ao 2.00G

    LogVol00 VolGroup00 -wi-ao 1.00G
    LogVol01 VolGroup00 -wi-ao 1.94G
    LogVol02 VolGroup00 -wi-ao 1.00G

    LogVol03 VolGroup00 -wi-ao 2.00G
    LogVol04 VolGroup00 -wi-ao 3.94G
    [root@Linux01 ~]#

  5. Notice the user space has yet to be updated, this is because the file system must be remounted

    [root@Linux01 ~]# df -kh
    Filesystem
    Size
    Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol04
    3.9G 2.2G 1.6G 59% /
    /dev/sda1
    99M
    12M 82M 13% /boot
    tmpfs
    1006M
    0 1006M 0% /dev/shm
    /dev/mapper/VolGroup00-LogVol00 992M 41M 901M 5% /home
    /dev/mapper/VolGroup00-LogVol02 992M 69M 872M 8% /tmp
    /dev/mapper/VolGroup00-LogVol03
    2.0G
    150M 1.7G 8% /var
    /dev/mapper/TCPDumpVolGRP-DataLV
    2.0G
    568M 1.4G 30% /Data

  6. Remount the file system to update the user space

    [root@Linux01 /]# umount /dev/mapper/TCPDumpVolGRP-DataLV
    [root@Linux01 /]# mount /dev/TCPDumpVolGRP/TCPDumpLV /Data/
    [root@Linux01 /]#

  7. Verify the file system has been mounted

    [root@Linux01 ~]# df -kh
    Filesystem
    Size
    Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol04
    3.9G 2.2G 1.6G 59% /
    /dev/sda1
    99M
    12M 82M 13% /boot
    tmpfs
    1006M
    0 1006M 0% /dev/shm
    /dev/mapper/VolGroup00-LogVol00 992M 41M 901M 5% /home
    /dev/mapper/VolGroup00-LogVol02 992M 69M 872M 8% /tmp
    /dev/mapper/VolGroup00-LogVol03
    2.0G
    150M 1.7G 8% /var
    /dev/mapper/TCPDumpVolGRP-TCPDumpLV
    2.0G
    568M 1.4G 30% /Data

  8. Update /etc/fstab to reflect the new name of the file system

    /dev/mapper/TCPDumpVolGRP-DataLV /Data
    ext3 defaults 0 0
    /dev/mapper/TCPDumpVolGRP-TCPDumpLV /Data
    ext3 defaults 0 0

 

Nice work, you now know how to rename a logical volume!


Add this page to your favorite website
AddThis Social Bookmark Button
The script is installed correctly. Please login at seoslave.com to configure your website.
Comments
Add New Search
James  - Great walk through! |30/03/2012 05:07:04
Thanks for the walk through, it really helped me!

Special note when renaming the boot or any boot-sensitive partitions
Be sure to edit your boot loader’s sequence like in /boot/grub/menu.lst because it uses that info!!
If you forget, grab a rescue cd and get to work
pinguim  - LVrename problem |22/11/2012 04:29:27
Hello,

I am with a big problem...I lvrename a lv, but I did not change the directory of the partition, when I rename the particion name directory, the linux is saind that the special device does not exists

Can you help me?
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:D:):(:0:shock::confused:8):lol::x:P:oops::cry::evil::twisted::roll::wink::!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."

Last Updated on Tuesday, 02 June 2009 07:42
 

Forum Activity

Online Stats

Guests Online: 80
Members Online: 0



We thank you for visiting TcpDump and hope you find our knowledge base articles helpful. However, we need your support!!

If you found the content on our site useful, please help support us and visit one of our sponsors sites. Your support pays for the electric, servers and bandwidth required to run TcpDump and we can’t do it without your help!

Thank you again for all your support!

Best Regards,
-Tom Hirt