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

`btrfs fi show /mountpoint` does not recognize a valid btrfs

Open automorphism88 opened this issue 4 years ago • 3 comments

If a filesystem has no devid 1 (because it was removed at some point) then running btrfs fi show on the mountpoint will say ERROR: not a valid btrfs filesystem even though the filesystem is valid and works fine otherwise. The filesystem will still show up when running btrfs fi show without arguments to show all btrfs filesystems.

automorphism88 avatar Aug 19 '20 06:08 automorphism88

@automorphism88 I couldn't reproduce this locally:

./mkfs.btrfs -f -mraid1 -draid1 /dev/sda /dev/sdb /dev/sdc

mount /dev/sda /mnt

[ 273.244756] BTRFS info (device sda): disk space caching is enabled [ 273.246074] BTRFS info (device sda): has skinny extents [ 273.247122] BTRFS info (device sda): flagging fs with big metadata feature [ 273.268173] BTRFS info (device sda): checking UUID tree

btrfs fi show /mnt

Label: none uuid: bddae3c1-2c83-4469-b99b-8bb713ada5a2 Total devices 3 FS bytes used 128.00KiB devid 1 size 20.00GiB used 0.00B path /dev/sda devid 2 size 20.00GiB used 2.01GiB path /dev/sdb devid 3 size 20.00GiB used 2.01GiB path /dev/sdc

btrfs device remove 1 /mnt/

[ 282.487891] BTRFS info (device sda): device deleted: id 1

btrfs fi show /mnt

Label: none uuid: bddae3c1-2c83-4469-b99b-8bb713ada5a2 Total devices 2 FS bytes used 640.00KiB devid 2 size 20.00GiB used 2.01GiB path /dev/sdb devid 3 size 20.00GiB used 2.01GiB path /dev/sdc

@automorphism88 which version os btrfsprogs are you using?I'm testing using current devel branch.

marcosps avatar Aug 19 '20 14:08 marcosps

I'm using btrfs-progs 5.7 at the moment. But I didn't actually test it thoroughly enough to know whether the absence of devid 1 was the key factor. This particular filesystem has had all of the original devices removed though. It has 7 devices, numbered 10 through 16.

automorphism88 avatar Aug 19 '20 14:08 automorphism88

This does not depend on the device numbers, the argument recognition seems to be broken and even if it's a valid btrfs mount point then it still leds to the error. I'll edit the subject to reflect that.

kdave avatar Oct 17 '23 17:10 kdave