7 Preparing /dev/sda
If all goes well, you should now find /dev/md0 and /dev/md2 in the output of
df -h
root@server1:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md2 4.0G 815M 3.0G 22% /
none 243M 192K 243M 1% /dev
none 247M 0 247M 0% /dev/shm
none 247M 40K 247M 1% /var/run
none 247M 0 247M 0% /var/lock
none 247M 0 247M 0% /lib/init/rw
none 4.0G 815M 3.0G 22% /var/lib/ureadahead/debugfs
/dev/md0 472M 27M 421M 6% /boot
root@server1:~#
The output of
cat /proc/mdstat
should be as follows:
root@server1:~# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sdb1[1]
498624 blocks [2/1] [_U]
md1 : active raid1 sdb2[1]
499648 blocks [2/1] [_U]
md2 : active raid1 sdb3[1]
4242368 blocks [2/1] [_U]
unused devices: <none>
root@server1:~#
Now we must change the partition types of our three partitions on /dev/sda to Linux raid autodetect as well:
fdisk /dev/sda
root@server1:~# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): <-- t
Partition number (1-4): <-- 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-4): <-- 2
Hex code (type L to list codes): <-- fd
Changed system type of partition 2 to fd (Linux raid autodetect)
Command (m for help): <-- t
Partition number (1-4): <-- 3
Hex code (type L to list codes): <-- fd
Changed system type of partition 3 to fd (Linux raid autodetect)
Command (m for help): <-- w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
root@server1:~#
Now we can add /dev/sda1, /dev/sda2, and /dev/sda3 to the respective RAID arrays:
mdadm --add /dev/md0 /dev/sda1
mdadm --add /dev/md1 /dev/sda2
mdadm --add /dev/md2 /dev/sda3
Now take a look at
cat /proc/mdstat
... and you should see that the RAID arrays are being synchronized:
root@server1:~# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sda1[0] sdb1[1]
498624 blocks [2/2] [UU]
md1 : active raid1 sda2[2] sdb2[1]
499648 blocks [2/1] [_U]
resync=DELAYED
md2 : active raid1 sda3[2] sdb3[1]
4242368 blocks [2/1] [_U]
[===========>.........] recovery = 55.1% (2338176/4242368) finish=0.3min speed=83506K/sec
unused devices: <none>
root@server1:~#
(You can run
watch cat /proc/mdstat
to get an ongoing output of the process. To leave watch, press CTRL+C.)
Wait until the synchronization has finished (the output should then look like this:
root@server1:~# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sda1[0] sdb1[1]
498624 blocks [2/2] [UU]
md1 : active raid1 sda2[0] sdb2[1]
499648 blocks [2/2] [UU]
md2 : active raid1 sda3[0] sdb3[1]
4242368 blocks [2/2] [UU]
unused devices: <none>
root@server1:~#
).
Then adjust /etc/mdadm/mdadm.conf to the new situation:
cp /etc/mdadm/mdadm.conf_orig /etc/mdadm/mdadm.conf
mdadm --examine --scan >> /etc/mdadm/mdadm.conf
/etc/mdadm/mdadm.conf should now look something like this:
cat /etc/mdadm/mdadm.conf
# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#
# by default, scan all partitions (/proc/partitions) for MD superblocks.
# alternatively, specify devices to scan, using wildcards if desired.
DEVICE partitions
# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes
# automatically tag new arrays as belonging to the local system
HOMEHOST <system>
# instruct the monitoring daemon where to send mail alerts
MAILADDR root
# definitions of existing MD arrays
# This file was auto-generated on Mon, 21 Jun 2010 13:21:00 +0200
# by mkconf $Id$
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=68686c40:b924278e:325ecf68:79913751
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=9719181e:3071f655:325ecf68:79913751
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=c3360f0f:7f3d47ec:325ecf68:79913751
|
8 Preparing GRUB2 (Part 2)
Now we delete /etc/grub.d/09_swraid1_setup...
rm -f /etc/grub.d/09_swraid1_setup
... and update our GRUB2 bootloader configuration:
update-grub
update-initramfs -u
Now if you take a look at /boot/grub/grub.cfg, you should find that the menuentry stanzas in the ### BEGIN /etc/grub.d/10_linux ### section look pretty much the same as what we had in /etc/grub.d/09_swraid1_setup (they should now also be set to boot from /dev/md0 instead of (hd0,1) or (hd1,1)), that's why we don't need /etc/grub.d/09_swraid1_setup anymore.
Reboot the system:
reboot
It should boot without problems.
That's it - you've successfully set up software RAID1 on your running Ubuntu 10.04 system!
How To Set Up Software RAID1 On A Running System (Incl. GRUB2 Configuration) (Ubuntu 10.04) - Page 2
How To Set Up Software RAID1 On A Running System (Incl. GRUB2 Configuration) (Ubuntu 10.04) - Page 4
Recent comments
2 days 12 hours ago
2 days 21 hours ago
3 days 4 min ago
3 days 1 hour ago
3 days 2 hours ago
3 days 4 hours ago
3 days 5 hours ago
3 days 7 hours ago
3 days 23 hours ago
3 days 23 hours ago