stf1337
By:
stf1337

Is it possible to mount a snapshot

March 2, 2017 572 views
Backups

Hi there,

is it possible to mount a snapshot to running system? This would be a perfect way to make an consistent backup! Last time I just created a new droplet of the snapshot. But by doing this it will run all init-scripts and all cron-jobs on this new droplet. This is not perfect.

Can you please tell me how I can do this. Or if this is not possible yet, is it planed to be integrated in the future? :)

Thank you in advance!
Stefan

2 Answers

@stf1337

Currently, mounting a snapshot isn't possible, and the reason for this is because of what the snapshot service does -- it creates a real-time backup of the Droplet in it's current state. This is akin to creating an image of a working system and it's meant to function as a means to restore your Droplet back to a previous state.

Here's the issue. Snapshots don't shut down services. So if you're running a production server with a service, such as MySQL/MariaDB/Percona/etc, and you're performing writes at the time the snapshot is created, you may end up writing incomplete data -- that's a security risk if you happen to restore a snapshot where this is the case.

With that being said, and in reference to the UserVoice post, there's a few issues with allowing users to download and upload images.

1). DigitalOcean doesn't allow changes to the Kernel to made at this time. If a user happens to modify anything that effects the kernel, and then tries to upload it back for restoration, it'll most likely result in an image that won't boot. Troubleshooting that can be a bit of a nightmare situation, and painful if the case happens to be that the user needs that image to work.

2). The alternative scenario would be for DigitalOcean to allow users to specify which directories and files are backed up. Even with this option, there's a few issues. If you're not familiar with the OS you're on and don't know what paths need to be backed up and which don't, you may end up losing a ton of configuration files that would allow you to restore to a working system.

...

So what's the alternative? Create your own method of backup. In select Data Centers, DigitalOcean has Block Storage which is relatively cheap at $0.10c per 1GB and it can scale easily.

You could, for example, deploy a 1GB Droplet with 50GB of Block Storage for $15 a month or a 512MB Droplet with 50GB of Block Storage for $10 a month. You'd then create a tarball of your data and send it to that Droplet at an interval of your choosing.

Using the above method, you're in full control and don't need to rely on mounting anything. When you need data, you pull it down from your backup server, extract and then restore.

I know it adds an extra step and may not be as easy as simply mounting a snapshot (if they worked that way), though it does give you full control whereas snapshots currently do not.

Have another answer? Share your knowledge.