Sunday, April 19, 2009

Implementing RAID in LINUX

Create a RAID Device /dev/md4 by creating equal two disks from available free space on your harddisk and mount it on /data. 


Let's say we have /dev/hdd as our added disk and we don't have extra harddisk.. becoz i am poor guy and i can't buy new disk during the current economic recession ;-)
I can create two partitions which can be treated as two disks for the RAID implementation.

Create the Two partitions having equal size.

Change the Partition ID to fd (Linux raid Autodetect)


#fdisk /dev/hdd
........
.........
/dev/hdd3            2001        2500      252000   fd  Linux raid autodetect
/dev/hdd4            2501        4161      837144    5  Extended
/dev/hdd5            2501        3000      251968+  fd  Linux raid autodetect
.......

Use partprobe command to synchronic the partition table. 

[root@localhost ~]# partprobe

[root@localhost ~]# mdadm --create /dev/md4 --level=1 --raid-devices=2 /dev/hdd3 /dev/hdd5
mdadm: array /dev/md4 started.

[root@localhost ~]# mkfs -t ext3 /dev/md4
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
62992 inodes, 251904 blocks
12595 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
31 block groups
8192 blocks per group, 8192 fragments per group
2032 inodes per group
Superblock backups stored on blocks: 
8193, 24577, 40961, 57345, 73729, 204801, 221185

Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


[root@localhost ~]# mkdir /data

[root@localhost ~]# cd /data
[root@localhost data]# ls
lost+found

(which implies that /dev/md4 is sucessfully mounted )

http://www.howtoforge.com/replacing_hard_disks_in_a_raid1_array





No comments:

Post a Comment