Btrfs: Difference between revisions

DoggoBit (talk | contribs)
Change warning notice
Pigeon (talk | contribs)
 
(2 intermediate revisions by 2 users not shown)
Line 142: Line 142:


== Deduplication ==
== Deduplication ==
 
Files with (partially) equal contents can be deduplicated using [https://github.com/Zygo/bees bees] or [https://github.com/markfasheh/duperemove duperemove]. The [https://btrfs.readthedocs.io/en/latest/Deduplication.html upstream wiki entry] on deduplication provides an overview of available features of these programs.
Files with (partially) equal contents can be deduplicated using [https://github.com/Zygo/bees bees] or [https://github.com/markfasheh/duperemove duperemove].


bees can be configured in <code>configuration.nix</code>:
bees can be configured in <code>configuration.nix</code>:
Line 182: Line 181:
</syntaxhighlight>
</syntaxhighlight>


=== Top level vs nested subvolumes ===
=== Top-level vs nested subvolumes ===


In btrfs, subvolumes can be created either at the top level of the filesystem or within other subvolumes
In btrfs, subvolumes can be created either at the top level of the filesystem or within other subvolumes.


* Top level subvolumes are created directly under the filesystem's root. By default, the root volume id is 5. Top level subvolumes are easier to snapshotted, rolled back or destroyed independently. This is good for things such as <code>/home</code> or <code>/nix</code>.
* Top-level subvolumes are created directly under the filesystem's root. By default, the root volume ID is 5. Top-level subvolumes are easier to snapshot, roll back or destroy independently. This is good for things such as <code>/home</code> or <code>/nix</code>.


* Nested subvolumes are created inside an existing subvolume or directory within the filesystem. All nested subvolumes inherit the mount status of their parent unless mounted seperately. This layout is useful for organizing related subvolumes under a common namespace. For example, a top-level subvolume such as <code>/srv/nfs</code> can contain multiple nested subvolumes like <code>/srv/nfs/export1</code> and <code>/srv/nfs/export2</code>.
* Nested subvolumes are created inside an existing subvolume or directory within the filesystem. All nested subvolumes inherit the mount status of their parent unless mounted separately. This layout is useful for organizing related subvolumes under a common namespace. For example, a top-level subvolume such as <code>/srv/nfs</code> can contain multiple nested subvolumes like <code>/srv/nfs/export1</code> and <code>/srv/nfs/export2</code>.




Line 349: Line 348:
btrfs subvolume delete /btrfs/ext2_saved
btrfs subvolume delete /btrfs/ext2_saved
</syntaxhighlight>
</syntaxhighlight>
=== TRIM support ===
{{main|Filesystems#SSD TRIM support}}
Refer to [https://btrfs.readthedocs.io/en/latest/Trim.html btrfs docs] on how Trim works with btrfs through the <code>discard</code> mount option.
[[Category: Configuration]]
[[Category: Configuration]]
[[Category:Filesystem]]
[[Category:Filesystem]]