This below article is based upon my desktop archlinux system. The below notes are some of btrfs useful commands, that I need from time to time!
# btrfs balance status -v /mnt/data
Balance on '/mnt/data' is running
322 out of about 503 chunks balanced (323 considered), 36% left
Dumping filters: flags 0x7, state 0x1, force is off
DATA (flags 0x0): balancing
METADATA (flags 0x0): balancing
SYSTEM (flags 0x0): balancing
# /sbin/btrfs fi balance start -v /mnt/data
# /sbin/btrfs balance status -v /mnt/data
Balance on ‘/mnt/data’ is running
203 out of about 503 chunks balanced (204 considered), 60% left
Dumping filters: flags 0x7, state 0x1, force is off
DATA (flags 0x0): balancing
METADATA (flags 0x0): balancing
SYSTEM (flags 0x0): balancing
# mount | grep -i btrfs
/dev/mapper/vg_xps-lv_docker on /var/lib/docker type btrfs (rw,relatime,ssd,space_cache,subvolid=5,subvol=/)
# btrfs-progs-git /usr/bin/btrfsck
Check structural inegrity of a filesystem (unmounted).
# btrfs check /dev/mapper/vg_xps-lv_docker
Checking filesystem on /dev/mapper/vg_xps-lv_docker
UUID: 737b6482-0397-479a-acd9-6b94eeba70f0
checking extents
checking free space cache
checking fs roots
checking csums
checking root refs
found 2161659908 bytes used err is 0
total csum bytes: 2025876
total tree bytes: 87162880
total fs tree bytes: 81838080
total extent tree bytes: 2818048
btree space waste bytes: 13472510
file data blocks allocated: 2448973824
referenced 2448912384
# btrfs filesystem df /var/lib/docker/
Data, single: total=3.01GiB, used=1.93GiB
System, DUP: total=8.00MiB, used=16.00KiB
System, single: total=4.00MiB, used=0.00B
Metadata, DUP: total=1.00GiB, used=83.11MiB
Metadata, single: total=8.00MiB, used=0.00B
GlobalReserve, single: total=32.00MiB, used=0.00B
# btrfs filesystem show !$
btrfs filesystem show /var/lib/docker/
Label: ‘docker’ uuid: 737b6482-0397-479a-acd9-6b94eeba70f0
Total devices 1 FS bytes used 2.01GiB
devid1 size 40.00GiB used 5.04GiB path /dev/mapper/vg_xps-lv_docker
# btrfs filesystem usage /var/lib/docker/
Overall: Device size: 40.00GiB
Device allocated: 5.04GiB
Device unallocated: 34.96GiB
Device missing: 0.00B
Used: 2.09GiB
Free (estimated): 36.04GiB (min: 18.56GiB)
Data ratio: 1.00
Metadata ratio: 1.99
Global reserve: 32.00MiB (used: 0.00B)
Data,single: Size:3.01GiB, Used:1.93GiB
/dev/mapper/vg_xps-lv_docker 3.01GiB
Metadata,single: Size:8.00MiB, Used:0.00B
/dev/mapper/vg_xps-lv_docker 8.00MiB
Metadata,DUP: Size:1.00GiB, Used:83.11MiB
/dev/mapper/vg_xps-lv_docker 2.00GiB
System,single: Size:4.00MiB, Used:0.00B
/dev/mapper/vg_xps-lv_docker 4.00MiB
System,DUP: Size:8.00MiB, Used:16.00KiB
/dev/mapper/vg_xps-lv_docker 16.00MiB
Unallocated: /dev/mapper/vg_xps-lv_docker 34.96GiB
# btrfs balance start /var/lib/docker/
Done, had to relocate 8 out of 8 chunks
# btrfs balance start /var/lib/docker/
Done, had to relocate 5 out of 5 chunks
# btrfs balance status -v /var/lib/docker/
# btrfs device stats -z /dev/mapper/vg_xps-lv_docker
[/dev/mapper/vg_xps-lv_docker].write_io_errs 0
[/dev/mapper/vg_xps-lv_docker].read_io_errs 0
[/dev/mapper/vg_xps-lv_docker].flush_io_errs 0
[/dev/mapper/vg_xps-lv_docker].corruption_errs 0
[/dev/mapper/vg_xps-lv_docker].generation_errs 0
# btrfs device usage /var/lib/docker/
/dev/mapper/vg_xps-lv_docker, ID: 1
Device size: 40.00GiB
Data,single: 2.00GiB
Metadata,DUP: 512.00MiB
System,DUP: 64.00MiB
Unallocated: 37.44GiB
$ sudo btrfs filesystem usage /mnt/data
Overall:
Device size: 1.82TiB
Device allocated: 1.54TiB
Device unallocated: 284.96GiB
Device missing: 0.00B
Used: 1.54TiB
Free (estimated): 285.35GiB (min: 142.87GiB)
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 512.00MiB (used: 0.00B)
Data,single: Size:1.53TiB, Used:1.53TiB
/dev/mapper/western1T 785.00GiB
/dev/mapper/western1Tb 785.00GiB
Metadata,RAID1: Size:4.00GiB, Used:2.24GiB
/dev/mapper/western1T 4.00GiB
/dev/mapper/western1Tb 4.00GiB
System,RAID1: Size:32.00MiB, Used:208.00KiB
/dev/mapper/western1T 32.00MiB
/dev/mapper/western1Tb 32.00MiB
Unallocated:
/dev/mapper/western1T 142.48GiB
/dev/mapper/western1Tb 142.48GiB
# btrfs scrub start -R /var/lib/docker/
scrub started on /var/lib/docker/,
fsid 737b6482-0397-479a-acd9-6b94eeba70f0 (pid=7870)
# btrfs scrub status -R /var/lib/docker/
scrub status for 737b6482-0397-479a-acd9-6b94eeba70f0
scrub started at Sat Jul 23 20:08:20 2016 and finished after 00:00:05
data_extents_scrubbed: 47209
tree_extents_scrubbed: 10576
data_bytes_scrubbed: 2075086848
tree_bytes_scrubbed: 173277184
read_errors: 0
csum_errors: 0
verify_errors: 0
no_csum: 144
csum_discards: 0
super_errors: 0
malloc_errors: 0
uncorrectable_errors: 0
unverified_errors: 0
corrected_errors: 0
last_physical: 2752512000
# df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/WD40PURZ-85A 3.7T 1.4T 2.3T 38% /mnt/WD40PURZ
# btrfs device usage /mnt/WD40PURZ/
/dev/mapper/WD40PURZ-85A, ID: 1
Device size: 3.64TiB
Device slack: 0.00B
Data,RAID1: 1.35TiB
Metadata,RAID1: 2.00GiB
System,RAID1: 8.00MiB
Unallocated: 2.29TiB
/dev/mapper/WD40PURZ-85T, ID: 2
Device size: 3.64TiB
Device slack: 0.00B
Data,RAID1: 1.35TiB
Metadata,RAID1: 2.00GiB
System,RAID1: 8.00MiB
Unallocated: 2.29TiB