This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
computing:storage:linux_software_raid [2011/11/27 10:34] gcooper |
computing:storage:linux_software_raid [2019/10/25 10:42] (current) gcooper |
||
---|---|---|---|
Line 16: | Line 16: | ||
< | < | ||
- | mdadm --detail --scan | + | mdadm --detail --scan |
</ | </ | ||
Line 22: | Line 22: | ||
< | < | ||
- | fdisk /dev/sda | + | fdisk -l /dev/sda |
</ | </ | ||
+ | |||
+ | or | ||
+ | |||
+ | < | ||
+ | sgdisk -p /dev/sda | ||
+ | </ | ||
+ | |||
+ | **Copy Patition Scheme**: https:// | ||
+ | |||
+ | :!: Verify '' | ||
Using fdisk, create matching partitions on various drives (block devices) of type **fd Linux raid autodetect** that will be assembled into arrays. | Using fdisk, create matching partitions on various drives (block devices) of type **fd Linux raid autodetect** that will be assembled into arrays. | ||
Line 39: | Line 49: | ||
</ | </ | ||
- | Once you partition the first drive, use sfdisk to duplicate | + | :!: Be careful not to write to the **wrong disk** or you will have a **very bad day**! |
+ | |||
+ | Once you partition the first drive, use '' | ||
+ | |||
+ | < | ||
+ | sfdisk -d /dev/sda | sfdisk /dev/sdb | ||
+ | </ | ||
+ | |||
+ | or | ||
< | < | ||
- | sfdisk -d / | + | sgdisk |
+ | sgdisk -G /dev/sdb | ||
</ | </ | ||
Line 55: | Line 74: | ||
</ | </ | ||
- | Here is a four-drive RAID5 example where one drive is a hot spare. | + | Here is a four-drive |
< | < | ||
mdadm --create /dev/md0 --level=5 --raid-devices=3 --spare-devices=1 --spare-group=groupname /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 | mdadm --create /dev/md0 --level=5 --raid-devices=3 --spare-devices=1 --spare-group=groupname /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 | ||
</ | </ | ||
- | |||
- | http:// | ||
===== Add a Drive ===== | ===== Add a Drive ===== | ||
+ | |||
+ | http:// | ||
< | < | ||
- | mdadm --detail --scan | + | mdadm --detail --scan |
mdadm --add /dev/md0 /dev/sdb1 | mdadm --add /dev/md0 /dev/sdb1 | ||
Line 86: | Line 105: | ||
mdadm --detail --scan --verbose > / | mdadm --detail --scan --verbose > / | ||
</ | </ | ||
+ | |||
+ | ===== MBR and GRUB ===== | ||
+ | |||
+ | ==== MBR ==== | ||
+ | |||
+ | http:// | ||
+ | |||
+ | Assuming you have identical disks with identical partitioning, | ||
+ | |||
+ | < | ||
+ | dd if=/dev/sda of=/dev/sdb bs=512 count=1 | ||
+ | </ | ||
+ | |||
+ | ==== GRUB ==== | ||
+ | |||
+ | http:// | ||
+ | |||
+ | < | ||
+ | grub | ||
+ | </ | ||
+ | |||
+ | If you have a separate /boot partition: | ||
+ | |||
+ | < | ||
+ | grub> find / | ||
+ | </ | ||
+ | |||
+ | If you don't: | ||
+ | |||
+ | < | ||
+ | grub> find / | ||
+ | </ | ||
+ | |||
+ | Then, based on the output of the find command: | ||
+ | |||
+ | < | ||
+ | grub> root (hd0,0) | ||
+ | grub> setup (hd2) | ||
+ | </ | ||
+ | |||
+ |