Snapshots
- when we create a GCE VM Instance, a virtual disk is attached to it
- The copy of the virtual disk is referred as snapshot
- Lets create one linux vm instance in gcp
- Lets create a snapshot which is backup of the disk
- First snapshot is full backup of the disk, from there on all the snapshots are incremental in nature
- Now lets login into the linux vm and install tomcat and create a snashot
- If you want to take the backup of the disk periodically, we can create scheduled snapshots
- If we delete older snapshots, the data of the older snapshot gets copied into newer snapshot. If we delete the newest snapshot we would have the recent data loss.
- Lets create an instance from the snapshot
- Snapshots are multi-regional by default but we can create snapshots specific to a particular region.
Exercise:
- Create a ubuntu vm in us-central1 region with free tier
- Navigate to the disks and verify the disk used
- Login into the vm and execute the following command
sudo df -h
sudo lsblk
-
Lets try to add one more disk to this vm instance
-
Lets create an empty disk of size 10 GB in Same Zone as VM
-
Lets create one more empty disk of size 10 gb in different zone
-
Navigate to vm instance and edit the vm instance and click on attach existing disk
-
-
Once the settings are saved login into vm and execute
sudo lsblk
- Now using linux commands we can create partititions or create a file system and mount the new disk to some folder
- Now try creating the same for disks created in different zone and different region.