diff --git a/ToC.md b/ToC.md index 317cdb5..449119e 100644 --- a/ToC.md +++ b/ToC.md @@ -74,6 +74,7 @@ __NB__: Unless mentioned otherwise, a document corresponding to a parent section * sharing files * syncing files with other devices 15. Advanced fine-tunings + * transparent compression * kernel parameters * initramfs * systemd basics diff --git a/project/mkdocs.yml b/project/mkdocs.yml index 328fe0b..8142428 100644 --- a/project/mkdocs.yml +++ b/project/mkdocs.yml @@ -85,7 +85,8 @@ nav: - Power management: "" - Pairing, syncing, sharing: - Bluetooth: bluetooth.md - - Advanced fine-tunings: "" + - Advanced fine-tunings: + - Transparent compression (zstd): zstd.md - More partitioning: "" - Recommended setups: "" - Giving back to the community: diff --git a/zstd.md b/zstd.md new file mode 100644 index 0000000..16f4a0a --- /dev/null +++ b/zstd.md @@ -0,0 +1,16 @@ +## Enable zstd compression +First enable `zstd` compression on `/` (root) and `/home` by adding the corresponding parameters to `/etc/fstab`: + +``` + / btrfs compress=zstd:1 0 0 + /home btrfs subvol=/@/home,compress=zstd:1 0 0 +``` + +This will apply `zstd` compression to all the files directly under the relevant directories. The files already present under these directories will not be touched, however. To retroactively compress them, use: + +`sudo btrfs filesystem defrag -czstd -rv / /home/` + +## Costs & benefits +Compression is about making your files take less space on your hard drive, but it requires extra computations when reading or writing. In other words it trades (very marginally increased) processor and RAM usage for less hard drive usage. The tradeoff is likely to benefit the most modern machines with solid state drives (_SSD_), which are likely to have less storage capacity than their desktop counterparts, while having comparable computational power. + +It should also be noticed that `zstd`compression can increase the lifespan of SSDs, as it may decrease reads over time. \ No newline at end of file