Madadm-notes: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
All the damn details of mdadm that you can never remember when a !@#$!#@ drive dies | ==All the damn details of mdadm that you can never remember when a !@#$!#@ drive dies== | ||
* [https://www.thomas-krenn.com/en/wiki/Mdadm_recovery_and_resync|mdadm resync] | * [https://www.thomas-krenn.com/en/wiki/Mdadm_recovery_and_resync|mdadm resync] | ||
* [https://www.howtoforge.com/replacing_hard_disks_in_a_raid1_array|replace disks RAID1 array] | * [https://www.howtoforge.com/replacing_hard_disks_in_a_raid1_array|replace disks RAID1 array] | ||
* [https://www.storagetutorials.com/how-to-create-partition-raid-linux-unix/|Partitioning examples] | * [https://www.storagetutorials.com/how-to-create-partition-raid-linux-unix/|Partitioning examples] | ||
* [https://www.digitalocean.com/community/tutorials/how-to-create-raid-arrays-with-mdadm-on-ubuntu|Raid 1 on Ubuntu] | |||
Changing partition types | ==Changing partition types== | ||
* [https://unix.stackexchange.com/questions/593681/changing-label-type-in-arch-linux-cfdisk|cfdisk examples] | * [https://unix.stackexchange.com/questions/593681/changing-label-type-in-arch-linux-cfdisk|cfdisk examples] | ||
sfdisk can mirror two disks (usually) so that you can rebuild quickly.. | ==sfdisk can mirror two disks (usually) so that you can rebuild quickly..== | ||
* [https://www.thegeekstuff.com/2017/05/sfdisk-examples/|sfdisk examples] | * [https://www.thegeekstuff.com/2017/05/sfdisk-examples/|sfdisk examples] | ||
* [https://vsido.org/index.php?topic=214.0|Cylinder boundary issues] | * [https://vsido.org/index.php?topic=214.0|Cylinder boundary issues] | ||
Line 13: | Line 14: | ||
there are ways to do this as a single command with pipes, but it sucks and does not always create the partitions correctly.. | there are ways to do this as a single command with pipes, but it sucks and does not always create the partitions correctly.. | ||
safer way: (Assuming sdb is toast) | ==safer way: (Assuming sdb is toast)== | ||
# sfdisk -d /dev/sda > sda.out | # sfdisk -d /dev/sda > sda.out | ||
# sfdisk /dev/sdb < sda.out | # sfdisk /dev/sdb < sda.out | ||
# sfdisk -l | # sfdisk -l | ||
==Quick and dirty, change drive letter as needed:== | |||
* sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda /dev/sdb | |||
* cat /proc/mdstat (wait until synced) | |||
* sudo mkfs.ext4 -F /dev/md0 | |||
* sudo mkdir -p /mnt/md0 | |||
* sudo mount /dev/md0 /mnt/md0 | |||
* df -h -x devtmpfs -x tmpfs | |||
* sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf | |||
* sudo update-initramfs -u | |||
* echo '/dev/md0 /mnt/md0 ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab | |||
[[Category:RAID]] | [[Category:RAID]] |
Latest revision as of 10:50, 26 November 2024
All the damn details of mdadm that you can never remember when a !@#$!#@ drive dies
Changing partition types
sfdisk can mirror two disks (usually) so that you can rebuild quickly..
there are ways to do this as a single command with pipes, but it sucks and does not always create the partitions correctly..
safer way: (Assuming sdb is toast)
- sfdisk -d /dev/sda > sda.out
- sfdisk /dev/sdb < sda.out
- sfdisk -l
Quick and dirty, change drive letter as needed:
- sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda /dev/sdb
- cat /proc/mdstat (wait until synced)
- sudo mkfs.ext4 -F /dev/md0
- sudo mkdir -p /mnt/md0
- sudo mount /dev/md0 /mnt/md0
- df -h -x devtmpfs -x tmpfs
- sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
- sudo update-initramfs -u
- echo '/dev/md0 /mnt/md0 ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab