I'm having space issues on one server; the disk layout is setup so root device is on a volume group:
#vgscan
Found volume group "VolGroup00" using metadata type lvm2
#pvscan
PV /dev/xvdb1 VG lvm lvm2 [322.26 GB / 107.26 GB free]
PV /dev/xvda2 VG VolGroup00 lvm2 [29.19 GB / 0 free]
Total: 2 [351.45 GB] / in use: 2 [351.45 GB] / in no VG: 0 [0 ]
#lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [27.16 GB] inherit (my root)
ACTIVE '/dev/VolGroup00/LogVol01' [2.03 GB] inherit (swap)
As you see, no space left on LogVol01. I'm looking for a 'quick' way to add more space I can add new physical device but don't know how to tell LVM to add this to the group.
Do I need to restart and boot livecd in order to do this operation ?
(This server is running in production and i really need to figure out what to do)
thank you for your answers,
You can add a physical volume to an existing volume group with the command
vgextend VolGroup00 /dev/drive_name
Stretching out an existing logical volume over the new physical volume requires
lvextend
. I recommend reading this page, there are many things to consider when extending a logical volume.After extending the logical volume you can resize the partition with
resize2fs
, but be sure to check it for errors first usingfsck
.In this case the filesystem is the root filesystem, so a filesystem check can't be performed without rebooting. Creating a file in the root called forcefsck will make sure that fsck is run at the next boot.
touch /forcefsck
Source: the tldp pages on LVM, specifically the pages on vgextend , and lvextend.
These documentation pages are an excellent source of information on LVM.
* this post was heavily edited based on the comments.
Remove the new PV from the new VG, add it to the existing VG, and expand the LV and FS.