Ubuntu – Encountered problem resizing LVM drive with GParted


I've been running a virtual version of Ubuntu via Virtualbox on Windows 8 (host) for a while. However it's recently started to run low on space so I've been using this tutorial to resize it:

I've got as far as "step 3" (although in reality there are a lot more steps…. I've actually got to the stages around Fig3/Fig4 in that section) but I've encountered a problem.

Gparted shows my /dev/sda2 and /dev/sda5 as being locked

I read in this thread about running lvremove, lvscan, etc, but when I try to do that I get the following error message:

user@debian:~$ lvscan
Warning: Running as a non-root user. Functionality may be unavailable.
/run/lvm/lvmetad.socket: connect failed: Permission denied
Warining: Failed to connect to lvmetad. Falling back to internal scanning.

Normally I'd be happy to fiddle with things until I can work it out, but due to what could happen if I mess this up I'm reluctant to blindly fiddle in this instance. I have had a google but haven't been able to find out what I need to do to get past this.

Can someone please advise either:

  1. what I need to do to be able to run this as a non-root user,
  2. what I need to do to be able to run this as a root user
    (It's a fresh Gparted CD running on a fresh VirtualBox Ubuntu setup
    so I haven't setup any users on it yet)
  3. anything else I need to do to get this to run, so I can continue with the above tutorial.

Please note: I'm a front end web developer primarily used to work in a windows environment, so if you can keep any instructions simple and assume no assumed linux/Gparted knowledge that would be much appreciated 🙂


Best Answer

  • In order to grow the LVM2 PV partition, you will first need to deactivate LVM. After that you can grow the extended partition followed by the LVM2 PV partition. The steps roughly are as follows:

    1. Backup your data in case anything should happen to go wrong.
    2. Boot VM using GParted Live.
    3. Select /dev/sda5 LVM2 PV partition
    4. Choose Partition -> Deactivate
    5. Select /dev/sda2 Extended partition
    6. Choose Partition -> Resize/Move
    7. Grow the partition to the end of the drive.
    8. Select /dev/sda5 LVM2 PV partition
    9. Choose Partition -> Resize/Move

    10. Grow the partition to butt up against the end of the sda2 Extended partition.

    11. Apply the operation
    12. Exit GParted, and boot into the VM OS.
    13. In a terminal window, with root privilege (su or sudo), use the appropriate lvresize command line options to grow the logical volume(s) you wish to increase in size.

    'Hope that helps.