Tech Tip: ZFS Snapshots
This week Mitch is telling us all about ZFS Snapshots in under 5 minutes!
Did you know ZFS Snapshots can be mounted read-only to allow for the recovery of files or to roll-back an entire file system to the last time a snapshot was created? If you want to know more about ZFS Snapshots such as what they are, why they are useful and even some of their limitations – check out these weeks 45Drives tech tip below!
Each Tuesday, we release a quick tech tip video on various data storage topics and questions from our users, followers, and fans! Tune in next Tuesday at 3pm!
Hey everyone, Mitch here and welcome back to our weekly tech tip series. This week we’re going to be talking about ZFS Snapshots – what they are, why they’re useful, and maybe even some of their limitations.
A ZFS snapshot is a copy of a data set or a volume that takes up nearly zero space and can be created almost instantly due to ZFS’s copy-on-write (CoW) architecture. Unlike other traditional filesystems, when data is modified in ZFS, the data is written to a new block rather than overwriting the old data in its place. Once that write completes the metadata is updated to point to a new location.
A ZFS snapshot will continue to grow in size as data is added to the live filesystem. It’s for this reason you may want to continuously add new snapshots and delete old ones as time goes by, though this is dependent on your use case. You will usually want to use snapshots on a specific schedule that works for your use case. Otherwise, you may end up with some extremely large snapshots.
One useful feature of ZFS snapshots is the ability to mount them as read-only to pull out certain files or rollback an entire filesystem to the last time a snapshot was created. ZFS snapshots can greatly help system admins with accident-prone users who may misplace or accidentally delete important files.
Although ZFS snapshots serve their purpose well they in no way replace an adequate backup solution. The name of the game in today’s fast-paced business environment is availability. Companies need to be able to recover from lost data with minimal or no downtime. This is why snapshots can be a godsend, but in case of a large scale disaster or damage of the source data, the snapshot may become lost. That’s why a snapshot is not a replacement for a good backup strategy.
I know I said it before but I want to reiterate snapshots are not adequate backup.
Mission-critical data should always be backed up to a separate location. We recommend the 3-2-1 rule which is a common industry approach to backing up data that protects in most failure scenarios. The rule states there should always be three copies of your data, two copies stored on local storage mediums and one located offsite.
A cool consequence of ZFS’s copy-on-write system is that, in the event of a power failure or system crash occurs while new data was being written onto the disk – you may end up losing the ongoing write that was happening, but your files last valid stat will still be completely untouched and corruption-free. If this happened in a traditional filesystem you may end up with a corrupt file or something that’s half-written. As mentioned before this happens because ZFS writes to a new block instead of overwriting old files.
To find out more check out our knowledge base article about ZFS snapshots.