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 tried to make a btrfs RAID-1 filesystem in "degraded mode" by following the btrfs UseCases instructions but hit a fatal assertion error. Why is this failing, and is there any workaround?

The instructions I followed are at:

https://btrfs.wiki.kernel.org/index.php/UseCases#How_can_I_create_a_RAID-1_filesystem_in_.22degraded_mode.22.3F

The output of the mkfs.btrfs and btrfs filesystem show commands is:

# mkfs.btrfs -m raid1 -d raid1 /dev/sdd1 /dev/loop1

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

failed to read /dev/sr0
adding device /dev/loop1 id 2
mkfs.btrfs: volumes.c:802: btrfs_alloc_chunk: Assertion `!(ret)' failed.
zsh: abort (core dumped)  mkfs.btrfs -m raid1 -d raid1 /dev/sdd1 /dev/loop1
# btrfs filesystem show
failed to read /dev/sr0
Label: none  uuid: 773908b8-acca-4c30-85c5-6642b06de22b
        Total devices 1 FS bytes used 28.00KB
        devid    1 size 223.13GB used 2.04GB path /dev/sda5

Label: none  uuid: 0f06f1a8-5f5f-4b92-a55c-b827bcbcc840
        Total devices 2 FS bytes used 24.00KB
        devid    2 size 2.00GB used 0.00 path /dev/loop1
        devid    1 size 1.36TB used 20.00MB path /dev/sdd1

Btrfs Btrfs v0.19
#

EDIT:

It turns out that the filesystem isn't mountable:

# mount /dev/sdd1 /mnt/big2
mount: wrong fs type, bad option, bad superblock on /dev/sdd1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
#

So, why did the mkfs fail, and is there any workaround?

share|improve this question
add comment

1 Answer 1

In order to mount a degraded array, you must use the degraded mount option:

    mount -o degraded /dev/sdd1 /mnt/big2

I do not understand what you are doing with the small loop1 partition. This is not necessary to mount a degraded array. You're creating a raid1 array with one member being 2GB and one member being 1.36TB. The difference between these is three orders of magnitude, and the best you could expect is that you would have a 2GB array. But the metadata is not inconsequential. It is known that you cannot create a btrfs filesystem smaller than 256MB.

In general when creating raid1 arrays, both members of the array should be the same size. Recent btrfs documentation has updated to read that inhomogenous arrays can be created and will have the size of the smallest array member. But in the past such arrays would fill the smallest member much quicker than naively expected.

So, do not create such an asymmetric array, and/or do not use such small array members. (and most of all use -o degraded)

share|improve this answer
    
The page I linked to explains the reason for using the loop1 partition. –  amcnabb Oct 6 '12 at 13:58
add comment

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.