Google Cloud Platform for Architects
上QQ阅读APP看书,第一时间看更新

Resizing a persistent disk

Resizing the disk does not configure the filesystem to use additional space automatically. We have to do it ourselves. If our persistent disk has both a filesystem and partition table, we must edit both:

  1. We can use the gcloud command-line tool for this purpose.
      gcloud compute disk resize [DISK NAME] —size [DISK_SIZE]
  1. Get access of your persistent disk using SSH and determine the partition that you want to modify. You can use lsblk to have a list of your disks and partitions. If your picked partition has a partition table, then we must grow the partition before resizing it:
sudo growpart /dev/sda [PARTITION NUMBER]  
  1. Now, extend the filesystem and provide a disk name or partition name:
sudo resize2fs /dev/sda/[PARTITION_NUMBER] 
  1. You can use the df -h command to verify your resizing.