meta data for this page
BTRFS
References
https://www.howtoforge.com/a-beginners-guide-to-btrfs
https://www.howtoforge.com/how-to-convert-an-ext3-ext4-root-file-system-to-btrfs-on-ubuntu-12.10
http://www.oracle.com/technetwork/articles/servers-storage-admin/advanced-btrfs-1734952.html
Create BTRFS filesystem on multiple block devices:
mkfs.btrfs /dev/loop0 /dev/loop1
btrfs filesystem show /dev/loop0 Label: none uuid: e9a456cd-57d7-4355-a20a-77243d66722e Total devices 2 FS bytes used 28.00KiB devid 1 size 200.00MiB used 12.00MiB path /dev/loop0 devid 2 size 200.00MiB used 0.00B path /dev/loop1
As you can see, every block belongs to FS can be used. Also for mount:
mount /dev/loop0 /BTRFS
or
mount /dev/loop1 /BTRFS
Swap support
Current state: Do not create SWAP files on BTRFS!
Swap support was restored with Kernel 4.21
Add/remove block devices
Add new block device (extend size)
btrfs device add /dev/loop2 /BTRFS
Remove device:
btrfs device delete /dev/loop0 /BTRFS
!!! It is possible to remove any device if there is free space to which data can be moved during removal.
Scrub
Start foreground, readonly scrub, print statistics at end:
btrfs scrub start -B -d -r / scrub device /dev/sda3 (id 1) done scrub started at Mon Mar 6 07:02:56 2017 and finished after 00:04:06 total bytes scrubbed: 18.50GiB with 0 errors scrub device /dev/sdc5 (id 2) done scrub started at Mon Mar 6 07:02:56 2017 and finished after 00:06:52 total bytes scrubbed: 18.47GiB with 0 errors
Get currently running scrub status:
btrfs scrub status /
migration to BTRFS
apt-get install btrfs-tools
Issues
Compression type 0x3 not supported
GRUB 2.02 doesn't support ZSTD compression.
Solution is to exlude /boot
from ZSTD compression (below) or install more recent Grub (from Debian Bullseye)
sudo btrfs filesystem defragment -v -r -czlib /boot sudo btrfs property set /boot compression zlib # disable compression for newly created files chattr -Rc /boot
error inheriting props for ino 3336468 (root 264): -28
31 #define ENOSPC 28 /* No space left on device */
# btrfs fi show /mount Label: none uuid: 5db83d5e-4f38-40b0-ac5d-dadd9cd1d23f Total devices 1 FS bytes used 22.18GiB devid 1 size 30.00GiB used 27.58GiB path /dev/mapper/vg_spox-lv_home # btrfs fi usage /mount Overall: Device size: 30.00GiB Device allocated: 27.58GiB Device unallocated: 2.42GiB Device missing: 0.00B Used: 22.52GiB Free (estimated): 5.58GiB (min: 4.37GiB) Data ratio: 1.00 Metadata ratio: 1.99 Global reserve: 512.00MiB (used: 0.00B) Data,single: Size:25.01GiB, Used:21.84GiB /dev/mapper/... 25.01GiB Metadata,single: Size:8.00MiB, Used:0.00B /dev/mapper/... 8.00MiB Metadata,DUP: Size:1.25GiB, Used:348.23MiB /dev/mapper/... 2.50GiB System,single: Size:4.00MiB, Used:0.00B /dev/mapper/... 4.00MiB System,DUP: Size:32.00MiB, Used:16.00KiB /dev/mapper/... 64.00MiB Unallocated: /dev/mapper/... 2.42GiB
https://bbs.archlinux.org/viewtopic.php?id=200817 http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg60637.html