Linux/Btrfs
< Linux
Btrfs
Installation
# centos yum install btrfs-progs # WARNING! - Btrfs Btrfs v0.20-rc1 IS EXPERIMENTAL
# ubuntu: apt-get install btrfs-tools # WARNING! - Btrfs v3.12 IS EXPERIMENTAL
Test JBOD Failure Recovery
# create image file 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 # create loopback devices losetup /dev/loop0 img0 losetup /dev/loop1 img1 losetup /dev/loop2 img2 # show loop back devices losetup -a # verify btrfs module is loaded lsmod | grep btrfs # make btrfs file system mkfs.btrfs -L "btrfs-test" /dev/loop0 /dev/loop1 /dev/loop2 # btrfs device scan btrfs device scan btrfs filesystem show # should show the devices # see that the block id label is picked up blkid | grep btrfs-test # mount btrfs file system mount /dev/loop0 /mnt #traffic 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 ~ # umount btrfs file system umount /mnt # simulate destroying one drive #losetup -d /dev/loop0 losetup -d /dev/loop1 # btrfs device scan btrfs device scan btrfs filesystem show # should show the devices # try mounting remaining device #mount /dev/loop1 /mnt # <-- fails - expected #mount /dev/loop1 /mnt -oro,degraded # <-- fails! #mount /dev/loop1 /mnt -oro,degraded,recovery # <-- fails! mount /dev/loop2 /mnt -oro,degraded # verify data cd /mnt for i in 1 2 3 4 5 ; do cd $i ; echo "$i:" ; md5sum -c $i.dat.md5 ; cd .. ; done # cleanup 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
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