In these pages, Snapshot refers to either general hardware products which can take an 'instantaneous' copy of a disk, filesystem or file or a copy of source data. 'Source' is the original data. 'T0' or time zero refers to the time that a snapshot is taken, and then exists as an independent entity. The snapshot could be fixed at that point, or could be updated independently of the source data. Why would you need a snapshot? Some reasons are -
- Snapshot is extensively used for backup and recovery. Its difficult to find time to take a clean backup of hundreds of gigabytes of data. Snapshot lets you take an almost instantaneous copy to disk, which you may then want to move off to secondary storage without affecting the production copy. Many Open Systems products, like NetBackup and TSM use snapshots. VMware and NAS systems also use it to get copies of data. The section on FDRinstant describes one way of doing this is a mainframe environment.
- For testing. We need to test new software releases or configuration changes rigorously, and to do that, we need a close copy of the production environment. Snapshot allows you to create a copy easily, without affecting production.
- For business purposes. Say you need to produce a year-end shareholder report, which must run against a consistent set of data, This could take a few hours, and you can't afford to hold production work for that long. Run the reports against a snapshot of the data.
What is snapshot?
When storage subsystems started to use virtualisation, then they were able to take 'instant' snapshot copies of disks, or even files. Exactly how this works depends on the way the virtualisation is implemented.
A data file (or a NAS share or a Container) is split into blocks, which can be scattered over several physical disks, and the disk subsystem maintains an index of pointers to each block. When you make a snapshot copy of a file, the subsystem simply creates another pointer index, which points to the same file blocks. At this stage, which ever way you read the data, you might use uses different pointers but you get to the same underlying data blocks. The file blocks themselves are not copied so this is a very fast operation.
Initially, the original index and the copied index will be pointing to the same file blocks. What happens next depends on the way the virtualisation
is implemented. Some different implementations are :
- Copy on Write (CoW): A new block of source data is written to the disk cache and the IO is marked as complete to the application. The original data block is read into cache then copied out to a new location and the snapshot pointer is updated to point to that new location. The new block is now copied from cache to the original disk position. Any application that wants to read the source data still uses the old pointers, but if an application wants to use the snapshot data, it will use the new pointer for that block.
- Redirect on Write (Row): A new block of source data is written to cache, then to a new position on disk. The source pointer to that block is updated to point to the new location and the snapshot pointer continues to point to the old location. Subsesquent source reads come from the new location. RoW is more efficient that CoW for source operations.
Log Structured File is an implementation of RoW, but in this case, ALL updates are written out to new locations.
- Split mirror: Not very common these days, the idea is that you mirror two disks, and then once the mirror operation is complete, you split the mirror off, so you have a second copy of the data. The 'T0' is the time that the mirror is split off, not the time that mirroring commences, so obviously you needed to plan ahead to use this method.
- Continuous Data Protection (CDP): Normally, if you want to recover data form a snapshot, you recover back to the TO time and any updates made since that time are lost. CDP is a combination of snapshots and logs. If every update block, or a pointer to every updated block is recorded in a log file, then it is possible to restore from a snapshot then use the data in that logfile to recover a disk to any point in time. This requires space to keep the log data and software to process it.
Many variants of instant copy and snapshots exist, ranging from Windows ShadowImage and VMware snapshot to snapshot embedded in storage hardware. Selected hardware snapshot products include -