Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

btrfs RAID1 under Ubuntu 12.04.4 LTS

  • 08-07-2014 11:41pm
    #1
    Registered Users, Registered Users 2 Posts: 7,411 ✭✭✭


    Howdy,

    I have two 1TB disks, sda and sdb, upon which I create a RAID1 through btrfs (mkfs.btrfs).
    root@backup:/mnt# mkfs.btrfs -m raid1 -d raid1 /dev/sda /dev/sdb
    
    WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
    WARNING! - see http://btrfs.wiki.kernel.org before using
    
    adding device /dev/sdb id 2
    fs created label (null) on /dev/sda
            nodesize 4096 leafsize 4096 sectorsize 4096 size 1.82TB
    Btrfs Btrfs v0.19
    

    Ok, so I then check the status.
    root@backup:/mnt# btrfs filesystem show
    Label: none  uuid: 6de6b9c1-0837-40f1-82df-6fca58544c8c
            Total devices 2 FS bytes used 28.00KB
            devid    1 size 931.51GB used 2.03GB path /dev/sda
            devid    2 size 931.51GB used 2.01GB path /dev/sdb
    
    Label: none  uuid: 38673844-bcc4-48a0-884d-5613ae0ec043
            Total devices 1 FS bytes used 28.00KB
            devid    1 size 1.82TB used 2.04GB path /dev/sdc
    
    Btrfs Btrfs v0.19
    

    Odd, I see 1.82TB as the size...

    I now have no additional device created (like as you would with mdadm - /dev/md127...).
    lsblk
    NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    sda      8:0    0 931.5G  0 disk 
    sdb      8:16   0 931.5G  0 disk 
    

    So I check out the UUID's...
    root@backup:/mnt/raid1# blkid 
    /dev/sda: UUID="6de6b9c1-0837-40f1-82df-6fca58544c8c" UUID_SUB="ddb354a2-5562-4b1e-a61b-d0254a438fc0" TYPE="btrfs" 
    /dev/sdb: UUID="6de6b9c1-0837-40f1-82df-6fca58544c8c" UUID_SUB="96b611fb-d03b-4795-aa4a-1fbe0cf96d1e" TYPE="btrfs" 
    

    Ok, so all looks ok to a point and I mount it on /mnt/raid1... But when I do a df -h, I see the following:
    root@backup:/mnt/raid1# df -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda        1.9T   56K  1.9T   1% /mnt/raid1
    

    Can anybody verify that this is a bug (or is it me)? I should be seeing 931GB instead of 1.9TB (as in, RAID1 versus RAID0).


Comments

  • Closed Accounts Posts: 824 ✭✭✭Kinet1c


    I would advise against software raid, it won't end well.


  • Registered Users, Registered Users 2 Posts: 7,411 ✭✭✭10-10-20


    Last night I filled the drive by doing a dd from /dev/zero.
    Guess where dd stopped?
    root@backup:/mnt/raid1# ls -lah
    total 930G
    -rw-r--r-- 1 root root 930G Jul  9 06:43 test.file
    

    At 930GB.
    zlib compression is enabled, btw.
    mount
    /dev/sda on /mnt/raid1 type btrfs (rw,noatime,compress=zlib)
    

    df -h shows a full drive, at 1.9TB full.
    root@backup:/mnt/raid1# df -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda        1.9T  1.9T  288K 100% /mnt/raid1
    

    btrfs shows 930GB used.
    root@backup:/mnt/raid1# btrfs filesystem show
    Label: none  uuid: 6de6b9c1-0837-40f1-82df-6fca58544c8c
    	Total devices 2 FS bytes used 930.77GB
    	devid    1 size 931.51GB used 931.51GB path /dev/sda
    	devid    2 size 931.51GB used 931.49GB path /dev/sdb
    
    Label: none  uuid: 38673844-bcc4-48a0-884d-5613ae0ec043
    	Total devices 1 FS bytes used 28.00KB
    	devid    1 size 1.82TB used 2.04GB path /dev/sdc
    
    Btrfs Btrfs v0.19
    

    So, it seems to be a disk reporting error on the side of the kernel, in that it views the disks as independent objects and not as part of a RAID group? How odd.


  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    Kinet1c wrote: »
    I would advise against software raid, it won't end well.

    I was about to call you on this, but I see that OP is not using the kernel raid. The kernel raid is brilliant.

    OP: I wouldn't be using btrfs build in raid on 12.04. Maybe bump to 14.04 and use the kernel raid with a btrfs filesystem on top?


  • Registered Users, Registered Users 2 Posts: 1,477 ✭✭✭azzeretti


    If I remember correctly there us a bug with df reading btrfs correctly. I think you need to trust 'btrfs fi df'
    IIRC this is a known problem and should be on the btrfs wiki.

    EDIT: https://btrfs.wiki.kernel.org/index.php/FAQ#Why_does_df_show_incorrect_free_space_for_my_RAID_volume.3F


Advertisement