|
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:
- Rename the LV
- Remount the file system
- 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!
- 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 ~]# |
|
- 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
- Rename DataLV to TCPDumpLV
[root@Linux01 /]# lvrename TCPDumpVolGRP DataLV TCPDumpLV Renamed "DataLV" to "TCPDumpLV" in volume group "TCPDumpVolGRP" [root@Linux01 /]#
|
- 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 ~]# |
|
- 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 |
|
- 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 /]#
|
- 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 |
|
- 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 The script is installed correctly. Please login at seoslave.com to configure your website.
|
|
Last Updated on Tuesday, 02 June 2009 07:42 |