wiki/help/linux/tool/Mdadm.md

24 lines
1.4 KiB
Markdown
Raw Normal View History

mdadm
=====
Glossary:
* md: multiple devices
| command | description |
|---------|-------------|
| `cat /proc/mdstat` | show status of all raids |
| `mdadm --detail /dev/md0` | detailed status of raid md0 |
| `mdadm --create /dev/md0 -n2 -l1 /dev/sda1 /dev/sdb1` | new raid `/dev/md0` with 2 disks, raid level 1 on `/dev/sda1` and `/dev/sda2`
| `mdadm --fail /dev/md0 /dev/sda1 ; mdadm --remove /dev/md0 /dev/sda1` | remove `/dev/sda1` from `/dev/md0`
| `mdadm --add /dev/md0 /dev/sda1` | add `/dev/sda1` to `/dev/md0`
| `mdadm --grow /dev/md0 -n3` | use 3 disks in raid `/dev/md0` (e.g. add an additional disk, so a damaged drive can be removed later-on)
| `mdadm --assemble /dev/md0` | Assemble `/dev/md0` (e.g. when running live system)
| `mdadm --detail --scan >> /etc/mdadm/mdadm.conf` | Update list of arrays in `/etc/mdadm/mdadm.conf` ; you should remove old list by hand first!
| `mdadm --examine /dev/sda1` | What is this disk / partition?
| `sysctl -w dev.raid.speed_limit_min=10000` | Set minimum raid rebuilding speed to 10000 kiB/s (default 1000)
| <code>sfdisk -d /dev/sdX &#124; sfdisk /dev/sdY</code> | Copy partition table from sdX to sdY (MBR only)
| `sgdisk /dev/sdX -R /dev/sdY ; sgdisk -G /dev/sdY` | Copy partition table from sdX to sdY (GPT)
* To boot a machine even with a degraded array, modify `/etc/initramfs-tools/conf.d/mdadm` and run `update-initramfs -c -kall` (Use with caution!)