![snapshot mac os x snapshot mac os x](https://images.idgesg.net/images/article/2018/06/macos_mojave_mac_app_store_stock-100761859-large.jpg)
Snapshots are typically deleted either on a schedule, or when a volume starts running out of free space. Blocks that are no longer referenced (by the active directory or another snapshot) will be freed up and will be available for new data.
![snapshot mac os x snapshot mac os x](https://macdaddy.io/wp-content/uploads/2012/12/MacBackupGuruIncrementalSnapshotsSpaceSaving.png)
This will decrement the reference count for every disk block (both directory and file) used by the snapshot. This is why you generally don’t want to keep snapshots around forever.
![snapshot mac os x snapshot mac os x](https://eclecticlightdotcom.files.wordpress.com/2021/11/diskutil90.jpg)
And writing to a file, even without changing its size, may cause free space to be consumed if there is a snapshot holding references to its original content. Of course, when snapshots are used, it means deleting a file doesn’t actually create free space on the volume, because the file’s disk blocks are still being used by any snapshots that were created after the file was created. Later on, you can create more snapshots, which will preserve the directory and file data at additional points in time. It is 100% accurate read-only image of the directory and file state for the entire volume at the time the snapshot was created. The read-only tree never changes - it holds references to the disk blocks belonging to the original files as they were at the time the snapshot was created. Its disk blocks (and the files’ disk blocks) are duplicated using copy-on-write as necessary.
![snapshot mac os x snapshot mac os x](https://appletoolbox.com/wp-content/uploads/2013/01/Display-Resolution-540x377.png)
One of them remains writable, while the other is marked read-only.Īfterward, when files are created, deleted and modified, the volume’s writable directory (the active one) is modified as normal. You end up with two directory trees, containing the same files and pointing to the same disk blocks. Instead of performing the above “fast copy” operation on a single file, it is performed on the entire volume’s directory structure. In addition to speeding up file-copy operations, it also saves space on your storage device, because it’s not keeping two copies of data for content that is known to be identical.Ī snapshot is basically an extension of this concept. Later on, if you modify the file, the system allocates new storage for those blocks that have changed, but everything unchanged remains shared with the original. Instead, it creates a new file that uses all of the original file’s disk blocks for storage. This is because it’s not actually copying all the data to a new set of disk blocks. As you may have noticed, duplicating a file in APFS using the Finder completes almost instantly, regardless of it’s size. One of the most obvious is APFS’s ability to perform quick copies of files. These technologies (reference counting and copy-on-write) allow an operating system to do many useful things. When a disk block is shared by multiple files and one tries to write to the block, it is duplicated (and the file’s internal data updated to reflect that it is now using a different block) before the write operation. This is used in conjunction with “ copy-on-write” technology. There is a per-block reference count stored, so that when files are deleted, the block isn’t freed until all of the files using the block have been deleted. The general idea is that, when using a snapshot-capable file system, each disk block can belong to multiple files. Here’s a white paper that, in part, explains their implementation. The earliest example I’m personally familiar with was developed by NetApp for their file server appliances. Various kinds of network servers have been using them for decades. Snapshots are nothing new to the industry.
#SNAPSHOT MAC OS X HOW TO#