Btrfs is fairly stable and with the latest kernels it is becoming even a better alternative to the most commonly used EXT4 and XFS filesystems.
While not being always better or faster it brings to the table a huge amount of improvements that makes it by far the best filesystems for storage.
XFS itself is moving in the very same direction and will probably have in the near future some of the features Btrfs already has (e.g. copy on write).
No MDADM or partitioning is needed, to create a RAID10 with 4 HDD just type (where /dev/sd[X] is the disk whole disk, not a partition):
$ mkfs.btrfs -m raid10 -d raid10 /dev/sdb /dev/sdc /dev/sdd /dev/sde
To mount the volume at boot edit /etc/fstab accorgingly.
$ blkid /dev/sdb # sdb can be any of the disks part of the RAID xxxxxxxxxxxxxxxxxx $ vi /etc/fstab --- UUID=xxxxxxxxxxxxxxxxxx /mnt/data btrfs noatime,autodefrag 0 1
Mount options noatime and autodefrag are pretty much self explainatory: the first one tells the filesystem to not update the access time when a file is read while autodefrag tells it to keep files from being fragmented.
The utility btrfs can be used to manipulate and check Btrfs volume’s status.
### print general informations on every Btrfs filesystem $ btrfs filesystem show Label: 'raid10' uuid: 30d7b40a-c14d-40e4-ac95-0adc54e8b347 Total devices 4 FS bytes used 1.13TiB devid 1 size 1.82TiB used 581.51GiB path /dev/sdb devid 2 size 1.82TiB used 581.51GiB path /dev/sdc devid 3 size 1.82TiB used 581.51GiB path /dev/sdd devid 4 size 1.82TiB used 581.51GiB path /dev/sde ### change label of a mounted Btrfs filesystem $ btrfs filesystem label raid10 /mnt/data/
In case the BTRFS volume is used to store some virtual machines it is highly advised to disable copy-on-write for the specific directory where they are stored.
To do so use the chattr command, also note that disabling copy-on-write for existing files cannot be done in place.
The correct procedure consists in creating a new folder, chattr +C that folder and then proceed to copy all the file from the old directory to the one with copy-on-write disabled.
$ chattr +C /path/to/directory