How can a backup snapshot be taken when server is running?

This is just a curiosity of mine that I have been thinking more about lately…

How can Linode take a snapshot of the server while the server is running? Let's say, for example, that I have a web application that processes user requests, stores data in a database, and has a high amount of traffic.

When I begin to take a backup snapshot, the server is in a certain state. It may begin to copy data on disc starting at the beginning of the disk, and copying sequentially to the backup snapshot location. However, as the snapshot is being taken, the data on disk is constantly changing as user requests are coming in many times per second and the data in the database is changing. So by the time the snapshot is "complete," the state of the server has changed completely.

So exactly which state is backed up? It seems as if, logically, it can't be the state at the beginning or the end, so it must be some state in the middle.

But what if a user request modifies data in two different locations on disk, one that has already been copied over to the snapshot and one that has yet to be copied? The result is that the backup snapshot would contain the "old" data at the first location, but the "newer" data in the second location. The result is that the database or disk state is now inconsistent! This could potentially completely break the integrity of the database or web application.

So I guess what I'm asking is it seems that the only way a snapshot could be taken while the server is running is if it is taken instantaneously. But that is clearly not the case. So how can Linode do these backup snapshots while maintaining data integrity?

Thanks for anyone who can shed light on this!

6 Replies

I'm not sure if Linode's backup system works the same way, but I have a general idea of how snapshotting works in VMware. The hypervisor quiesces the VM disk, meaning it very briefly pauses execution on the guest OS. Then it creates a delta file on the datastore and resumes execution of the guest OS where any changes to disk are written to this delta file. This is where the backup comes in. The backup is then free to read the now read-only disk file without fear of it changing from the existing state. Once the backup process completes, the hypervisor then commits the changes in the delta file to the disk, once again pauses the execution to commit the last few changes, and finally deletes the delta file and resumes execution again.

I believe Linode's backups are file-based and not block-based, so I'm not sure how this would change the backup process. It might work completely differently from how I described above, but that at least gives you some idea of how it can be done.

I don't work for Linode, so this is just how I do it and think they might do it. You seemed to be interested in a general opinion of how it could be done in addition to how exactly Linode does it.

So, a common way to host Xen virtual machines is with LVM rather than disk files such as what you'd see with VMWare's datastore. LVM is the logical volume manager and it allows you to provision disk devices from pools. You create a partition on your hard disk and assign it to LVM, and then you make other volumes from that space using LVM commands.

LVM supports snapshots, which are exactly what it says on the tin. You run lvcreate a certain way and the kernel figures out all the magic to give you a separate device file that is the snapshot you took at the point you typed the command. At that point, Linode can mount that disk volume and do their own file-based magic to give you the backup slots. I'd suspect they use simple scripts and rsnapshot, but I really have no clue. Meanwhile, the regular VM will keep writing to the original LVM volume and the snapshot volume can be deleted once the backup is done.

So you're saying they're "not" using quantum entanglement?

Well, they are and they aren't.


Well, they are and they aren't.
But you can't tell until the backup actually occurs. Then, that cat in the box will tell you.



Well, they are and they aren't.
But you can't tell until the backup actually occurs. Then, that cat in the box will tell you.
Silence can speak volumes.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct