Permalink
Browse files
A new show usage example!
The show usage example was one of the very first examples, showing which
block groups and chunks are present in the filesystem.
Now that we have detailed usage analysis code, let's use it to build a
more sophisticated example showing full-blown usage information.
Here's an example, running it on a small empty RAID5 filesystem with
three block devices.
The "Estimated virtual space left to use for data: 10.74GiB" in here is
what users would like to see in the df output (which lists 21G free
instead).
-# dd if=/dev/zero of=raid5-1 bs=1 count=0 seek=10G
-# dd if=/dev/zero of=raid5-2 bs=1 count=0 seek=10G
-# dd if=/dev/zero of=raid5-3 bs=1 count=0 seek=10G
-# mkfs.btrfs -f -d raid5 -m raid1 raid5-1 raid5-2 raid5-3
-# for i in `seq 1 3`; do echo $i; losetup -f raid5-$i; done
-# mount -o space_cache=v2 /dev/loop0 /mnt/commit_message
-# ./show_usage.py /mnt/commit_message
Mixed groups: False
Target profile for System (chunk tree): RAID1
Target profile for Metadata: RAID1
Target profile for Data: RAID5
Virtual space usage by block group type:
|
| type total used
| ---- ----- ----
| Data 2.00GiB 0.00B
| System 8.00MiB 16.00KiB
| Metadata 1.00GiB 128.00KiB
Total raw filesystem size: 30.00GiB
Total raw allocated bytes: 5.02GiB
Allocatable bytes remaining: 29.25GiB
Unallocatable bytes that can be reclaimed by balancing: 512.00MiB
Unallocatable bytes because of unbalanced device sizes: 256.00MiB
Note: Don't worry if the unallocatable amounts are < 1GiB
Estimated virtual space left to use for metadata: 1.25GiB
Estimated virtual space left to use for data: 17.74GiB
Allocated raw disk bytes by chunk type. Parity is a reserved part of the
allocated bytes, limiting the amount that can be used for data or
metadata:
|
| flags allocated used parity
| ----- --------- ---- ------
| DATA|RAID5 3.00GiB 0.00B 1.00GiB
| SYSTEM|RAID1 16.00MiB 32.00KiB 0.00B
| METADATA|RAID1 2.00GiB 256.00KiB 0.00B
Allocated bytes per device:
|
| devid total size allocated path
| ----- ---------- --------- ----
| 1 10.00GiB 2.00GiB /dev/loop0
| 2 10.00GiB 1.01GiB /dev/loop1
| 3 10.00GiB 2.01GiB /dev/loop2
Allocated bytes per device, split up per chunk type. Parity bytes are
again
part of the total amount of allocated bytes.
|
| Device ID: 1
| | flags allocated parity
| | ----- --------- ------
| | DATA|RAID5 1.00GiB 341.33MiB
| | METADATA|RAID1 1.00GiB 0.00B
|
| Device ID: 2
| | flags allocated parity
| | ----- --------- ------
| | DATA|RAID5 1.00GiB 341.33MiB
| | SYSTEM|RAID1 8.00MiB 0.00B
|
| Device ID: 3
| | flags allocated parity
| | ----- --------- ------
| | DATA|RAID5 1.00GiB 341.33MiB
| | SYSTEM|RAID1 8.00MiB 0.00B
| | METADATA|RAID1 1.00GiB 0.00B
Unallocatable bytes per device:
|
| devid soft hard reclaimable
| ----- ---- ---- -----------
| 1 0.00B 0.00B 0.00B
| 2 768.00MiB 0.00B 768.00MiB
| 3 0.00B 256.00MiB 0.00B
And yes, fun thing is that after doing a raw btrfs balance start on this
mountpoint, the reclaimable unallocated space will be zero. :-)- Loading branch information