I have an existing BTRFS filesystem composed of one 500GB disk and I just bought a 2TB disk to increase the storage capacity of my home server and I want add the new disk to the existing filesystem. From what I read, it seems like no BTRFS setup can handle disk of different sizes without wasting the difference in size between the larger and the smaller disk, but I'm new to BTRFS and I might have missed something, so is there a setup that can allow me to combine two disks in a filesystem without wasting space ?
Btrfs can use different raid levels for data and Metadata:
the default (even for one disk) is raid1 for the metadata (directories etc) and raid0 for the data.
If you did not change this then likely you will have no problem adding the second disc and running re-balance. because only the metadata will be copied to both discs (you can see your metadata size with
because the 2tb disk is sooooooooo much bigger than the 500g it would perhaps give you better odds if you add the new one and then remove the old one (the odds of one specific drive failing are a lot less than the odds of either of the drives failing).
if you plan on having a raid array later (with more similar sized drives) you may want to re-create the filesystem on the new drive with raid1 for both data and metadata and then copy everything over. then later when you have more money buy the second 2tb drive.
ps: using raid1 on a singl drive means the data will be stored in two locations on that one drive (to protect against corruption) and will reduce your storage space (its a really really good idea for the metadata).
pss: seriously, dont be tempted to not use raid1 for metadata. psss: there is a very good chance that btrfs will gain the ability to change raid levels dynamically.
It depends on what profile you use for the data blocks of the multi-device Btrfs filesystem.
I have a file server with a 2TB and a 3TB disk. It boots Ubuntu 12.10 from a USB flash drive. First I created the Btrfs filesystem without the
The result was that I could only store about 4TB (3.45 binary TB file data).
Then I used the "balance" command to convert the data blocks from RAID0 to the "single" profile:
It took a very long time (about 30 hours) to balance the 4TB data. But after it completed, I could use the full 5TB (4.36 binary TB file data).
I have used multiple devices with btrfs in Ubuntu, and it has worked just fine. Keep in mind that btrfs does not actually implement standard RAID levels. It implements optional striping and mirroring, but not true RAID.
It is possible to combine drives with different size in btrfs.
E.g. I installed 3 drives in a RAID0 (striped) array. 1x500GB, 1x250GB, 1x160GB.
This is what
But I'm not able to store any more data on the array. (No space left)
Even rebalancing didn't help.
On a mailing list I saw this callculation:
So in the current state of development chances are that you will not be able to use all the space you have even though btrfs does support different sizes in one array.
I'm using Ubuntu 10.10 with 2.6.35-22-generic kernel.
update: the answer below was written before Linux 3.0 was released. Linux 3.0 includes the quasi-round-robin patch.
When you do data mirroring or striping, the second mirror or stripe chunk needs to be allocated on another device with free space. BTRFS allocates chunks to devices in a round-robin fashion, which can cause lost space if you have devices of different sizes.
There is a quasi-round-robin patch in the pipeline to improve on this. Of course, it is still impossible to pair all chunks on different devices if you have a 500GB and a 2TB disk. The patch is intended more for situations like 1 x 1TB + 2 x 500GB where each small disk should prefer to mirror/stripe with the big disk instead of the other small disk.
In your situation, I would just use the "single" mode for your data (
This problem only apply to btrfs-raid1 setups, from the Gotchas page :