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

device replace: spec by path and id don't work the same way

Open kdave opened this issue 3 years ago • 1 comments

A device to replace specified by path and by id do not get the same size checks, by-path does not allow resize to lower size, while by-id does.

kdave avatar May 20 '22 17:05 kdave

Can't reproduce this error, here is my run log.

$ sudo btrfs filesystem show /mnt/1/
Label: none  uuid: 9e4fbe07-e113-40dc-8008-2b01a65a74d7
	Total devices 3 FS bytes used 144.00KiB
	devid    1 size 15.00GiB used 1.09GiB path /dev/loop1
	devid    2 size 15.00GiB used 1.09GiB path /dev/loop2
	devid    3 size 15.00GiB used 1.09GiB path /dev/loop3
$ sudo btrfs replace start /dev/loop2 /dev/loop5 /mnt/1/ -f
Performing full device TRIM /dev/loop5 (15.00GiB) ...
$ sudo btrfs replace status /mnt/1/
Started on 27.Jul 09:42:28, finished on 27.Jul 09:42:28, 0 write errs, 0 uncorr. read errs
$ sudo btrfs filesystem show /mnt/1/
Label: none  uuid: 9e4fbe07-e113-40dc-8008-2b01a65a74d7
	Total devices 3 FS bytes used 160.00KiB
	devid    1 size 15.00GiB used 1.11GiB path /dev/loop1
	devid    2 size 15.00GiB used 1.11GiB path /dev/loop5
	devid    3 size 15.00GiB used 1.11GiB path /dev/loop3

$ sudo btrfs fi resize 2:-1G /mnt/1/
Resize device id 2 (/dev/loop5) from 15.00GiB to 14.00GiB
$ sudo btrfs filesystem show /mnt/1/
Label: none  uuid: 9e4fbe07-e113-40dc-8008-2b01a65a74d7
	Total devices 3 FS bytes used 144.00KiB
	devid    1 size 15.00GiB used 1.11GiB path /dev/loop1
	devid    2 size 14.00GiB used 1.11GiB path /dev/loop5
	devid    3 size 15.00GiB used 1.11GiB path /dev/loop3

zhanglikernel avatar Jul 27 '22 02:07 zhanglikernel