Skip to contentSkip to conversation

can we make balance delete missing devices?

DISCUSSION Russell Coker 2 participants 2 messages Aug 14, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw
[ 2918.502237] BTRFS info (device loop1): disk space caching is enabled
[ 2918.503213] BTRFS: failed to read chunk tree on loop1
[ 2918.540082] BTRFS: open_ctree failed

I just had a test RAID-1 filesystem with a missing device. I mounted it with the degraded option and added a new device. I balanced it (to make it do RAID-1 again) and thought everything was good. Then when I tried to mount it again it gave errors such as the above (not sure why). Then I tried wiping /dev/loop1 and it refused to mount entirely due to having 2 missing devices.

Obviously it was my mistake to not remove the missing device, and wiping /dev/loop1 was a bad idea. Failing to remove a missing device seems likely to be a common mistake. Could we make the balance operation automatically delete the missing device? I can't imagine a situation in which a balance would be desired but deleting the missing device wouldn't be desired.

Signature · 2 lines
My Main Blog         http://etbe.coker.com.au/
My Documents Blog    http://doc.coker.com.au/
#1 lore raw
Quoted 10 lines · Russell Coker
[ 2918.502237] BTRFS info (device loop1): disk space caching is enabled
[ 2918.503213] BTRFS: failed to read chunk tree on loop1
[ 2918.540082] BTRFS: open_ctree failed

I just had a test RAID-1 filesystem with a missing device. I mounted it with the degraded option and added a new device. I balanced it (to make it do RAID-1 again) and thought everything was good. Then when I tried to mount it again it gave errors such as the above (not sure why). Then I tried wiping /dev/loop1 and it refused to mount entirely due to having 2 missing devices.

Quoted 5 lines

Obviously it was my mistake to not remove the missing device, and wiping /dev/loop1 was a bad idea. Failing to remove a missing device seems likely to be a common mistake. Could we make the balance operation automatically delete the missing device? I can't imagine a situation in which a balance would be desired but deleting the missing device wouldn't be desired.

I think this is specious because balance doesn't at all convey a missing device will be silently dropped. If a device is missing and balancing is a bad idea, then balance should probably fail rather than automatically delete missing.

The proper way to avoid this is to use btrfs replace start. Maybe it's just an old habit that needs purging, device add + device delete + balance, this is the exact use case replace was meant to address.

Signature · 1 line
Chris Murphy