Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using a fairly vanilla Ubuntu 10.04 server installation, and I'm experimenting with BTRFS.

How can I create a BTRFS RAID1 mount?

I've got two (2) 1Gig drives that I popped in the server and after running the following commands, it appears I've got a 2 Gig partition, not 1 Gig as I would expect.

$ sudo mkfs.btrfs -m raid1 -d raid1 /dev/sdb /dev/sdc

WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using

failed to open /dev/btrfs-control skipping device registration
adding device /dev/sdc id 2
failed to open /dev/btrfs-control skipping device registration
fs created label (null) on /dev/sdb
        nodesize 4096 leafsize 4096 sectorsize 4096 size 1.82TB
Btrfs Btrfs v0.19

Okay ... errors. But if I plow ahead, I can mount this, and when I do a df, I see 2 Gigs free:

$ mkdir btrfs && sudo mount -t btrfs /dev/sdc $(pwd)/btrfs
$ cd btrfs && df . -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdc              1.9T   28K  1.9T   1% /home/jamie/btrfs

I'd expected to see only one.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

I found the following on the btrfs wiki, specifically the Gotchas page (quoted verbatim):

  • on a -d raid1 volume, df will show total raw space, space used by data (not counting duplication), and the difference between those two numbers. This can be surprising since you'll run out of space before the Use% reaches 50. (up to and including 2.6.33 -- reporting changed in 2.6.34)

  • In 2.6.34, df will show total raw space, space used by data (factoring in duplication for raid1), and raw free space, taking metadata and data into consideration. You can still hit an "out of space" condition well before free space reaches 0, especially if, under raid1, your allocated space is unbalanced, and the system finds it impossible to find space for your new write on two separate disks.

Since you're running Ubuntu 10.04, which uses Linux kernel version 2.6.32, it appears you're seeing the "surprising" behaviour described by the first bullet point. So, in all likelihood, the filesystem you created really is RAID1, df is just over-reporting its size.

share|improve this answer
    
Thanks for the research. I feel a little sheepish. –  Jamie Oct 23 '10 at 11:49

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.