|
Written by Tom Hirt
|
|
Friday, 22 May 2009 12:51 |
|
Logical Volume Removal
In this KB, we will show you how to remove 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.
Removing a logical volume is a three step process:
- Unmount the LV
- Remove the LV
- Update /etc/fstab
Note: Make sure you unmount the file system before removing the LV. Forcing the removal of a LV before it is unmounted could have unknown consequences on your system.
In the following example, we will remove the logical volume 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 |
| 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 ~]# |
|
- Let's find out where TCPDumpLV 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-TCPDumpLV
|
2.0G
|
568M |
1.4G |
30% |
/Data |
|
Note: TCPDumpLV is mounted on /Data
- Unmount TCDDumpLV
[root@Linux01 /]# umount /Data [root@Linux01 /]#
|
- Remove the logical volume
[root@Linux01 /]# lvremove /dev/TCPDumpVolGRP/TCPDumpLV Do you really want to remove active logical volume "TCPDumpLV"? [y/n]: y Logical volume "TCPDumpLV" successfully removed [root@Linux01 /]#
|
- Verify the logical volume has been removed
| [root@Linux01 ~]# lvs |
| LV |
VG |
Attr |
LSize |
Origin |
Snap% |
Move |
Log |
Copy% |
Convert |
| 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 ~]# |
|
- Update /etc/fstab to reflect the removal of the file system
| /dev/mapper/TCPDumpVolGRP-TCPDumpLV |
/Data
|
ext3 |
defaults |
0 |
0
|
|
Nice work, you now know how to remove a logical volume!
Add this page to your favorite website
|
|
Last Updated on Tuesday, 02 June 2009 07:49 |