0

in the case of scheduled shapshots on a persistent ssd disk mounted on a VM, I read in the doc that the backup must not be set here /etc/fstab to ensure that the disk mounts on its own when the VM is restarted. https://cloud.google.com/compute/docs/disks/add-persistent-disk?hl=it

I need scheduled snapshots. So in my case the disk does not mount itself on reboot of the VM. I have to reassemble it. So the question is: if i restart the machine for other reasons, when i reassemble the disk i lost all the data? Do I then have to mount the disk and restore the data from the shapshots every time I restart the VM?

Thanks in advance

Enrico
  • 1
  • 1
    The disk type is called "persistent" because it keeps your data when a VM is restarted or terminated. If you restart the VM, you will not lose data on a persistent disk. – mebius99 Mar 23 '20 at 17:14

1 Answers1

0

Backups should protect against every data loss scenario anticipated by your business continuity plan. Backups should be offline (not mounted) to prevent them from being altered. Consider the possibility of disks or databases being corrupt, so snapshots are no good.

Ideally, snapshots are just one part of the business continuity for your data. For example, perhaps export databases and store those data to a cold storage bucket. But snapshots are the topic this time.


GCP snapshots are point in time differences that exist independently of the instance doing anything. They are deleted when they expire from a schedule, or manually via the API. Restoring a snapshot means creating a new persistent disk (or a new instance). So this is not something you usually do on every reboot. It is a one time thing to replace a disk with a restored one.

If you want the option to undo a snapshot restore, take a new snapshot prior to doing the restore.


You linked the add persistent disk document. Although related, its primary use case is creation of new disks, not snapshot restores. If you follow that advice and mount Linux disks by UUID or label, you will not need to alter /etc/fstab as part of a snapshot restore.

John Mahowald
  • 30,009
  • 1
  • 17
  • 32
  • Thanks for the reply, but I don't understand what you mean or maybe I didn't explain myself well. The question is much simpler. I hooked a disk to a VM. Restart the VM (for any reason). I have to remount the disk otherwise it is not available (unmounted) after the restart. So I remount the disk with the following command: sudo mount -o discard, defaults /dev/[DEVICE_ID] /mnt/disks/[MNT_DIR] Does the fact that I have to remount the disk also mean that I have lost all the data inside? Thanks – Enrico Mar 21 '20 at 14:13