Posted by: kezhong | July 9, 2009

Installing Linux on Software RAID 1

When you setup a server for a critical application system, the reliability is your first consideration. You can imagine what will happen if the server can not boot due to disk failure. So your best choice is create RAID 1 for your operating system.

In my test, I installed Fedora 11 on software RAID1. The following is the steps.

Firstly, I created a new virtual machine with VMware Workstation 6.5. I set the size of disk to 8GB. After created, I added another disk which its size is the same with the previous using “Edit virtual machine settings”. I turned on the virtual machine, and started to install Fedora 11. During the installation, when I finished setting the root password, it asked me to partition the hard drive. I selected “Create custom layout”, and presses the “Next” button. It presented the below screen.
 r1

 

Create RAID 1 for the boot file system and SWAP
After I pressed the “RAID” button, it gave me display only the radio “Create a software RAID partition” was active. I clicked the “OK” button, it gave a new display. I selected the “sda”, “Fixed size”, “Force to be a primary partition” and inputted “200”  as below.

r2

Then I clicked the “OK” button, it presented the previous screen. Click the “RAID” button again, selected the “sdb”, “Fixed size”, “Force to be a primary partition” and inputted “200”.

After I finished creating the software RAID partition, I clicked the “RAID” button again; it gave me a form that only the radio “Create a RAID device” was active. Click the “OK” button. In the next form, select “/boot” in “Mount Point” field, and select both “sda1”  and ”sdb1” as below.
 r3

  
Click the “OK” button, and then the RAID device was created.

In the same way, I created the RAID device for the “SWAP”. Then I created a RAID device for “LVM” (select LVM in File System Type).

Create LVM on RAID 1 for the root file system
After the LVM RAID had been created, I clicked the “LVM” button to create a volume group for the root system.
 r4

  
After that, click the “Next” button to continue the installation.

 Enable both disks boot
After installation, I did the following to make the both disks bootable.
[joker@localhost ~]# grub
grub> root (hd0,0)
root (hd0,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd0)
setup (hd0)
 Checking if “/boot/grub/stage1” exists… no
 Checking if “/grub/stage1” exists… yes
 Checking if “/grub/stage2” exists… yes
 Checking if “/grub/e2fs_stage1_5 “ exists… yes
 Running “embed /grub/e2fs_stage1_5 (hd0)”… 28 sectors are embedded.
succeeded
 Running “install /grub/stage1 (hd0) (hd0)1+28 p
(hd0,0)/grub/stage2 /grub/grub.
conf”… succeeded
Done.
grub> root (hd1,0)
root (hd1,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd1)
setup (hd1)
 Checking if “/boot/grub/stage1” exists… no
 Checking if “/grub/stage1” exists… yes
 Checking if “/grub/stage2” exists… yes
 Checking if “/grub/e2fs_stage1_5 “ exists… yes
 Running “embed /grub/e2fs_stage1_5 (hd1)”… 28 sectors are embedded.
succeeded
 Running “install /grub/stage1 (hd1) (hd1)1+28 p (hd1,0)/grub/stage2 /grub/grub.
conf”… succeeded
Done. 

Verify
[joker@localhost ~]# df –Th
Filesystem       Type    Size      Used    Avail    Use%   Mounted on
/dev/mapper/rootvg-root
                        ext4      6.7G    3.1G    3.3G    49%     /
/dev/md0          ext3      194M   14M     170M   8%       /boot
…  … 

[joker@localhost ~]$ cat /proc/mdstat
Personalities: [raid1]
md0 :   active raid1 sda1[0] sdb1[1]
            204736 blocks [2/2] [UU]
md1 :   active raid1 sda2[0] sdb2[1]
            1048512 blocks [2/2] [UU]
md2 :   active raid1 sda3[0] sdb3[1]
            11325376 blocks [2/2] [UU]
unused devices: <none>

  

References
Installing GRUB natively


Responses

  1. […] See the original post here: Installing Linux on Software RAID 1 « Kezhong's Weblog […]

  2. Nice job. Perhaps a sidebar on how this all relates, but that is for newbes.

  3. Thanks, it’s really helpful… We’ve been studying Fedora 14 for quite sometime now and we’re one the “RAID” thing. I don’t really understand how it works at first though.. .

  4. it is really very useful in our studies especially that we are on our discussions about that RAID and i really don’t understand what it really means. so it relly help us a lot.

  5. It is really a nice job

  6. This Website si really helpful for a student like me…I just appreciate all the important stuffs in here, specifically the information given more about Linux…thank you…^_^

  7. The website is so significant for a student like….

  8. […] and if you are please share the link. I did, however, find one for Fedora 9 that worked perfectly, Kezhong’s Weblog* […]

  9. Debian installation with software Raid 1
    http://mikeoverip.wordpress.com/2009/12/07/debian-5-lenny-step-by-step-installation-with-software-raid-1-with-screenshots/


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: