Extending partition in teijenkins


Permalink 04:47:52 pm, by mholmes, 239 words, 72 views   English (CA)
Categories: Servers, Activity log, Documentation; Mins. worked: 90

Extending partition in teijenkins

HR (sysadmin) expanded the disk for the teijenkins1204 vm to 75GB, since it's been running out of space, and then I had to figure out how to add that space to the root filesystem. I followed the steps here to do that; it basically worked like this:

I had sda, with sda1 as the boot partition, sda2 as extended, and sda5 as Linux LVM. The extended (sda2) consisted only of the LVM (sda5). What I had to do with create a new Linux LVM partition in the new free space, then add that partition to the underlying Volume Group (teijenkins1204), then extend the Logical Volume by adding it.

vgdisplay # to see the names of volume group and volume

cfdisk /dev/sda  # creating /dev/sda6 in this case; had to reboot to see it. This is a little terminal GUI that's quite easy to figure out. Choose 8E for the filesystem type Linux LVM.
pvcreate /dev/sda6 # initialize for use by LVM
vgextend teijenkins1204 /dev/sda6 # add this new volume to the volume group
lvextend -L+29G /dev/mapper/teijenkins1204-root # extend the size of the logical volume
resize2fs /dev/mapper/teijenkins1204-root # resize the filesystem

Then a reboot. NOTE: if you do fdisk -l, you may see messages like this:

Disk /dev/mapper/teijenkins1204-swap_1 doesn't contain a valid partition table

This appears to be caused by the fact that fdisk doesn't understand LVM. It's not a problem.


This blog is the location for all work involving software and hardware maintenance, updates, installs, etc., both routine and urgent, in the server room, the labs and the R&D rooms.


XML Feeds