This article is sponsored by Thecus.
Backup is an essential part of your data storage plan and today’s NASes provide many ways to do it. You can back up to an external removable drive, an iSCSI volume, another NAS on the network and to cloud services. Thecus NASes do all this plus a method that isn’t as commonly supported by other products.
Storage snapshots are an exact image of storage at a specific point in time. Because they are stored at the same physical location as the original data, snapshots are quicker to make and quicker to restore than conventional backups because they don’t require data to be copied. Snapshots are not stored as physical copies of blocks, but as pointers to the blocks that existed when the snapshot was created.
Snapshots are best used when you need to roll back to an exact point in time, as you might when developing applications or debugging or performing Q/A on databases.
Because of the tight physical relationship between data and pointers, snapshots are stored on the same physical storage as the original data. But since they are stored on the same device, they aren’t a substitute for backup to another device. If a snapshotted volume is corrupted or lost, so are its snapshots and any chance of recovery.
Snapshots are generally available with copy-on-write filesystems such as btrfs. With copy-on-write, on the first change to a storage block after a snapshot is taken, the array copies the before-change block to a new location on disk. This keeps the before-change block for the snapshot and the new block for the active version of the database.
In the diagram below, block C is updated, so the old block is copied to a new location, then the new block (C) is written to the original location. When you recall Snapshot #1, all that happens is that the pointer for the C block moves from C back to C. So snapshot restore is very quick!
Copy-on-Write Storage Snapshot (Courtesy Oracle.com)
So enough theory, let’s see how easy snapshots are to do! We’ll use a Thecus N5810PRO for the example. The N5810PRO is a 5-bay NAS built on a 2.0 GHz Intel J1900 Quad Core Celeron processor with 4 GB of DDR3 RAM and built-in battery-backed mini-UPS. It supports multiple volumes, each of which can be separately encrypted and built with EXT3, EXT4, XFS or Btrfs filesystems.
The first thing we need to do is create a volume using btrfs. This is done during the RAID Volume Creation wizard shown below. The volume can be any supported type including individual drive or multi-drive JBOD or RAID 0, 1, 5, 6, 10.
Selecting btrfs during volume creation
After the volume was built, we created a folder named test. Note when a snapshottable folder is selected, the Snapshot icon becomes active.
Snapshot icon active
We then copied four folders to test and took Snapshot #1.
Four folders copied
We then opened the homeplug_av2 folder…
homeplug_av2 folder contents
…and deleted all but one document and took Snapshot #2.
Files deleted
Next, we created a new document in homeplug_av2 and saved it.
New document
Then we took Snapshot #3
New document saved
We then opened the document, edited it and saved it.
New document edited
Then we created Snapshot #4, to complete the list shown below. Restoring a Snapshot is as easy as selecting it and clicking the Restore button.
Four snapshots
It was fun going back and forth, restoring each Snapshot and verifying that everything was back the way it was when the Snapshot was taken. Restores were quick, about 10 seconds each. Of course Snapshot restores of larger filesystems would take longer. But not as long as restoring files from backup!
Check out Thecus’ Snapshot How To Guide for more details.