btrfs raid1 changing degraded write
von heisenberg- SNIPPET_TEXT:
-
- #!/bin/bash
- mylog() {
- echo "$(date) : $*"
- }
- my_losetup() {
- local idx=$1
- losetup | grep -q /dev/loop$idx || losetup /dev/loop$idx /backup/testing/disk$idx
- }
- btrfs_change() {
- umount /testbtrfs
- local add_nr=$1
- local del_nr=$2
- mylog "changing btrfs to enabled: $add_nr disabled: $del_nr"
- my_losetup $add_nr
- losetup -d /dev/loop$del_nr
- mount -o rw,degraded /dev/loop$add_nr /testbtrfs
- }
- btrfs_mount_clean() {
- umount /testbtrfs
- my_losetup 0
- my_losetup 1
- mount /dev/loop0 /testbtrfs
- }
- do_write() {
- echo "$(date) : v$1" >>/testbtrfs/testdir1/testfile
- }
- i=1
- while :;do
- btrfs_mount_clean
- btrfs_change 1 0
- do_write "$i"
- btrfs_mount_clean
- btrfs_change 0 1
- do_write "$((i+1))"
- ((i=i+2))
- done
Quellcode
Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN