Btrfs: Difference between revisions
m →Tips and tricks: Link to Btrbk |
m Polish text in →Top-level vs nested subvolumes |
||
(3 intermediate revisions by 3 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 | * 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 | * 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 326: | Line 325: | ||
== Convert Ext3/Ext4 system partition to Btrfs == | == Convert Ext3/Ext4 system partition to Btrfs == | ||
{{Warning|Note that migrating your existing root filesystem can cause data loss or make your system unbootable. Make sure to backup the partition or your files. Proceed only if you know what you're doing!}} | |||
To convert the existing filesystem (Ext3/4) to Btrfs, boot into a NixOS live system and run the following commandː<syntaxhighlight lang="sh"> | To convert the existing filesystem (Ext3/4) to Btrfs, boot into a NixOS live system and run the following commandː<syntaxhighlight lang="sh"> | ||
Line 352: | 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]] |