Bug 112741 - "btrfs device replace" should allow smaller devices if possible
Summary: "btrfs device replace" should allow smaller devices if possible
Status: NEW
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: All Linux
: P1 enhancement
Assignee: Josef Bacik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-20 19:21 UTC by Andy Smith
Modified: 2019-12-09 11:37 UTC (History)
3 users (show)

See Also:
Kernel Version: 4.5.0-rc4
Subsystem:
Regression: No
Bisected commit-id:


Attachments

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.

Note You need to log in before you can comment on or make changes to this bug.