Table of Contents
Snapshot and Copy on Write
Two type of snapshots, they are using different ways.
Keep original data
No write to original data, all new data will be in delta file.
VMware
All new data will be in delta file, the original disk file will not be changed. This is very usefull especially in VDI environment, all VDI servers will base on same images and no impact to original disk file.
When deleting a snapshot, the snapshot files are consolidated and written to the parent snapshot disk. If parent is base disk, and all the data from the delta disk will be merged with the virtual machine base disk.
QEMU / KVM: COW mode
COW mode is available on some formats of virtual machine disk as QCOW2. When using the COW mode, no changes are applied to the disk image. All changes are recorded in a separate file preserving the original image. Several COW files can point to the same image to test several configurations simultaneously without jeopardizing the basic system.
QEMU / KVM allows to incorporate changes from a COW file to the original image
Overwrite original disk
Write latest data into original disk, and the original data move to delta disk.
RedHat LVM snapshot
The data in snapshot volume is original data.
ZFS and btrfs
Due to native copy-on-write feature, file usage reference structure always points to new data, and the old data is saved in old reference structure.
Compare
Original Disk | Pros | Cons |
---|---|---|
Keep | * Support multiple childs without too much performance overhead | Deleting snapshot takes time When disk full, no more write can be done |
Overwrite | Less overhead - only when first time writing data on new location Reverting snapshot takes time |
* Deleting snapshot fast |
Native COW | No overhead Fast dropping snapshot Fast reverting snapshot No impact to service when snapshot full, but snapshot corrupt |
Unable to delete file when disk full Disk fragmented easily * Unable to cache disk write operation |
References
Deleting Snapshots
QEMU / KVM: Using the Copy-On-Write mode
Why would I want to disable Copy-On-Write while creating QEMU Images?