Monday, 27 January 2020

Google Cloud - VM add new disk and fstab update

To add New disk on the existing VM > Console > Compute Engine > VM instances >
before adding check the label name in VM
sudo su -
lsblk





You will get fast ssd and slow disk

We get option to take snapshot of the disk


We have encryption options.

Save >


 Login to ssh > We have sdb with 10g



Format the disk
sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/[DEVICE_ID]

mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/sdb




 Mount the disk
 mkdir -p /disk01
 mount -o discard,defaults /dev/sdb /disk01/
 df -h



Update /etc/fstab to make sure after restart the disk will mount automatically

cp /etc/fstab /etc/fstab_bk
echo UUID=`sudo blkid -s UUID -o value /dev/sdb` /disk01/ ext4 discard,defaults,nofail 0 2 | sudo tee -a /etc/fstab


No comments: