ubuntu-raid1-conversion
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ubuntu-raid1-conversion [2009/10/29 15:28] – snarg | ubuntu-raid1-conversion [2009/10/30 17:46] (current) – snarg | ||
---|---|---|---|
Line 1: | Line 1: | ||
=====Converting a single disk Ubuntu system to RAID1 (adding a second disk)===== | =====Converting a single disk Ubuntu system to RAID1 (adding a second disk)===== | ||
===Created for Phil, using Ubuntu 9.10 Karmic Koala=== | ===Created for Phil, using Ubuntu 9.10 Karmic Koala=== | ||
- | This Procedure will take a standard install of Ubuntu, and mirror it to a spare hard disk, forming a RAID-1 array. Ubuntu by default on a standard install has 2 partitions. One for the root (/) filesystem and one for swap space. This procedure sets up individual raid arrays for each of these (root filesystem and swap). This procedure makes heavy use of the linux shell (terminal). In Ubuntu you can load a terminal from the Applications menu, under Accessories. | + | This Procedure will take a standard install of Ubuntu, and mirror it to a spare hard disk, forming a RAID-1 array. Ubuntu by default on a standard install has 2 partitions. One for the root (/) filesystem and one for swap space. This procedure sets up individual raid arrays for each of these (root filesystem and swap). This procedure makes heavy use of the linux shell (terminal). In Ubuntu you can load a terminal from the Applications menu, under Accessories. |
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | {{: | ||
==1. Determine device names to be used in the procedure.== | ==1. Determine device names to be used in the procedure.== | ||
Line 20: | Line 24: | ||
Command (m for help): p | Command (m for help): p | ||
- | Disk / | + | Disk / |
- | 255 heads, 63 sectors/ | + | 255 heads, 63 sectors/ |
Units = cylinders of 16065 * 512 = 8225280 bytes | Units = cylinders of 16065 * 512 = 8225280 bytes | ||
Disk identifier: 0xeea1cf79 | Disk identifier: 0xeea1cf79 | ||
Line 210: | Line 214: | ||
</ | </ | ||
Now go back to the original terminal window and type: | Now go back to the original terminal window and type: | ||
+ | < | ||
sudo nano / | sudo nano / | ||
</ | </ | ||
Line 225: | Line 230: | ||
Use CTRL+W to save the fstab and exit nano text file editor. | Use CTRL+W to save the fstab and exit nano text file editor. | ||
- | ==12. Adjust UUID in / | + | ==12. Adjust UUID in / |
This step will cause the bootloader to load up using the raid array (/dev/md0) instead of the old drive (/ | This step will cause the bootloader to load up using the raid array (/dev/md0) instead of the old drive (/ | ||
< | < | ||
Line 270: | Line 275: | ||
Using the fdisk commands (which should be familiar by now), change the partition types labels, then save and exit: | Using the fdisk commands (which should be familiar by now), change the partition types labels, then save and exit: | ||
< | < | ||
+ | Command (m for help): t | ||
+ | Partition number (1-5): 1 | ||
+ | Hex code (type L to list codes): fd | ||
+ | Changed system type of partition 1 to fd (Linux raid autodetect) | ||
+ | |||
+ | Command (m for help): t | ||
+ | Partition number (1-5): 5 | ||
+ | Hex code (type L to list codes): fd | ||
+ | Changed system type of partition 5 to fd (Linux raid autodetect) | ||
+ | |||
+ | Command (m for help): p | ||
+ | |||
+ | Disk /dev/sda: 40.0 GB, 40020664320 bytes | ||
+ | 255 heads, 63 sectors/ | ||
+ | Units = cylinders of 16065 * 512 = 8225280 bytes | ||
+ | Disk identifier: 0xdcf4dcf4 | ||
+ | |||
+ | | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | |||
+ | Command (m for help): w | ||
+ | The partition table has been altered! | ||
+ | |||
+ | Calling ioctl() to re-read partition table. | ||
+ | |||
+ | WARNING: Re-reading the partition table failed with error 16: Device or resource | ||
+ | busy. | ||
+ | The kernel still uses the old table. The new table will be used at | ||
+ | the next reboot or after you run partprobe(8) or kpartx(8) | ||
+ | Syncing disks. | ||
</ | </ | ||
==15. Add old drive root partition to the new root array - making it redundant.== | ==15. Add old drive root partition to the new root array - making it redundant.== | ||
+ | This is a one-liner: | ||
+ | < | ||
+ | sudo mdadm --manage /dev/md0 --add /dev/sda1 | ||
+ | </ | ||
==16. Add the second member (first drive) of the swap array, making it redundant.== | ==16. Add the second member (first drive) of the swap array, making it redundant.== | ||
- | ==17. Watch some rebuild stats. | + | Also a one-liner: |
+ | < | ||
+ | sudo mdadm --manage /dev/md1 --add /dev/sda5 | ||
+ | </ | ||
+ | ==17. Watch some rebuild stats. | ||
+ | Type "cat / | ||
+ | |||
+ | < | ||
+ | $ cat / | ||
+ | Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] | ||
+ | md1 : active raid1 sda5[2] sdb5[0] | ||
+ | 1493888 blocks [2/1] [U_] | ||
+ | resync=DELAYED | ||
+ | | ||
+ | md0 : active raid1 sda1[2] sdb1[0] | ||
+ | 37583936 blocks [2/1] [U_] | ||
+ | [> | ||
+ | | ||
+ | unused devices: < | ||
+ | </ | ||
+ | |||
+ | ==18. Final update to the bootloader to account for the first drive being changed.== | ||
+ | Use nano to edit your / | ||
+ | < | ||
+ | sudo nano / | ||
+ | </ | ||
+ | And make sure it looks like this: (note this should be the same as your bios hard disk boot order) | ||
+ | < | ||
+ | (hd0) / | ||
+ | (hd1) / | ||
+ | </ | ||
+ | Type this to finalise the bootloader config and Master Boot Record on both hard disks: | ||
+ | < | ||
+ | sudo update-grub | ||
+ | sudo grub-install /dev/sda | ||
+ | sudo grub-install /dev/sdb | ||
+ | </ | ||
+ | \\ | ||
+ | ALL DONE!! | ||
+ | \\ | ||
+ | update- 20091030 - Please note that at time of writing there is a bug in GRUB 1.97 which causes a boot delay of about 10-20 seconds for boot partitions on RAID-1. This is a known problem and is being worked on. Please see: [[https:// |
ubuntu-raid1-conversion.1256801287.txt.gz · Last modified: 2009/10/29 15:28 by snarg