2

So I have followed some guides and not been able to sort it out, this is the drives

$ df -h
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/cloudraker--vg-root  5.6G  5.5G     0 100% /
none                             4.0K     0  4.0K   0% /sys/fs/cgroup
udev                             2.0G  4.0K  2.0G   1% /dev
tmpfs                            396M  432K  395M   1% /run
none                             5.0M     0  5.0M   0% /run/lock
none                             2.0G     0  2.0G   0% /run/shm
none                             100M     0  100M   0% /run/user
overflow                         1.0M     0  1.0M   0% /tmp
/dev/sda1                        236M   78M  146M  35% /boot

showing 5GB used of 5GB, but VB was showing 10GB untill I resized it with the VBoxManage command to 20GB, booted with gparted and resized the partition.

$ VBoxManage modifyhd /raid/VirtualMachines/DevServer/DevServer.vdi --resize 20000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Drive shows as 10G

$ ls -alh /raid/VirtualMachines/DevServer/DevServer.vdi
-rw------- 1 dogmatic69 dogmatic69 10G Sep 25 23:08 /raid/VirtualMachines/DevServer/DevServer.vdi

Still shows up as 5GB...

Any ideas why or how I can make it bigger?

update per comments

$ sudo pvs
  PV         VG            Fmt  Attr PSize PFree
  /dev/sda5  cloudraker-vg lvm2 a--  9.76g    0 
$ sudo vgs
  VG            #PV #LV #SN Attr   VSize VFree
  cloudraker-vg   1   2   0 wz--n- 9.76g    0 
$ sudo lvs
  LV     VG            Attr      LSize Pool Origin Data%  Move Log Copy%  Convert
  root   cloudraker-vg -wi-ao--- 5.75g                                           
  swap_1 cloudraker-vg -wi-ao--- 4.00g

update 2

$ sudo pvresize /dev/sda5
  Physical volume "/dev/sda5" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized

$ sudo lvextend --size +10GB /dev/cloudraker-vg/root
  Extending logical volume root to 15.75 GiB
  Insufficient free space: 2560 extents needed, but only 0 available

$ sudo vgs
  VG            #PV #LV #SN Attr   VSize VFree
  cloudraker-vg   1   2   0 wz--n- 9.76g    0

Still showing 10G?

And here is the resize.. Going in after reboot it shows up as 10G again. some how reset. This was the second time (and yes I did click OK as can be seen in the logs) enter image description here

dogmatic69
  • 350
  • 1
  • 7
  • 18

1 Answers1

4

Resizing a filesystem in your scenario (virtual machine with a linux guest with LVM) consists of the following steps:

  • expand the "physical" disc in VB (you already did this)
  • expand the partion to take up the new space (you already did this)

Now you get into the realms of LVM:

  • expand the "physical volume": pvresize /dev/sda5, this will also add to the available space in the "volume group"
  • expand the "logical volume": lvextend --size +10GB /dev/cloudraker-vg/root

If you get an error telling you that there isn't enough free space for a 10 GB resize, you can look at the output of vgs again to see the exact amount of free space.

Last step is resizing the file system:

  • resize2fs /dev/cloudraker-vg/root

additionally based on this

sudo lvextend -l +100%FREE /dev/cloudraker-vg/root 
sudo resize2fs /dev/mapper/cloudraker--vg-root