Google Cloud: Add more disk space

The root disk of this web site is running out of space. I completed the steps below to add 10Gb as 2nd disk for storing data.

Create disk

  • Click the VM instances I want to add disk space
  • Click "Edit"
  • Click "+ Add item" under "Additional disks"
  • Select "Create disk" in the drop down menu
  • Set the name of the disk
  • Select "Source type" as "Nonde (blank disk)" and Size (BG) = 10

Mount disk

  • ssh login to the VM instance
  • sudo mkdir -p /mnt/disks/[MNT_DIR]
  • Find the disk just created
    • ls /dev/disk/by-id/
  • Format the disk
    • sudo mkfs.ext4 -F /dev/disk/by-id/google-[DISK]
  • Mount the disk
    • sudo mount -o discard,defaults /dev/disk/by-id/google-[DISK] /mnt/disks/[MNT_DIR]
  • Find the UUID of the disk
    • sudo blkid -s UUID -o value /dev/disk/by-id/google-[DISK]
  • Add this link in /etc/fstab
    • UUID=[DISK_UUID] /mnt/disk/[MNT_DIR] ext4 defaults 0 0

Reference

  • https://cloud.google.com/compute/docs/disks/add-persistent-disk

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer