|Summary:||"btrfs device replace" should allow smaller devices if possible|
|Product:||File System||Reporter:||Andy Smith (andy-bugzilla.kernel.org)|
|Component:||btrfs||Assignee:||Josef Bacik (josef)|
|Severity:||enhancement||CC:||dsterba, fdmanana, szg0000|
Description Andy Smith 2016-02-20 19:21:19 UTC
I had a 2TB drive die and it was physically removed. I happened to have some brand new 1TB drives laying around and as only ~380GB of the 2T drive had actually been in use I decided to use one of the 1TB ones in the interests of regaining redundancy (RAID10). btrfs refused to do it because the new device is smaller than the old one. I don't see why that is an issue when in fact only ~380GB of the 2T device was in use. And in any case, the data would need to come from the other devices as the 2T drive is no longer physically present, so what does it matter how big the devices in question are?
Comment 1 David Sterba 2016-02-24 10:51:57 UTC
Technically possible, I've just tried it and works if the size checks are dropped. We'd need to make sure the actual data will fit the new device size and satisfy the raid constraints.
Comment 2 Filipe David Manana 2019-12-09 11:37:52 UTC
Before anyone else goes into assuming that adding support for device replace to use a smaller device is as simple as removing or updating the device size constraints in the kernel and btrfs-progs: https://lore.kernel.org/linux-btrfs/CAL3q7H60gNBC_zzU8gjZ_s=7MnN23yFzQqYxanhvzMO50qtXJg@mail.gmail.com/ https://patchwork.kernel.org/patch/11278121/ Just in case someone else is interested in implementing the feature.