What is a snapshot and how is it different than a backup?

What does a snapshot do?

In short snapshots are versioning, or the ability to undo a change. If you take a snapshot every hour, for example, then all your files or folders can be reverted back to the state they were at the time of any of your snapshots. So, if you get a virus, then you can just revert your files, folders, or whole volume to the state it was before you got the virus

How is this different than a backup?

A backup is a complete copy of your data. So, if you have 5TB of data each copy will take up an additional 5TB of space. If you make a backup every 1 hour, then after just 10 hours, your backups would take 50TB of space. For this reason, it is not common to save many versions of your backups and backups are not good for versioning.

Snapshots are great for versioning because they are not backups and they can have many versions without taking up much space. A snapshot only needs to save enough information to undo a change and that makes it take less space than a backup.

How do QNAP’s block-level snapshots work?

When you take a snapshot, the metadata recording where each block of data is stored is copied to the snapshot. This takes very little space and the snapshot is created very quickly. From then on, any time you change a block of data, that block is written to a designated snapshot space. The current metadata is updated to reflect the change as well. This procedure is called “Redirect on write”.

Because your snapshot has the metadata, it can recognize what blocks of data have been added or changed since the creation of the snapshot. If you revert to one of your snapshots, every block of data that was added or changed since the snapshot was taken is removed from where it is saved in the snapshot. Then every block of data is as it was at the time the snapshot was taken. And since your files are made up of blocks of data, every file is now as it was when the snapshot was taken.

This allows you to undo changes to your files, folders, and even volume, or to bring back files you have deleted accidentally.

What is good about the way QNAP does snapshots?

Easy to navigate interface:

Just click on what snapshot you want to load, and then you can revert the whole volume or select a specific file or folder to restore.

You can also easily schedule snapshots or take one manually at any time on the same interface.

Block-level:

Because QNAP does block level snapshots, they are more space efficient than file level snapshots. With file level snapshots, if you make even a small change to a file, you need to save the whole file to the snapshot. But with block level snapshots, you only need to save the blocks within the file that have been changed.

Much better for iSCSI LUNs:

Block level snapshots let you take snapshots of any volumes or LUNs on your NAS including a block level iSCSI LUN. Other snapshots that rely on BTRFS cannot do this because they can only take a snapshot of a volume & a thin LUN managed by the BTRFS file system.

Control snapshot space allocation to keep your NAS functional:

QNAP built their snapshots from the ground up and gave you more control of how space for the snapshots is allocated. You control how much storage to reserve for the snapshots. And other files and applications will have priority over the space that you did not allocate to snapshots.

For other NAS providers that rely on BTRFS, you have less control, and sometimes the snapshots can take up so much space that the NAS is no longer functional as a file server.

When are snapshots small?

When you only add files to the NAS, you don’t need to save blocks of data to the snapshot. The Snapshot just needs to have the metadata recording what blocks have been added to the NAS since the creation of the snapshot.

What makes a snapshot big?

When you delete files, the snapshot needs to be able to restore the files you deleted. To do that, any block of data you delete and overwrite will be saved to the snapshot. Saving blocks of data to the snapshot takes much more space than just saving metadata. So, deleting files makes your snapshot size grow much more than adding file

Conclusion:

Most people delete some files and make some changes to their files, but not enough to make the snapshots get too big. The default for QNAP is to allocate 20% of your storage space for snapshots and this is usually more than enough to have 256 snapshots. You could never get close to this many complete backups without taking up huge amounts of space. That is why snapshots are much better than backups for versioning. But snapshots don’t protect you from drive failure so it is still good to have RAID redundancy and at least one backup of your data to another device.

(Originally posted on April 24, 2018; contents updated by Michael Wang)

Source link

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.