[LVM]LV rename
發表於 : 2012-12-19 12:05:15
http://www.tcpdump.com/kb/os/linux/lvm-renaming.html
Renaming a logical volume is a three step process:
Rename the LV
Remount the file system
Update /etc/fstab
Begin by listing all the logical volumes on the system
Let's find out where DataLV is mounted
Rename DataLV to TCPDumpLV
Verify the logical volume has been renamed
Notice the user space has yet to be updated, this is because the file system must be remounted
Remount the file system to update the user space
Verify the file system has been mounted
Update /etc/fstab to reflect the new name of the file system
Nice work, you now know how to rename a logical volume!
Renaming a logical volume is a three step process:
Rename the LV
Remount the file system
Update /etc/fstab
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 ~]#
代碼: 選擇全部
[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
代碼: 選擇全部
[root@Linux01 /]# lvrename TCPDumpVolGRP DataLV TCPDumpLV
Renamed "DataLV" to "TCPDumpLV" in volume group "TCPDumpVolGRP"
[root@Linux01 /]#
代碼: 選擇全部
[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 ~]#
代碼: 選擇全部
[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
代碼: 選擇全部
[root@Linux01 /]# umount /dev/mapper/TCPDumpVolGRP-DataLV
[root@Linux01 /]# mount /dev/TCPDumpVolGRP/TCPDumpLV /Data/
[root@Linux01 /]#
代碼: 選擇全部
[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
代碼: 選擇全部
/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!