Quote:
1. Most tutorials speak about setting up only one partition on clean drives. Can I set up more than one (e.g. / and home) to be mirrored as two partitions?
|
Yes, you can set up more than one partition on a disk as a RAID1 device.
Quote:
2. When starting with two identical clean drives, do I need to set up my partitions identically on both drives or is it only the partitions that I want mirrored to the second drive?
|
By this I think you are asking if the drives need to be partitioned identically. The answer is 'no'.
You can set up just the RAID partitions on the second drive, if you wish, omitting non-RAID partitions. What is more important is that the sizes of the partitions that are "paired" are "nearly identical".
You actually can set up a RAID1 array with a device missing (drive or partition) and then add the missing device later just as long as it is large enough.
Here is an example multiple partitions as described in your first question. It has worked flawlessly. (Actually saving me when the devices were flaky before I updated the firmware on them.) Mine are set up identically but they do not need to be, just as long as the sizes correspond.
Code:
[root@athlonz ~]# fdisk -l
Disk /dev/sda: 1500.3 GB, 1500300828160 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00031558
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 3126 25005172+ fd Linux raid autodetect
/dev/sda3 3127 182401 1440026437+ 5 Extended
/dev/sda5 3127 182401 1440026406 fd Linux raid autodetect
Disk /dev/sdb: 500.1 GB, 500130372608 bytes
255 heads, 63 sectors/track, 60804 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 1500.3 GB, 1500300828160 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0002a7c0
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 13 104391 83 Linux
/dev/sdc2 14 3126 25005172+ fd Linux raid autodetect
/dev/sdc3 3127 182401 1440026437+ 5 Extended
/dev/sdc5 3127 182401 1440026406 fd Linux raid autodetect
[root@athlonz ~]#
[root@athlonz ~]# cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4]
md1 : active raid1 sda5[0] sdc5[1]
1440026304 blocks [2/2] [UU]
md0 : active raid1 sda2[0] sdc2[1]
25005056 blocks [2/2] [UU]
unused devices: <none>
[root@athlonz ~]#
Creating an array with a missing device is quite easy.
Code:
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 missing
echo 'DEVICE /dev/hd*[0-9] /dev/sd*[0-9]' > /etc/mdadm.conf
mdadm --detail --scan >> /etc/mdadm.conf
Adding the missing device is done like this.
Code:
mdadm --manage /dev/md0 --add /dev/sdb1
If the RAID device is defined in '/etc/mdadm.conf' with UUID you are done; if the underlying block devices are explicitly specified, you need to change the 'missing' to the newly added device.
Hope this helps.