btrfs-progs icon indicating copy to clipboard operation
btrfs-progs copied to clipboard

fi resize: rework output

Open kdave opened this issue 4 years ago • 6 comments

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.

kdave avatar Oct 26 '20 13:10 kdave

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?

adam900710 avatar Oct 26 '20 13:10 adam900710

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 avatar Oct 30 '20 17:10 kdave

@kdave , If there is no one that handle this, is it okay to handle it? Is it right format like you write above?

realwakka avatar Dec 08 '20 12:12 realwakka

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.

kdave avatar Mar 09 '21 15:03 kdave

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.

cmurf avatar Apr 06 '21 22:04 cmurf

Fix pushed to devel. I'm leaving this open until the verbose version of resize output is done.

kdave avatar Apr 19 '21 17:04 kdave

I find the one line summary sufficient, if somebody wants to add extended info, please open a new issue with suggested output.

kdave avatar Oct 18 '23 14:10 kdave