Bcachefs

From MalinWiKi
Revision as of 19:15, 24 December 2019 by Roy (talk | contribs) (→‎Installation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Bcachefs is a spinoff from the bcache project whose idea is to allow for using SSDs or NVMs for caching slower storage as of that of spinning drives. Bcachefs builds on top of bcache, sharing 80% of its code, creating a new copy-on-write filesystem comparible with ZFS and Btrfs, allowing for snapshot, encryption, sending/receiving data, full checksumming of all data and metadata. As of writing (2012-12-24), bcachefs is in early development and requires recompiling a patched kernel on a newer distro version. According to the bcachefs-tools' INSTALL document, the current distros (or later) are recommended

  • Debian Buster
  • Ubuntu 20.04
  • Fedora (bleeding edge)
  • Arch: install bcachefs-tools-git from the AUR

This is a quick run-though for setting up Bcachefs on Debian Buster and lists what you'll need.

Installation

  • Grab the latest debian buster iso (currently alpha) and install it somewhere. Better keep this separate on a VM or a separate machine. You'll need about 40GB in total for the sources and the installed kernel+drivers with debug symbols and all, varying on what's compiled in. YMMV
  • Upgrade to the newest packages and install the stuff needed to compile new kernel.
  • Download the sources for both kernel and userspace
# apt update
# apt dist-upgrade
# apt install -y pkg-config bc bison build-essential flex libaio-dev libblkid-dev \
        libelf-dev libkeyutils-dev liblz4-dev libscrypt-dev libsodium-dev libssl-dev \
        liburcu-dev libzstd-dev ncurses-dev uuid-dev valgrind zlib1g-dev
# mkdir -p /root/src/git
# cd /root/src/git
# git clone https://evilpiepirate.org/git/bcachefs.git
# git clone https://evilpiepirate.org/git/bcachefs-tools.git
# cd bcachefs-tools
# make all install

Userspace tools in place, you now need the kernel. A quick way to start off is to copy an existing kernel config and start out with that. This will save you time walking through the kernel config manually (it's rather big). However, the usual distro kernels normally support almost everything in the known computer universe, so you'll be bound to compile a ton of stuff you'll never end up using. This will eat more disk space, but won't hurt more than that.

# cd /root/src/git/bcachefs
# cp /boot/config-`uname -r` .config

If this is Debian or perhaps Ubuntu (not sure), you'll need to remove some trusted keys in the config

# sed 's/^CONFIG_SYSTEM_TRUSTED_KEYS=.*/CONFIG_SYSTEM_TRUSTED_KEYS=""/' -i .config

Then run 'make menuconfig', choose 'Filesystems' and scroll down to 'bcachefs filesystem support' and press M, then <exit> until it asks if you want to save, and do so. Then, run 'make ; make install modules_install'. This will take a long time. If you have multiple cores, use -j to allow for multiple, parallel jobs. For instance, if you have eight cores, run 'make -j9' to fork out nine jobs - one extra since something is bound to be hanging, waiting for I/O. Keep in mind that multiple jobs also requires more memory, so monitor the system when running this.