canonical / multipass

Multipass orchestrates virtual Ubuntu instances
https://multipass.run
GNU General Public License v3.0
7.63k stars 635 forks source link

When increasing the size of a full disk, the root partition does not resize accordingly #3389

Open andrei-toterman opened 6 months ago

andrei-toterman commented 6 months ago

Describe the bug Normally, when you increase the disk size of an instance (mp set local.instance.disk=...), the root partition gets resized by cloud-init to use the newly available space on the disk. But when the disk is already used at full capacity, increasing the disk size will not automatically increase the root partition size.

To Reproduce

  1. multipass exec instance -- dd if=/dev/zero of=big_file bs=1M count=10000 # or more if needed to fill the disk
  2. multipass stop instance
  3. multipass set local.instance.disk=20GB # or more than the current size
  4. multipass exec instance lsblk
    sda       8:0    0    20G  0 disk 
    ├─sda1    8:1    0   4.9G  0 part /

Expected behavior Have /dev/sda1 expand to take up the available space in /dev/sda.

akauppi commented 6 months ago

Experienced this some while back. It's nice this is now reported.

If anyone needs to manually be able to expand that disk, this may help (my notes):

Troubleshoot - if you resize disk, but Ubuntu doesn’t see it that way.

$ sudo fdisk -l /dev/sda

Within Ubuntu, to see the disk image size

$ sudo parted -l

# On host: $ multipass restart {name}