Last active
March 23, 2018 09:45
-
-
Save csamsel/ef6f5a6df0fa0db22ec3644d211f4dad to your computer and use it in GitHub Desktop.
notes on switching from Linux md RAID5 to btrfs RAID10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
assumptions: | |
/dev/sd[bcde]1 in Linux md (/dev/md0) RAID5/RAID6 mounted as /storage. | |
Less space used then capacity of one drive. | |
1. | |
stop all services accessing the array first. | |
Remounting the array ro might be a good idea (mount /dev/md0 -o remount,ro). | |
2. | |
remove one disk from array | |
# mdadm /dev/md0 --fail /dev/sdb1 | |
# mdadm /dev/md0 --remove /dev/sdb1 | |
# mdadm --zero-superblock /dev/sdb1 | |
cat /proc/mdstat should now look like this (note the UUU_): | |
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] [linear] [multipath] | |
md0 : active raid6 sde1[3] sdd1[1] sdb1[4](F) sdc1[0] | |
5859110912 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/3] [UUU_] | |
bitmap: 0/22 pages [0KB], 65536KB chunk | |
unused devices: <none> | |
3. | |
create new btrfs volume on the removed drive: | |
# mkfs.btrfs /dev/sdb1 | |
4. | |
copy over files (make sure a single drive has enough space) | |
# mount /dev/sdb1 /storage.new | |
# cp -a /storage/* /storage.new | |
check consistency | |
5- | |
dismantle old array: | |
# umount /storage | |
# mdadm --stop /dev/md0 | |
# mdadm --zero-superblock /dev/sdc1 | |
# mdadm --zero-superblock /dev/sdd1 | |
# mdadm --zero-superblock /dev/sde1 | |
6. | |
add drives to btrfs volume: | |
# btrfs device add /dev/sd[cde]1 /storage.new | |
7. | |
# remount new array in old location | |
umount /storage.new | |
#mount /dev/sdb1 /storage | |
8. | |
# switch btrfs profile for data and metadata to raid10 | |
btrfs balance start -dconvert=raid10 -mconvert=raid10 /storage | |
check progress with (or btrfs balance status /storage) | |
# btrfs fi show | |
Label: 'root' uuid: 4967ac6e-9073-41f1-b1eb-a6f6e052da7a | |
Total devices 1 FS bytes used 25.06GiB | |
devid 1 size 38.87GiB used 38.87GiB path /dev/sda4 | |
Label: 'storage' uuid: a48e0409-d677-4fbb-9a80-4c599d30b4ac | |
Total devices 4 FS bytes used 2.26TiB | |
devid 1 size 2.73TiB used 2.27TiB path /dev/sdb1 | |
devid 2 size 2.73TiB used 44.50GiB path /dev/sdc1 | |
devid 3 size 2.73TiB used 44.50GiB path /dev/sdd1 | |
devid 4 size 2.73TiB used 44.50GiB path /dev/sde1 | |
9. | |
set label | |
# btrfs fi label /storage storage | |
10. | |
fix /etc/fstab, use UUID= to mount (you can check UUIDs with # blkid) | |
remove mdadm from autostart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment