Btrfs: Difference between revisions
(use templates, update link, prefix commands with # or $) |
Prabuanand (talk | contribs) m (fixed category name) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 5: | Line 5: | ||
Installing [https://wikipedia.org/wiki/Btrfs Btrfs] is relatively straight forward. Install the package and tell Alpine to load the module on startup: | Installing [https://wikipedia.org/wiki/Btrfs Btrfs] is relatively straight forward. Install the package and tell Alpine to load the module on startup: | ||
{{Cmd| | {{Cmd|# apk add {{pkg|btrfs-progs}} | ||
# echo btrfs >> /etc/modules</nowiki>}} | <nowiki># echo btrfs >> /etc/modules</nowiki>}} | ||
To load the module | To load the module immediately, you can use the following command: | ||
{{Cmd|# modprobe btrfs}} | {{Cmd|# modprobe btrfs}} | ||
If using btrfs as your root filesystem, you should ensure that the initramfs is generated with the btrfs module, otherwise your system may fail to boot. To do so edit (as root) {{path|/etc/mkinitfs/mkinitfs.conf}} and ensure that "btrfs" is in the list of features; then (again as root) run the {{ic|mkinitfs}} command. | |||
== Mounting a volume == | == Mounting a volume == | ||
Line 28: | Line 30: | ||
do not forget to install additional dependencies. If you enabled on the fly compression you need to install zstd: | do not forget to install additional dependencies. If you enabled on the fly compression you need to install zstd: | ||
{{cmd|# apk add zstd}} | {{cmd|# apk add {{pkg|zstd}}}} | ||
More information about mounting can be found in the official [https://btrfs.readthedocs.io Btrfs wiki] | More information about mounting can be found in the official [https://btrfs.readthedocs.io Btrfs wiki] | ||
Line 66: | Line 68: | ||
* [https://web.archive.org/web/20221127043947/https://nparsons.uk/blog/using-btrfs-on-alpine-linux Using BTRFS on Alpine Linux] | * [https://web.archive.org/web/20221127043947/https://nparsons.uk/blog/using-btrfs-on-alpine-linux Using BTRFS on Alpine Linux] | ||
* [https://gitlab.alpinelinux.org/alpine/aports/-/issues/9539 Can't mount BTRFS volume using fstab] | * [https://gitlab.alpinelinux.org/alpine/aports/-/issues/9539 Can't mount BTRFS volume using fstab] | ||
* [https://wiki.archlinux.org/title/Btrfs ArchWiki] | |||
[[Category: | * [https://wiki.gentoo.org/wiki/Btrfs Gentoo Wiki] | ||
* [[Install Alpine on a btrfs filesystem with refind as boot manager]] | |||
[[Category:Filesystems]] |
Revision as of 03:57, 13 September 2024
Documentation how to use Btrfs on Alpine Linux.
Install
Installing Btrfs is relatively straight forward. Install the package and tell Alpine to load the module on startup:
# apk add btrfs-progs # echo btrfs >> /etc/modules
To load the module immediately, you can use the following command:
# modprobe btrfs
If using btrfs as your root filesystem, you should ensure that the initramfs is generated with the btrfs module, otherwise your system may fail to boot. To do so edit (as root) /etc/mkinitfs/mkinitfs.conf and ensure that "btrfs" is in the list of features; then (again as root) run the mkinitfs
command.
Mounting a volume
To mount a volume on boot, add a new entry to your fstab:
Contents of /etc/fstab
If you use more specific mounting options like for example:
Contents of /etc/fstab
do not forget to install additional dependencies. If you enabled on the fly compression you need to install zstd:
# apk add zstd
More information about mounting can be found in the official Btrfs wiki
Troubleshooting
Mount failed
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:
Contents of /etc/init.d/btrfs-scan
Make the service executable and register it:
# chmod +x /etc/init.d/btrfs-scan # rc-update add btrfs-scan boot
The volume should mount correctly after a reboot.