[Discuss] BTRFS - Experiments

John Blomfield jabfield at shaw.ca
Wed Nov 5 16:28:56 PST 2014


OpenSuse 13.2 with a default BTRFS file system is now out; however, I 
always wait a while before trying a new version so as to give the 
developers time to sort out the usual rush of new bugs that did not show 
up during beta testing. In the meantime I decided to try out BTRFS on my 
existing OpenSuse 13.1 installation but without a complete conversion. I 
have therefore just converted my data partition which resides on my SSD 
and mirror it with BTRFS RAID1 on my HD. My SSD is just 240 GB, my HD is 
1 TB and my data partition is 150 GB. This partition excludes photos and 
video since there is no room for those on my SSD and I access those 
infrequently compared to the stuff on my 150 GB data partition. Photos 
and Videos are in a partition on the 1 TB HD.

My test then was on 150 GB SSD (sdb7) and 150 GB HD(sda9), mirrored with 
RAID 1. There are lots of articles and documents to view on BTRFS and 
quoting from one:

"The RAID in Btrfs has some differences from the old-fashioned RAID 
we're used to. In Btrfs RAID0 stripes your data across all available 
devices with no redundancy. RAID1 mirrors your data in pairs, 
round-robin across all available devices, so there are always two copies 
of your metadata regardless of how many devices are in the storage pool."

So I could set up RAID 1 with mirrored meta data or with everything 
mirrored. I chose the latter. Before starting of course I made a fresh 
backup of my data (sdb7) and then tried:

# btrfs-convert /dev/sdb7

it seemed to work in that I could mount it and access it but when I 
tried to add a second drive (sda9) and convert it to RAID 1 it failed. eg

# mount /dev/sdb7 /mnt/btrfs-test/
# btrfs device add -f /dev/sda9 /mnt/btrfs-test/
# btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt/btrfs-test/
# "failed - error message", it didn't matter whether of not sda9 was 
formatted ext4 or btrfs.

Since I had a fresh backup of sdb7 I decided to reformat both sdb7 and 
sda9 and build a RAID 1 btrfs pair from scratch, I had already tried 
this out on a spare USB HD so I new it would work i.e.

# mkfs.btrfs -f -d raid1 /dev/sdb7 /dev/sda9
# btrfs filesystem label /dev/sdb7 DATA        (I could have used the -L 
option in the above command to do this)
# mount /dev/sdb7 /home/john/data

To see what has been done:
# btrfs filesystem show

Finally it was necessary to update my /etc/fstab file which used to 
contain the mounting instruction:

/dev/sdb7    /home/john/data        ext4 defaults,user_xattr        0 0

and change to:

/dev/sdb7    /home/john/data        btrfs 
device=/dev/sdb7,device=/dev/sda9,defaults    0 0

after saving /etc/fstab and unmounting;

# umount /dev/sdb7

and then re-mount:

# mount -a

SUCCESS!

One more thing to note is that gparted shows a warning error on sdb7 
plus the normal mounted symbol (a key) and no used space info, whereas, 
sda9 shows no mounted symbol and the correct used space info. Also the 
normal commands df and du do not work correctly for BTRFS you need to use:

# btrfs filesystem df /home/john/data/

I shall still of course be running my regular daily and weekly backups 
since this is all automatic and unaffected by the change. Hopefully I 
will learn over the course of the coming weeks whether or not there are 
any problems with this setup and if I get any disk failures then it will 
be easy to fix.

I hope the above was helpful to anyone who might try something similar.

John









-- 
John Blomfield
Delivered by Thunderbird Email on Linux OpenSuse-KDE4

Old John B's Linux Noteshttp://www.oldjohnbslinux.wordpress.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://vlug.org/pipermail/discuss_vlug.org/attachments/20141105/67c276c1/attachment.html>


More information about the Discuss mailing list