Documentation how to use Btrfs on Alpine Linux.
Installing Btrfs is relatively straight forward. Install the package and tell Alpine to load the module on startup:
To load the module right away, you can use the following command:
Mounting a volume
To mount a volume on boot, add a new entry to your fstab:
If you use more specific mounting options like for example:
do not forget to install additional dependencies. If you enabled on the fly compression you need to install zstd:
More information about mounting can be found in the official Btrfs wiki
If you try mounting a Btrfs volume via your /etc/fstab and it doesn't show up, it could be because Btrfs does not know about the drives during boot.
To work around this, you can create an OpenRC service that runs a
btrfs scan to detect the drives. To do so, create a new service under /etc/init.d/btrfs-scan with the following content:
Make the service executable and register it:
The volume should mount correctly after a reboot.