Bcachefs: Difference between revisions

Onny (talk | contribs)
Tips and tricks: Add instruction to build bcachefs enabled installation media
Onny (talk | contribs)
NixOS installation on bcachefs: Cleanup instruction
 
(2 intermediate revisions by the same user not shown)
Line 131: Line 131:
           "${nixos}/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix"
           "${nixos}/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix"
           ({ lib, pkgs, ... }: {
           ({ lib, pkgs, ... }: {
            # Required as a workaround for bug
            # https://github.com/NixOS/nixpkgs/issues/32279
            environment.systemPackages = [ pkgs.keyutils ];
             boot.supportedFilesystems = [ "bcachefs" ];
             boot.supportedFilesystems = [ "bcachefs" ];
           })
           })
Line 142: Line 145:
The following commands will generate the iso-image which will be available in the directory <code>./result/iso</code>
The following commands will generate the iso-image which will be available in the directory <code>./result/iso</code>
<syntaxhighlight lang="console">
<syntaxhighlight lang="console"># nix build .#nixosConfigurations.exampleIso.config.system.build.isoImage
# nix build .#nixosConfigurations.exampleIso.config.system.build.isoImage
</syntaxhighlight>
</syntaxhighlight>


Line 165: Line 167:
<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
# mkfs.fat -F 32 -n boot /dev/sda1
# mkfs.fat -F 32 -n boot /dev/sda1
# nix-shell -p bcachefs-tools
# mkfs.bcachefs -L nixos /dev/sda2
# mkfs.bcachefs -L nixos /dev/sda2
</syntaxhighlight>
</syntaxhighlight>
Line 172: Line 173:


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
# nix-shell -p keyutils --run 'keyctl link @u @s'
# keyctl link @u @s
# nix-shell -p bcachefs-tools
# bcachefs format --label=nixos --encrypted /dev/sda2
# bcachefs format --encrypted /dev/sda2
# bcachefs unlock /dev/sda2
# bcachefs unlock /dev/sda2
</syntaxhighlight>
</syntaxhighlight>


Mount filesystems
Mount filesystems. Use <code>lsblk -o +uuid,fsType | grep bcachefs</code> to get bcachefs partition uuid.
 
There are two ways to mount a bcachefs filesystem. First, by device:


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
# mount /dev/sda2 /mnt
# mount /dev/disk/by-uuid/<...> /mnt
# mkdir /mnt/boot
# mkdir /mnt/boot
# mount /dev/disk/by-label/boot /mnt/boot
# mount /dev/disk/by-label/boot /mnt/boot
</syntaxhighlight>
</syntaxhighlight>
For better reliability as with any other filesystem, one should mount the filesystem by UUID, by replacing any drive specifiers with it.
When you formatted, there was an external UUID shown, but if you lost it, you can retrieve it using
<syntaxhighlight lang="console">
# lsblk -o +uuid,fsType | grep bcachefs
</syntaxhighlight>
And using it like <code>UUID=<UUID></code> in place of <code>/dev/sda1:/dev/sdb1</code> or even just <code>/dev/sda</code>.


Continue installation as recommended by the [https://nixos.org/manual/nixos/stable/index.html#ch-installation NixOS manual].
Continue installation as recommended by the [https://nixos.org/manual/nixos/stable/index.html#ch-installation NixOS manual].