0

I am trying to add an extra disk for my compute engine by following the instructions here but I am stuck in growing the partition.

sudo growpart /dev/sda 1
NOCHANGE: partition 1 could only be grown by -33 [fudge=2048]

Any help would be greatly appreciated!

thulungair
  • 1
  • 1
  • 2

3 Answers3

2

I've tried to follow the same documentation Resizing a zonal persistent disk:

  1. 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"
    
  2. 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
    
  3. increase disk space up to 20GB in Console or via gcloud command:

    $ gcloud compute disks resize disk-resize --size 20GB --zone europe-west3-a
    
  4. install growpart:

    $ sudo apt -y install cloud-guest-utils 
    
  5. grow the partition:

    $ sudo growpart /dev/sda 1
    CHANGED: partition=1 start=227328 old: size=20744159 end=20971487 new: size=41715679,end=41943007
    
  6. 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.
    
  7. 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.

Serhii Rohoza
  • 1,424
  • 2
  • 5
  • 15
0

can you try these steps

  1. check your fs by running df -H
/dev/sda1       10G    8G    2G  80% /
/dev/sdb        10G    8G    2G  80% /data

let say, you want to extend /data which is /dev/sdb

  1. extend fs by running sudo resize2fs /dev/sdb

  2. verify by running df -H

Alongkorn
  • 101
  • 2
0

I was getting the same error on Vultr Cloud hosting provider, My use case was to increase the size of an external storage mounted on the instance. I was able to resolve it by following steps

  1. sudo apt-get install cloud-utils
  2. Unmount the external disk
  3. Increase the size of the external Disk
  4. Detach the external disk from cloud dashboard
  5. Reattach the external disk
  6. lsblk
  7. sudo growpart /dev/vdc 1