Append-only

Append-only is a property of computer data storage such that new data can be appended to the storage, but where existing data is immutable.

Access control
Many file systems' Access Control Lists implement an "append-only" permission:


 * chattr in Linux can be used to set the append-only flag to files and directories. This corresponds to the O_APPEND flag in open.
 * NTFS ACL has a control for "Create Folders / Append Data", but it does not seem to keep data immutable.

Many cloud storage providers provide the ability to limit access as append-only. This feature is especially important to mitigate the risk of data loss for backup policies in the event that the computer being backed-up becomes infected with ransomware capable of deleting or encrypting the computer's backups.

Data structures
Many data structures and databases implement immutable objects, effectively making their data structures append-only. Implementing an append-only data structure has many benefits, such as ensuring data consistency, improving performance, and permitting rollbacks.

The prototypical append-only data structure is the log file. Log-structured data structures found in Log-structured file systems and databases work in a similar way: every change (transaction) that happens to the data is logged by the program, and on retrieval the program must combine the pieces of data found in this log file. Blockchains add cryptography to the logs so that every transaction is verifiable.

Append-only data structures may also be mandated by the hardware or software environment:
 * All objects are immutable in purely functional programming languages, where every function is pure and global states do not exist.
 * Flash storage cells can only be written to once before erasing. Erasing on a flash drive works on the level of pages which cover many cells at once, so each page is treated as an append-only set of cells until it fills up.
 * Hard drives that use shingled magnetic recording cannot be written to randomly because writing on a track would clobber a neighboring, usually later, track. As a result, each "zone" on the drive is append-only.

Append-only data structures grow over time, with more and more space dedicated to "stale" data found only in the history and more time wasted on parsing these data. A number of append-only systems implement rewriting (copying garbage collection), so that a new structure is created only containing the current version and optionally a few older ones.