0

There are other similar questions however none has provided an answer that works for me.

My VirtualBox Ubuntu VM has grown out of available storage and I would like to add more space to the main partition.

I have added storage to the Ubuntu drive then booted using Gparted Live to attempt to resize the partition, however the partition is shown as locked (has a key icon next to it) and so gparted is unable to resize it.

I tried deactivating and reactivating it, but that didn't help.

Any suggestions on how to make the partition resizeable from Gparted live?

Update: added screen shot.

You can see the grayed out controls which indicate that I can't make any changes.

Yes, I have tried to unmount and re-mount the partition but it gets back to the same locked state.

And yes, I booted using GParted Live CD.

enter image description here

Update:

lsblk

NAME                  MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0                   7:0    0 220.7M  1 loop /snap/atom/241
loop1                   7:1    0  14.8M  1 loop /snap/gnome-characters/367
loop2                   7:2    0 140.7M  1 loop /snap/gnome-3-26-1604/97
loop3                   7:3    0   236M  1 loop /snap/kde-frameworks-5/27
loop4                   7:4    0     1M  1 loop /snap/ark/6
loop5                   7:5    0  89.1M  1 loop /snap/core/8039
loop6                   7:6    0 260.7M  1 loop /snap/kde-frameworks-5-core18/32
loop7                   7:7    0   132K  1 loop /snap/gtk2-common-themes/5
loop8                   7:8    0   217M  1 loop /snap/atom/242
loop9                   7:9    0   156M  1 loop /snap/gnome-3-28-1804/91
loop10                  7:10   0 140.7M  1 loop /snap/gnome-3-26-1604/98
loop11                  7:11   0  89.1M  1 loop /snap/core/8213
loop12                  7:12   0 101.5M  1 loop /snap/p7zip-desktop/220
loop13                  7:13   0  54.6M  1 loop /snap/core18/1279
loop14                  7:14   0   132K  1 loop /snap/gtk2-common-themes/4
loop15                  7:15   0   4.2M  1 loop /snap/gnome-calculator/544
loop16                  7:16   0     1M  1 loop /snap/ark/7
loop17                  7:17   0   956K  1 loop /snap/gnome-logs/81
loop18                  7:18   0   4.2M  1 loop /snap/gnome-calculator/501
loop19                  7:19   0   3.7M  1 loop /snap/gnome-system-monitor/111
loop20                  7:20   0  14.8M  1 loop /snap/gnome-characters/359
loop21                  7:21   0  42.8M  1 loop /snap/gtk-common-themes/1313
loop22                  7:22   0  54.5M  1 loop /snap/core18/1265
loop23                  7:23   0 156.7M  1 loop /snap/gnome-3-28-1804/110
loop24                  7:24   0   956K  1 loop /snap/gnome-logs/73
loop25                  7:25   0  44.2M  1 loop /snap/gtk-common-themes/1353
loop26                  7:26   0   3.7M  1 loop /snap/gnome-system-monitor/107
loop27                  7:27   0  50.7M  1 loop /snap/p7zip-desktop/163
loop28                  7:28   0 255.6M  1 loop /snap/kde-frameworks-5-core18/30
sda                     8:0    0  25.6G  0 disk 
└─sda1                  8:1    0  25.6G  0 part 
  ├─ubuntu--vg-root   253:0    0  21.6G  0 lvm  /
  └─ubuntu--vg-swap_1 253:1    0     4G  0 lvm  [SWAP]
sr0                    11:0    1  56.8M  0 rom  /media/ady/VBox_GAs_6.1.0
sr1                    11:1    1  56.8M  0 rom  /media/ady/VBox_GAs_6.1.01

sudo pvs

  PV         VG        Fmt  Attr PSize  PFree
  /dev/sda1  ubuntu-vg lvm2 a--  25.57g    0 

sudo vgs

  VG        #PV #LV #SN Attr   VSize  VFree
  ubuntu-vg   1   2   0 wz--n- 25.57g    0 

sudo lvs

  LV     VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   ubuntu-vg -wi-ao---- 21.57g                                                    
  swap_1 ubuntu-vg -wi-ao----  4.00g                                   
