mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-25 23:52:17 +00:00
fdf7f35d3e
In case of a raid5/6 filesystem 'btrfs fi us' returns wrong values without the root capabilities: $ sudo btrfs fi us /tmp/raid5fs # as root Overall: Device size: 3.00GiB Device allocated: 1.51GiB <--- OK Device unallocated: 1.49GiB <--- OK Device missing: 0.00B Device slack: 0.00B Used: 769.03MiB <--- OK Free (estimated): 1.32GiB (min: 1.32GiB) <-OK Free (statfs, df): 1.32GiB Data ratio: 1.50 <--- OK Metadata ratio: 1.50 <--- OK Global reserve: 5.50MiB (used: 0.00B) Multiple profiles: no [...] $ btrfs fi us /tmp/raid5fs # as user WARNING: cannot read detailed chunk info, per-device usage will not be shown, run as root Overall: Device size: 3.00GiB Device allocated: 0.00B <--- WRONG Device unallocated: 3.00GiB <--- WRONG Device missing: 0.00B Device slack: 0.00B Used: 0.00B <--- WRONG Free (estimated): 0.00B (min: 8.00EiB) <- WRONG Free (statfs, df): 1.32GiB Data ratio: 0.00 <--- WRONG Metadata ratio: 0.00 <--- WRONG Global reserve: 5.50MiB (used: 0.00B) Multiple profiles: no [...] The reason is that the BTRFS_IOC_SPACE_INFO ioctl doesn't return enough information. To bypass it a scan of the chunks is required when a raid5/6 profile is present. To avoid providing wrong information, in case of a raid5/6 filesystem without the root capabilities the "btrfs fi us" is not executed at all and a warning with a suggestion to run it as root is printed. $ ./btrfs fi us /tmp/t/ WARNING: cannot read detailed chunk info, per-device usage will not be shown, run as root WARNING: due to the presence of a raid5/raid6 profile, we cannots compute some values; WARNING: run as root instead. Signed-off-by: Goffredo Baroncelli <kreijack@libero.it> Signed-off-by: David Sterba <dsterba@suse.com> |
||
---|---|---|
.. | ||
balance.c | ||
commands.h | ||
device.c | ||
filesystem-du.c | ||
filesystem-usage.c | ||
filesystem-usage.h | ||
filesystem.c | ||
inspect-dump-super.c | ||
inspect-dump-tree.c | ||
inspect-tree-stats.c | ||
inspect.c | ||
property.c | ||
props.h | ||
qgroup.c | ||
qgroup.h | ||
quota.c | ||
receive-dump.c | ||
receive-dump.h | ||
receive.c | ||
reflink.c | ||
replace.c | ||
rescue-chunk-recover.c | ||
rescue-super-recover.c | ||
rescue.c | ||
rescue.h | ||
restore.c | ||
scrub.c | ||
send.c | ||
subvolume-list.c | ||
subvolume.c | ||
subvolume.h |