Armen Geo
Armen Geo

Reputation: 1

Decreasing disk size on Google Virtual Machine Web Server

I am using Google Compute Engine VM for a web server. I currently have 3TB as disk space but want to bring it down to 1TB. Can someone tell me where I can do this from? Thanks.

Upvotes: 0

Views: 957

Answers (1)

Sergio NH
Sergio NH

Reputation: 185

As @John Hanley only increasing disk size is supported by Google Cloud:

gcloud compute disks resize resizes a Compute Engine disk(s).

Only increasing disk size is supported. Disks can be resized regardless of whether hey are attached.

I also found an answer in Serverfault that could help you with this topic here. It uses fsarchiver tool in order to manage the boot disk resizing:

If the disk is not a boot disk you can do the following:

  1. add a new disk with the required size and format it.
  2. mount the new disk
  3. cp -r --preserve=all /mnt/disk1/. /mnt/disk2/
  4. edit the /etc/fstab to mount the new disk instead the old one

If you have standard disk and you want to shorten the cp time. You can first create new ssd disk from snapshot and copy it to 2T ssd disk. Then make a snapshot from the 2T disk and create a new 2T standard disk.

If your disk is a boot disk, you can use a tool like fsarchiver:

  1. Create an archive from the boot disk. fsarchiver savefs /mnt/backup/boot_disk.fsa /dev/sda
  2. Restore the archive on the new disk fsarchiver restfs /mnt/backup/boot_disk.fsa id=0,dest=/dev/sdb

Upvotes: 2

Related Questions