1

In most of my Ubuntu 14 and 16 Servers VM's I have partitions set up like this:

lvm> lvscan
  ACTIVE            '/dev/server01-vg/root' [29.76 GiB] inherit
  ACTIVE            '/dev/server01-vg/swap_1' [2.00 GiB] inherit

When I give the VM more diskspace through the hypervisor, I use this method to make it available to the VM: Shut the system down, reboot with partedmagic/gparted and resize the partitions to the maximum available diskspace. Then I reboot again and issue a lvextend followed by a resize2fs command to add the available diskspace to my root partition.

This is pretty cumbersome, if I do this on a Windows Server system, I can just click "Expand" on the partition in Disk Management and it's done and available without rebooting.

Is there something smarter for this? Like a bash script or tool which does all that?

(I don't want to add extra partitions, only grow my root partition and make it all available to the filesystem. I am using Ubuntu Server, not Desktop, so I can't use graphical tools).

1 Answer 1

0

Have you tried using gparted to change the partition size from inside the VM? You should be able to expand your root partition (mounted at '/') while running. See here for more info on expanding a partition while running.

4
  • It's the Server edition without GUI. Mar 1, 2017 at 21:53
  • That is slightly more complicated, and outside of my realm of expertise. Have you looked at this? askubuntu.com/a/119458/647604
    – brndn2k
    Mar 1, 2017 at 21:55
  • Calling fdisk is probably what needs to be scripted... Mar 1, 2017 at 22:05
  • That'll be a whole 'nother can of worms. Good luck!
    – brndn2k
    Mar 1, 2017 at 22:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .