====== btrfs (B-Tree file system) ====== * [[https://markmcb.com/2020/01/07/five-years-of-btrfs/|Five years of btrfs]] ===== btrfs RAID ==== * [[https://www.carfax.org.uk/btrfs-usage|Disk Usage Calculator]] ==== RAID-1 ==== mkfs.btrfs -L LABEL -d raid1 -m raid1 /dev/sdd1 /dev/sde1 ==== RAID-0 with existing hard disk ==== - **! MAKE BACKUPS !!!** - ''gdisk /dev/sdx'': one GPT partition over the whole disk - ''mkfs.btrfs /dev/sdx1'' - ''mount /dev/sdx1 /mnt/data'' - ''rsync -a --info=progress2 /mnt/olddata /mnt/data'' - ''gdisk /dev/sdx'': one GPT partition spanning the whole disk - ''btrfs device add /dev/sdx1 /mnt/data'' - ''btrfs balance start -dconvert=raid0 -mconvert=raid1 /mnt/data'' - done. ==== single ==== * [[https://www.reddit.com/r/btrfs/comments/svtv5a/what_happens_in_btrfs_multidrive_single_mode_if/|What happens in btrfs multi-drive single mode if one disk fails?]] ==== write hole ==== A write hole in a RAID[(usually in RAID5, RAID6 or in rare cases even RAID1)] occurs when a file is written while the device is disconnected, e.g. due to a power failure. If the metadata hasn't been written properly, the files may be lost even though the data seems to have been saved. The developers of Btrfs warn that their RAID5/6 code might be more susceptible to that issue and discourage the use of RAID5/6, even though some improvements have been made over the years. This is hard to reproduce[(several people, e.g. [[https://old.reddit.com/r/btrfs/comments/etvu03/provoking_the_write_hole_issue/|u/Rohrschacht (2020)]] on reddit, have been trying to reproduce this with limited success)] and can be partially mitigated by setting the metadata strategy to raid1c3 or higher. ===== resize ===== - **! MAKE BACKUPS !!!** ''gdisk /dev/sdx'': b → //sdx-backup// - note output from ''blkid /dev/sdx1'' - ''btrfs fi res'' - note //devid 1 size// from ''btrfs fi sh --raw /mnt/point'' output - note the //Partition unique GUID// and //Logical sector size// from ''gdisk -l /dev/sdx1'' output - ''gdisk /dev/sdx'': d → n → 1 → 2048 → 2048+size/Logical sector size → 8300 → x → c → PARTUUID → w - ''btrfs check /dev/sdx1'' - mount, ''btrfs scrub start /mnt/point'' (check with ''btrfs scrub status /mnt/point'' ===== maintenance ===== * [[https://github.com/kdave/btrfsmaintenance * [[https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-balance|balance]] (Btrfs manual) * [[https://btrfs.wiki.kernel.org/index.php/Balance_Filters|balance filters]] * [[http://marc.merlins.org/perso/btrfs/post_2014-05-04_Fixing-Btrfs-Filesystem-Full-Problems.html|Fixing Btrfs filesystem full problems]] (2014) ==== Windows ==== There's a driver for Windows called [[https://github.com/maharmstone/btrfs|WinBtrfs]].