btrfs-progs
btrfs-progs copied to clipboard
fi resize: rework output
The current output of the resize command is practically useless.
$ btrfs fi resize 2:-10G /path
Resize '.' of '2:-10G'
The operation and end result should be described better possibly in human readable text and expected device state after the operation.
For the readability part, 2
and -10G
should definite changed to something like resize device 2 to <new_size> (diff -10G)
But for the .
part, should we just output the original path like resize the btrfs mounted at '/path' ....
or with more details like UUID?
I think more information in this case is desirable so we can put them on separate lines. Also as we have the global verbose options we can do two modes:
- one line summary
Resize device id 1 (/dev/path) from 100G to 90G
- multiple 'key: value' lines with further details
Resize device on /path
Device id: 1
Device path: /dev/path
Old size: 100G
New size: 90G
Difference: -10G
That's for starters.
@kdave , If there is no one that handle this, is it okay to handle it? Is it right format like you write above?
The one line summary has been added to devel. The long output as described could be also useful and we now have all the information parsed so it's just a matter of formatting. One line is missing in the proposed format Device size:
with the block device size. The long format goes with the verbosity level at least 1.
I'm seeing this with btrfs-progs v5.11.1 and kernel 5.12-rc6
# btrfs fi show
Label: 'OWC300G' uuid: ab845dd9-63b5-4459-b98b-06ed92398247
Total devices 1 FS bytes used 160.00KiB
devid 1 size 298.09GiB used 3.06GiB path /dev/sdb1
# btrfs fi resize 1:150g /srv/extra
Resize device id 1 (/dev/sdb1) from 298.09GiB to 0.00B
# btrfs fi show
Label: 'OWC300G' uuid: ab845dd9-63b5-4459-b98b-06ed92398247
Total devices 1 FS bytes used 160.00KiB
devid 1 size 150.00GiB used 3.06GiB path /dev/sdb1
from 298.09GiB to 0.00B? That's wrong. At least it did the resize correctly.
Fix pushed to devel. I'm leaving this open until the verbose version of resize output is done.
I find the one line summary sufficient, if somebody wants to add extended info, please open a new issue with suggested output.