Search code examples
google-cloud-platformgoogle-compute-enginegoogle-compute-disk

Risk of disk corruption when using a persistent google cloud disk with a preemptible google compute instance?


I'd like to use preemptible google compute instance to save money, and persist data using a persistent disk that is attached to the instance. But I'm concerned about the risk of data corruption as outlined in the detach-disk documentation, because it's unclear to me if the disk will be detached properly when the instance is preempted. Any advice/experiences on this? I didn't find any guidance in the google cloud documentation. I'm wondering if I could add the unmount command, sudo umount /dev/disk/by-id/[disk-name], to the preemptible instance shutdown script, but I haven't tried that yet. I could also set up frequent disk snapshots to minimize the damage of data corruption, if that does happen.


Solution

  • You should have zero concern that there will be disk corruption because a preempt-able Compute Engine is preempted. If it were possible that disk buffers were not properly flushed during a Compute Engine preemption, that fact would be screamed loudly from the documentation and the forum. While I have no information on how the Compute Engine is ultimately shutdown, I do have a rock-solid belief that just before it breathes its last, any persistent disk writes out-standing are committed.