Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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,

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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 using fsck.

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.

share|improve this answer
    
Thanks fell upon this too; now i have added the device I see the correct size on the vgscan but when I try to resize2fs it says that the device is already XXX blocks long. Nothing to do. In 'df' it shows the previous size. –  Disco Jan 26 '11 at 12:37
    
the partition is ext3. –  Disco Jan 26 '11 at 12:38
    
Try running fsck.ext3 on the partition, see if there is something wrong with the filesystem. –  Kenny Rasschaert Jan 26 '11 at 12:42
    
on a running mounted root system ??? –  Disco Jan 26 '11 at 12:45
1  
@kenny.r can you edit your answer to contain the steps required so it's easier to see rather than having to read though the comments please. –  Iain Jan 26 '11 at 23:35

Remove the new PV from the new VG, add it to the existing VG, and expand the LV and FS.

share|improve this answer
    
I haven't added the new PV yet; can you please describe the whole process with examples ? –  Disco Jan 26 '11 at 12:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.