Merge Logical Volume groups
I want to increase root LVM volume space. Is it possible to merge LogVol01 to LogVol00? My LVM setup looks like this:
[root@server~]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol00 VolGroup00 -wi-ao 34.84G
LogVol01 VolGroup00 -wi-ao 33.38G
[root@server~]# pvs
PV VG Fmt Attr PSize PFree
/dev/cciss/c0d0p2 VolGroup00 lvm2 a- 68.22G 0
[root@server~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 2 0 wz--n- 68.22G 0
[root@server~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
34G 1.3G 31G 4% /
/dev/cciss/c0d0p1 99M 13M 81M 14% /boot
tmpfs 16G 0 16G 0% /dev/shm
[root@server~]#fdisk -l
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 13 104391 83 Linux
/dev/cciss/c0d0p2 14 8920 71545477+ 8e Linux LVM
[root@server~]#lvremove -f /dev/VolGroup00/LogVol01
Can't remove open logical volume "LogVol01"
[root@server~]#lvchange -a n /dev/VolGroup00/LogVol01
/dev/hdc: open failed: No medium found
LV VolGroup00/LogVol01 in use: not deactivating
Fixed:
swapoff -a
lvchange -a n /dev/VolGroup00/LogVol01
lvextend -l +100%FREE /dev/VolGroup00/LogVol00
That should do it. Thanks Jonathan
Solution 1:
Logical volumes would have their own filesystems so it would not be possible to directly merge the two.
You would need to first remove the second volume and then grow the first.
By continuing, you will irrevocably destroy any data on your second volume.
As always, ensure you have all important data (on either volume) backed up before continuing.
You must first umount and deactivate the second volume:
lvchange -a n /dev/VolGroup00/LogVol01
Then remove it:
lvremove /dev/VolGroup00/LogVol01
Then extend your first volume:
lvextend -l +100%FREE /dev/VolGroup00/LogVol00
After that, you would need to grow your filesystem. Assuming ext4, you can grow online with:
resize2fs /dev/VolGroup00/LogVol00