Andrea Zonzin
Andrea Zonzin

Reputation: 1144

GCE Resizing Persistent Disks

I have a problem resizing a persistent disks. The disk "z-temp" (10GB) has only one partition (with Ubuntu 16). I follow the google guide here: https://cloud.google.com/compute/docs/disks/add-persistent-disk#resize_partitions and I have a problem with step 3. When I run the command

sudo resize2fs /dev/disk/by-id/google-z-temp

this is the result:

resize2fs 1.42.13 (17-May-2015)
resize2fs: Device or resource busy while trying to open /dev/disk/by-id/google-z-temp
Couldn't find valid filesystem superblock.

What is the problem?

Upvotes: 2

Views: 989

Answers (2)

Vasilis
Vasilis

Reputation: 2832

I had the same problem and it turned out I just had to restart the instance, and then it was resized automatically. This behavior agrees with the documentation if you resized the root disk:

If you create or resize a root persistent disk or create a disk from an image or a snapshot, your virtual machine instance can automatically resize the partition to recognize the additional space after you restart the instance.

Upvotes: 2

Nilo_DS
Nilo_DS

Reputation: 939

I would recommend if you have your OS in that disk, to add another disk for your files instead of a partition. As recommended by Google here.

"Compute Engine handles most disk management tasks for you so that you do not need to deal with partitioning, redundant disk arrays, or subvolume management. You can apply these practices to your persistent disks if you want, but you can save time and get the best performance if you format your persistent disks with a single file system and no partition tables. If you need to separate your data into multiple unique volumes, create additional disks rather than dividing your existing disks into multiple partitions."

But if it is not possible,

Check if

fdisk -l /dev/sda

shows the proper disk size, if it does, run

pvresize

to resize your partition. Finally,

lvextend -r -l +100%FREE /dev/mapper/...

Upvotes: 0

Related Questions