Ady
  • 381
  • 5
    It's not a partition: it's a logical volume. Does this answer your question? How can I resize an LVM partition? (i.e: physical volume) – Fabby Dec 09 '19 at 19:26
  • Thank you. Following that link, the first answer says: "sudo umount /dev/vg_blah/lv_blah", with "blah" I assume being a placeholder for the real values in each case, but I'm not sure what my values are supposed to be. I may need step by step instructions tailored to my specific situation. – Ady Dec 10 '19 at 01:03
  • I think you are barking up the wrong tree by thinking GParted is the tool you need. This appears to be a virtual machine that is low on space. Hence the additional space needs to come from the host. Since you have LVM in play surely all you need to do is create a additional virtual disk and add it to the volume group? – PonJar Dec 10 '19 at 17:10
  • I had added a few Gb of space from VirtualBox and you can see the right arrow indicating that the partition space can be in theory extended - not by much, but enough for what I need. But when I try to drag that arrow to the right, it ignores my command, the reason being that the partition is "locked" or read-only based on what I've seen in other posts and on the key icon next to it. – Ady Dec 10 '19 at 21:50
  • You might find this link useful. https://www.tecmint.com/extend-and-reduce-lvms-in-linux/ You need to extend the volume group and resize the filesystem – PonJar Dec 10 '19 at 23:01
  • Here's the article I used for my attempts: https://www.howtogeek.com/124622/how-to-enlarge-a-virtual-machines-disk-in-virtualbox-or-vmware/ . The VM they are enlarging is Win7 so NTFS, but GParted should work the same way on regardless the OS or partition type, at least that's my understanding. – Ady Dec 11 '19 at 05:24
  • Your howtogeek link is fine for physical disks and even virtual disks. However you are dealing with LVM. That means your virtual disks are combined into a volume group which can then be partitioned into logical disks. If you have increased the size of your virtual disk(s) you have to make that available in the volume group. I think the link I found above explains that. – PonJar Dec 11 '19 at 14:00
  • @PonJar I followed the instructions in your linked article and I get to the point where I run "sudo vgdisplay" and I get "Alloc PE / Size: 6547 / 25.57Gb, Free PE / Size: 0 / 0" while in the article Free PE size is > 0. At the same time VirtualBox says Actual Size: 24.81Gb, Virtual Size 29.30 Gb. How do I make the extra 5Gb added by VirtualBox available to these utilities for resizing? – Ady Dec 12 '19 at 00:47
  • Can you please post the output of lsblk, sudo pvs, sudo vgs and sudo lvs as an edit to the question so that we can see the broader picture of yoursetup. – PonJar Dec 12 '19 at 13:08
  • Did you increase the size of your virtual disk after posting the Gparted image in your question? If so is there now some unallocated space? Also what version of Gparted are you running. What OS is your host and how much spare file space exists in the host? – PonJar Dec 12 '19 at 22:39
  • Actually I increased the size of the virtual disk before I posted the Gparted image. VirtualBox says there is about 5Gb of unallocated virtual disk space. I downloaded the latest (as of Monday) GParted iso image from their site.The host OS is Windows 10 Pro with over 30Gb of available SSD storage. – Ady Dec 13 '19 at 03:23
  • I have a VM that I set up a few months ago to muck about with LVM disks. I've just increased the size of one of the disks using the Virtual Box tools interface. I restarted the VM and ran Gparted (Version 1.0.0). It showed the additional space as unallocated. I was able to resize the existing partition to make use of the unallocated space. sudo pvs showed the increase in this physical volume. sudo vgdisplay showed free PE available. sudo lvextend made the additional space availabe to my logical disk. I didn't have to use resize2fs. Job done. I don't know why this is not working for you. – PonJar Dec 13 '19 at 10:54
  • 1
    Just a stab in the dark but "sudo partprobe" is meant to get the kernel to re-read the sizes of partitions ....... and if all else fails create a new virtual disk using some of that host space, attach it to to the VM and use it as an additional physical volume. Add it to the volume group and extend your logical volume – PonJar Dec 13 '19 at 11:16

0 Answers0