Linux/Btrfs

Btrfs
http://btrfs.wiki.kernel.org

Installation
yum install btrfs-progs
 * 1) centos
 * 1) WARNING! - Btrfs Btrfs v0.20-rc1 IS EXPERIMENTAL

apt-get install btrfs-tools
 * 1) ubuntu:
 * 1) WARNING! - Btrfs v3.12 IS EXPERIMENTAL

Test JBOD Failure Recovery
dd if=/dev/urandom of=img0 bs=1M count=20 dd if=/dev/urandom of=img1 bs=1M count=20 dd if=/dev/urandom of=img2 bs=1M count=20
 * 1) create image file

losetup /dev/loop0 img0 losetup /dev/loop1 img1 losetup /dev/loop2 img2 losetup -a
 * 1) create loopback devices
 * 1) show loop back devices

lsmod | grep btrfs
 * 1) verify btrfs module is loaded

mkfs.btrfs -L "btrfs-test" /dev/loop0 /dev/loop1 /dev/loop2
 * 1) make btrfs file system

btrfs device scan btrfs filesystem show # should show the devices
 * 1) btrfs device scan

blkid | grep btrfs-test
 * 1) see that the block id label is picked up

mount /dev/loop0 /mnt
 * 1) mount btrfs file system

cd /mnt for i in 1 2 3 4 5 ; do mkdir $i ; cd $i ; dd if=/dev/urandom of=$i.dat bs=1M count=20 ; md5sum $i.dat> $i.dat.md5 ; cd .. ; done cd ~
 * 1) traffic

umount /mnt
 * 1) umount btrfs file system

losetup -d /dev/loop1
 * 1) simulate destroying one drive
 * 2) losetup -d /dev/loop0

btrfs device scan btrfs filesystem show # should show the devices
 * 1) btrfs device scan

mount /dev/loop2 /mnt -oro,degraded
 * 1) try mounting remaining device
 * 2) mount /dev/loop1 /mnt # <-- fails - expected
 * 3) mount /dev/loop1 /mnt -oro,degraded # <-- fails!
 * 4) mount /dev/loop1 /mnt -oro,degraded,recovery # <-- fails!

cd /mnt for i in 1 2 3 4 5 ; do cd $i ; echo "$i:" ; md5sum -c $i.dat.md5 ; cd .. ; done
 * 1) verify data

umount /mnt # should already be done losetup -d /dev/loop0 # should already be done losetup -d /dev/loop1 losetup -d /dev/loop2 rm -f img0 img1 img2
 * 1) cleanup

Note: Failing the first drive fails the to mount at all, but failing a different drive seems to work.

Test mentioned here: https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices#Filesystem_creation