This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
computing:storage:linux_software_raid [2011/11/27 10:28] gcooper created |
computing:storage:linux_software_raid [2019/10/25 10:42] (current) gcooper |
||
---|---|---|---|
Line 2: | Line 2: | ||
http:// | http:// | ||
+ | |||
http:// | http:// | ||
+ | |||
http:// | http:// | ||
+ | |||
https:// | https:// | ||
+ | |||
http:// | http:// | ||
Works on block devices, usually partitions. | Works on block devices, usually partitions. | ||
- | **Show Existing RAID** | + | ===== Show Existing RAID ===== |
- | mdadm --detail --scan | + | < |
+ | mdadm --detail --scan | ||
+ | </ | ||
- | **Partitioning** | + | ===== Partitioning |
- | '' | + | < |
- | '' | + | fdisk -l /dev/sda |
- | Using fdisk, create matching partitions on various drives (block devices) of type " | + | </ |
- | '' | + | |
- | sfdisk | + | |
- | Disk / | + | 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. | ||
+ | |||
+ | < | ||
+ | sfdisk -l /dev/sda | ||
+ | |||
+ | Disk /dev/sda: 8942 cylinders, 255 heads, 63 sectors/ | ||
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0 | Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0 | ||
- | Device Boot Start | + | Device |
- | /dev/sda1'''' | + | / |
- | /dev/sda2'''' | + | / |
- | /dev/sda3'''' | + | / |
+ | </ | ||
- | '' | + | :!: Be careful not to write to the **wrong disk** or you will have a **very bad day**! |
- | '' | + | |
- | sfdisk -d / | + | |
- | **Create Arrays** | + | Once you partition the first drive, use '' |
+ | |||
+ | < | ||
+ | sfdisk -d /dev/sda | sfdisk /dev/sdb | ||
+ | </ | ||
+ | |||
+ | or | ||
+ | |||
+ | < | ||
+ | sgdisk /dev/sda -R /dev/sdb | ||
+ | sgdisk -G /dev/sdb | ||
+ | </ | ||
+ | |||
+ | ===== Create Arrays | ||
http:// | http:// | ||
+ | |||
http:// | http:// | ||
+ | < | ||
mdadm --create < | mdadm --create < | ||
+ | </ | ||
- | 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 | ||
mdadm --add /dev/md1 /dev/sdb2 | mdadm --add /dev/md1 /dev/sdb2 | ||
mdadm --add /dev/md2 /dev/sdb3 | mdadm --add /dev/md2 /dev/sdb3 | ||
+ | </ | ||
- | **Create | + | ===== Create |
+ | Not sure how beneficial or necessary this step is... | ||
+ | |||
+ | < | ||
mdadm --detail --scan > / | mdadm --detail --scan > / | ||
+ | </ | ||
- | or (Centos) | + | or for Centos: |
+ | < | ||
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) | ||
+ | </ | ||
- | Last changed (in Tomboy): 2011-05-02 | ||
- | Note created (in Tomboy): 2010-12-18 | ||