Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm creating a btrfs using

sudo mkfs.btrfs -m raid1 -d raid1 <small-disk> <large-disk> or
sudo mkfs.btrfs -m raid1 -d raid1 <large-disk> <small-disk>

it creates the fs with the size of the sum of the two disks/partitions, but

 btrfs fi df <mountpoint>

gives me RAID1 for data, system and metadata

How can this be correct?

Is there some way like mdadm's

cat /proc/mdstat

to see what btrfs is doing and to assure myself my raid1 is secure? It's not terribly important data, hence it's ok to use btrfs, but i don't want to lose it either.

share|improve this question
1  
Try creating a large file in that volume, and look at the impact on df. Haven't followed btrfs lately, but I believe their Wiki has information about how to interpret df output on btrfs. –  Mat Jan 5 '12 at 9:56

1 Answer 1

up vote 8 down vote accepted

I found out the answer by asking on the mailing-list.

btrfs doesn't do RAID per-volume, but rather on a per-chunk basis. The filesystem reserves "raw" space in (p.e.) 1GB chunks. Initializing the fs with raid1 means that everytime it tries to allocate a chunk, it tries to allocate a copy of this chunk on another device.

This architecture allows mixed-size devices and it's future features might include per-file raid-levels.

Currently df shows you the amount of free raw space on the devices, which is the sum of all the device-sizes. Assuming the chunk-size is 1GB, writing just a 5MB file onto a raid1-btrfs will therefore decrease the raw space by 2GB. That's is why btrfs includes the btrfs fi df command to give you the actual usage. This will probably be adapted in the future to show more precisely what is going on.

share|improve this answer
    
So it's more or less thin provisioning? If your disks are full, you could add more disks to the pool and just keep on going. –  Gert Jan 9 '12 at 11:39
    
I'm not sure it's technically thin-provising, since btrfs takes up that space for it's chunks, but yes, you could add more disks later. –  Fabian Zeindl Jan 9 '12 at 17:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.