Linux Format

Have a CoW, man

-

Even if you have no redundancy in your next-gen filesystem, it will be significan­tly more robust than its forbears. This is thanks to a technique called Copy-on-Write (CoW): a new version of a file, instead of overwritin­g the old one in-place, is written to a different location on the disk. When, and only when, that is done, the file’s metadata is updated to point to the new location, freeing the previously occupied space. This means that if the system crashes or power fails during the write process, instead of a corrupted file, you at least still have a good copy of the old one Besides increased reliabilit­y, CoW allows for a filesystem (or more precisely a subvolume) to be easily snapshotte­d. Snapshots are a feature, or even the feature, that characteri­ses our nextgenera­tion filesystem­s. A snapshot behaves like a byte-for-byte copy of a subvolume at a given time (for now think of a subvolume as a glorified directory – the proper definition is different for btrfs and ZFS), but when it is initially taken, it takes up virtually no space. In the beginning, the snapshot just refers to the original subvolume. As data on the original subvolume changes, we need to preserve it in our snapshot, but thanks to CoW, the original data is still lying around; the snapshot is just referred to the old data, so the filesystem will not mark those blocks as unused, and old and new can live side by side. This makes it feasible to keep daily snapshots of your whole filesystem, assuming most of its contents don’t change too drasticall­y. It is even possible to replicate snapshots to remote pools via SSH.

Newspapers in English

Newspapers from Australia