Bcachefs: Difference between revisions

From NixOS Wiki
imported>Onny
Add encryption example
imported>Onny
Add note on snapshots
Line 24: Line 24:
# bcachefs unlock /dev/sda
# bcachefs unlock /dev/sda
# mount -t bcachefs /dev/sda /mnt
# mount -t bcachefs /dev/sda /mnt
</syntaxhighlight>
Create a subvolume of a mounted bcachefs filesystem. The snapshot of the filesystem state is accessible in the directory <code>/mnt/snap1</code>.
<syntaxhighlight lang="console">
# bcachefs subvolume snapshot /mnt /mnt/snap1
</syntaxhighlight>
</syntaxhighlight>

Revision as of 09:56, 14 May 2023

Bcachefs is a next-generation CoW filesystem that aims to provide features from Btrfs and ZFS with a cleaner codebase, more stability, greater speed and a GPL-compatible license. It is built upon Bcache and is mainly developed by Kent Overstreet.

Installation

To enable filesystem support and availability of user-space utils, add following line to the system configuration

/etc/nixos/configuration.nix
boot.supportedFilesystems = [ "bcachefs" ];

Usage

Format and mount a signle device

# bcachefs format /dev/sda
# mount -t bcachefs /dev/sda /mnt

Format drive with encryption enabled, unlock and mount it afterwards

# bcachefs format --encrypt /dev/sda
# bcachefs unlock /dev/sda
# mount -t bcachefs /dev/sda /mnt

Create a subvolume of a mounted bcachefs filesystem. The snapshot of the filesystem state is accessible in the directory /mnt/snap1.

# bcachefs subvolume snapshot /mnt /mnt/snap1