5

I'm attempting to grow /dev/sda5, which is an 'lvm2 pv' partition, but it's contained in /dev/sda2, which is an extended partition.

There is plenty of "unallocated" space immediately after /dev/sda2, since I've just cloned my previous disk to a larger one.

My plan is to resize the extended partition, and then resize the contained PV to match. Then I'll extend the VG and the filesystem.

So I've booted using a Linux Mint 17.1 USB stick and run gparted. It won't let me resize the extended partition, claiming that it's "Busy (At least one logical partition is mounted)".

However, running mount (or cat /proc/mounts) doesn't show anything other than the Live USB image mounted.

What's the problem?

  • Why do you want to extend a PV instaed of just adding a new one? – guntbert Apr 10 '16 at 20:19
  • Because the free space is directly adjacent to the existing PV. Why wouldn't I want to do that? – Roger Lipscombe Apr 11 '16 at 7:49
8

Because the partition contains an LVM2 volume group, it's treated as busy (even if it doesn't appear mounted). You need to deactivate the VG:

sudo vgscan      # to discover the name of the volume group "mint-vg"
sudo vgchange -a n mint-vg

Then, in gparted, select GParted / Refresh Devices. This should remove the lock icon from the partitions.

Aside: rather than a lock icon, my copy of gparted displays a telephone, which is ... confusing.

At this point, you should be able to resize the extended partition, /dev/sda2 as normal to use the unallocated space. Apply the change.

Then resize the 'lvm2 pv' partition, /dev/sda5. Apply the change.

Then resize the PV:

sudo pvresize /dev/sda5

Check the new size:

sudo pvdisplay /dev/sda5

Reactivate the volume group:

sudo vgchange -a y mint-vg

Then extend the logical volume into the new space:

sudo lvextend /dev/mint-vg/root /dev/sda5

I forgot to specify -r to resize the filesystem, so I have to do that as well...

sudo e2fsck -f /dev/mint-vg/root
sudo resize2fs /dev/mint-vg/root
  • This should be the accepted answer. The last bit about resizing the file system was crucial to me. – Eduardo Bezerra Jul 5 '16 at 11:22
  • Wow. This answered my question exactly. – Stephen305 May 9 '18 at 17:07
2

The LVM2 Volume Group(s) on your PV are started. Logical Volumes on this VG(s) might also be started. Stop them with lvchange -an and vgchange -an (after making sure no filesystems from any VG/LV is mounted.)

  • Thanks. I figured that out shortly after I posted the question -- bringing up the Information window for the lvm partition in gparted shows "Status: mint-vg active". Could you take a look at my answer and maybe throw in some comments or edits, please? – Roger Lipscombe Apr 10 '16 at 19:39
  • Thanks! This helped me a lot. I also had to unmount swap partition first using swapoff - without this vgchange -an was not able to stop it. – Daniel Frużyński Sep 24 '18 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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