Site Tools


start:isbtrfsok

This is an old revision of the document!


BTRFS is working well at the moment on a single disk, or with RAID6 (metadata Raid1C3) (2 disks can fail) in a NAS environment with more than 4 disks (ie 5+ disks). For 2 or 3 disks RAID1 is preferred which also works well (data is duplicated so it can still self heal and 1 disk can fail). Note: For RAID 6 to avoid loss of data/corruption on a power failure/kernel hang you must raid the metadata differently then it is safe. eg imagine 6 disks the command to create the array is:

mkfs.btrfs -L myraidlabel -m raid1c3 -d raid6 -f <device1> <device2> <device3> <device4> <device5> <device6>

This command destroys whats on the disks (-f was used = force creation).

Advantage of this is metadata is normally small while raid 6 gives the space benefits for the data written. Also very safe and sanctioned by the btrfs team.

A weekly scrub and balance is suggested in a RAID environment so that self healing and filesystem maintenance is performed. For a single disk just a monthly scrub is fine and you can run it manually or schedule one with cron if you prefer. If there are any corrupt files, it cant self heal anyway so you would be restoring from backup, and balancing on a single disk generally happens automatically to a degree so I normally dont worry about it.

For single disks in a home PC I use the following mount options in FStab: defaults,compress=lzo,autodefrag,discard=async,space_cache=v2

So for example a disk would be mounted as such in the fstab: UUID=383732b1-5e87-4b68-a15a-f044bc559877 / btrfs defaults,compress=lzo,autodefrag,discard=async,space_cache=v2,subvol=@ 0 0

This keeps things nice and tidy and automatically handles trim, and balance. As mentioned there is no self healing on a single disk so you can run a scrub to check for errors every now and again but a backup is needed to restore files.

Overall BTRFS is production ready now since Linux Kernel 6 onwards.

start/isbtrfsok.1666559819.txt.gz · Last modified: 2022/10/23 21:16 by peter