I have a:

  • cloud instance
  • remote server
  • Virtual Machine
  • ...

of Ubuntu to which I don't have physical access and I need to resize mounted partitions like / that I cannot dismount!

All the tutorials / answers I can find on-line are telling me to boot a USB or a DVD or ... but I can't because I don't have physical access to Ubuntu!

What should I do??? Help!

  • /boot can be unmounted on a running system. In fact, in olden days it used to be common practice to not mount it at all, since it only needs to be accessed by the bootloader (and kernels were updated much less frequently). – fkraiem Jul 24 at 7:43
  • @fkraiem Question updated. I wasn't aware of that! Thanks! – Fabby Jul 24 at 7:46
  • An alternative that you could/should think about is, add additional virtual disks instead of resizing root. I'll assume that you're running out of space. So why not add a new vdisk for either a) /root b) /home/ c) /var/lib/mysql d) /var/lib/automysqlbackup e) /var/www and then move your files accordingly. And you could do it without rebooting. – Bazz Jul 24 at 11:31
  • @Bazz Feel free to post an additional answer! :-:) – Fabby Jul 24 at 13:09

Warning: The following does not work if you have ssh access to your server only! You need some kind of an Out of Band console session into your server like a cpanel console, vCenter, iLO, IDRAC, ...

Warning in plain English: You need to be able to see grub when you boot into Ubuntu.

The steps:

  • Take a full snapshot / system backup / ... of your instance that can be restored through a boot process like PXE, an off-line bootable USB disk, ...
  • No really: 95% of the time everything goes well, but have a look first on how to back up first before you have to trek up a mountain to service the Ubuntu server that is controlling that telescope!
  • Download the gparted live iso
  • copy the downloaded file in /opt/LiveISOs

        sudo mkdir /opt/LiveISOs
        sudo cp ~/Downloads/gparted-live-1.0.0-3-amd64.iso /opt/LiveISOs
  • edit /etc/grub.d/40_custom to include the following at the end:

        menuentry "GParted Live ISO" {
          set ISOFile="/opt/Live-ISOs/gparted-live-1.0.0-3-amd64.iso"
          loopback loop ($root)$ISOFile
          linuxefi (loop)/live/vmlinuz boot=live components config findiso=$ISOFile ip=frommedia toram=filesystem.squashfs union=overlay username=user
          initrdefi (loop)/live/initrd.img
  • set grub's timeout parameter to anything but 0
  • update grub's config:

        sudo update-grub2
  • Reboot to grub

  • Take menu option GParted Live ISO

    Voilà: a virtual USB key has been inserted in your VM / headless server / ... virtually and you can now shrink / expand partitions off-line using gparted (or using lvm utilities from the command line!)

Note: If using VMWare, you can also attach the ISO to the VM and boot the ISO through vCenter.

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.