Google Cloud Compute ubuntu growpart command says "could only be grown by -33 [fudge=2048]"
Solution 1:
I've tried to follow the same documentation Resizing a zonal persistent disk:
-
create test VM instance with Ubuntu 18.04 LTS with 10GB disk:
$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=18.04 DISTRIB_CODENAME=bionic DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
-
check available disk space first:
$ df -h Filesystem Size Used Avail Use% Mounted on udev 1.8G 0 1.8G 0% /dev tmpfs 369M 884K 369M 1% /run /dev/sda1 9.6G 1.2G 8.4G 13% / tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sda15 105M 3.6M 101M 4% /boot/efi /dev/loop0 92M 92M 0 100% /snap/core/8689 /dev/loop1 93M 93M 0 100% /snap/google-cloud-sdk/122 tmpfs 369M 0 369M 0% /run/user/1001
-
increase disk space up to 20GB in Console or via gcloud command:
$ gcloud compute disks resize disk-resize --size 20GB --zone europe-west3-a
-
install
growpart
:$ sudo apt -y install cloud-guest-utils
-
grow the partition:
$ sudo growpart /dev/sda 1 CHANGED: partition=1 start=227328 old: size=20744159 end=20971487 new: size=41715679,end=41943007
-
extend the file system (ext4) on the disk to use the added space:
$ sudo resize2fs /dev/sda1 resize2fs 1.44.1 (24-Mar-2018) Filesystem at /dev/sda1 is mounted on /; on-line resizing required old_desc_blocks = 2, new_desc_blocks = 3 The filesystem on /dev/sda1 is now 5214459 (4k) blocks long.
-
check available disk space:
$ df -h Filesystem Size Used Avail Use% Mounted on udev 1.8G 0 1.8G 0% /dev tmpfs 369M 892K 369M 1% /run /dev/sda1 20G 1.4G 18G 7% / tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sda15 105M 3.6M 101M 4% /boot/efi /dev/loop0 92M 92M 0 100% /snap/core/8689 /dev/loop1 93M 93M 0 100% /snap/google-cloud-sdk/122 tmpfs 369M 0 369M 0% /run/user/1001
Let's compare:
-
before:
/dev/sda1 9.6G 1.2G 8.4G 13% /
-
after:
/dev/sda1 20G 1.4G 18G 7% /
To solve your issue:
- compare your steps to mine
- check if you have required permissions
- check if you resized disk of VM on step 3 via Console before step 5
- check new size of your disk it shouldn't be more than 2TB accordingly to documentation:
Note: Boot disks use MBR partitions, which are limited to 2 TB in size. Do not resize boot disks beyond 2 TB.
In addition, have a look at this example.