linux

linux

Senin, 26 Maret 2012

RAID SOFTWARE LINUX

Hemmm...This is only my note.....
create raid software in linux  with mdadm
with this mdadm i can create raid 0,1,10,and 5

prepare the disks,
command for create :
mdadm --create /dev/md0 --verbose --level=[level] --raid-devices=[number of disk] [member disk]
example:
mdadm --create /dev/md0 --verbose --level=raid1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm --create /dev/md0 --verbose --level=raid5 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1

command for state raid :
cat /proc/mdstat
mdadm --detail /dev/md0

example :
root@totok:~# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
md0 : active raid1 nbd1[1] nbd0[0]
1999936 blocks [2/2] [UU]
[=======>.............] resync = 38.7% (777152/1999936) finish=0.3min speed=59780K/sec

root@totok:/mnt# mdadm --detail /dev/md0
Version : 0.90
Creation Time : Sun Oct 31 19:53:26 2010
Raid Level : raid5
Array Size : 5860535808 (5589.04 GiB 6001.19 GB)
Used Dev Size : 1953511936 (1863.01 GiB 2000.40 GB)
Raid Devices : 4
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Sun Mar 27 21:18:45 2011
State : clean
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0

Layout : left-symmetric
Chunk Size : 64K

UUID : 829aacd2:bf52a9d7:f190e036:dc0a4837
Events : 0.36

Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1
2 8 33 2 active sync /dev/sdc1
3 8 49 3 active sync /dev/sdd1

 if one memberdisk on the array RAID is fail we can add the new member disk:
mdadm /dev/md0 -a /dev/sda1

this for boot loader  using lilo and grub :
===================
For LILO configuration:
 - When asked about LILO, choose the "simple" setup.
 - When asked about additional "append=" parameters, RAID 0 and
   RAID 5 users should type in "root=/dev/md0", to ensure that the proper
   array is mounted on / at bootup.
 - When asked about where to install LILO, choose MBR.
    Start by switching into your actual installation directory:
 - chroot /mnt

Let's make sure LILO boots from the RAID arrays properly.  Using your
favorite editor (vim/nano/pico), edit /etc/lilo.conf:
 - add a new line (add it anywhere, but don't indent it):
     raid-extra-boot = mbr-only
 - You will need to change the following line:
     boot = <something>
   RAID 0 and RAID 5 users, change it to:
     boot = /dev/md2
   RAID 1 users, change it to:
     boot = /dev/md0
 
 - Save the file and exit your editor.
 - run "lilo".
for Grub :
http://slackbuilds.org/repository/13.1/system/grub2/
download :ftp://alpha.gnu.org/gnu/grub/grub-1.98.tar.gz
          http://slackbuilds.org/slackbuilds/13.1/system/grub2.tar.gz

tar -xvf grub2.tar.gz
mv grub-1.98.tar.gz grub2/
cd grub2
./grub2.SlackBuild
cd /tmp
installpkg grub2-1.98-x86_64-2_SBo.tgz
cat /proc/mdstat
grub-install /dev/md0

berikut ini  pilihan bisa 2 cara :
1.grub-mkconfig -o /boot/grub/grub.cfg
  hasilnya masih kosong...
2.copy grub.cfg
  cp /usr/doc/grub2-1.98/grub.cfg /boot/grub2/
 
saya pilih yang no 2.
edit file grub.cfg jadi :
---------------------------------------------------------------
#
# Sample GRUB configuration file
#

# Boot automatically after 30 secs.
set timeout=10

# By default, boot the first entry.
set default=0

# Fallback to the second entry.
set fallback=1


# For booting GNU/Linux
menuentry "linuxslac_serever" {
        set root='(md0)'
        linux /boot/vmlinuz root=/dev/md0
        initrd
}

# Change the colors.
menuentry "Change the colors" {
        set menu_color_normal=light-green/brown
        set menu_color_highlight=red/blue
}

RAID 10
if you using raid 10 and the raid member are /dev/sda1,/dev/sdb1,/dev/sdc1,/dev/sdd1

for testting
if the fist fisical hdd remove from server the os still running and you can attach the new harddisk on server and then
check for new hdd with fdisk -l | grep dev
and compare with mdadm --detail /dev/md0
for new hdd
fdisk /dev/sdd  create for type is fd ( linux raid autodetect )

and then mdadm /dev/md0 -a /dev/sdd1

and you can see the /dev/md0 rebuild
if the system still rebuilding and you restart the server if the first hdd on bios is new hdd the system would not boot,
for boot up the system you must change the first bios for other old hdd.
when the system up the /dev/md0 will re-building from 0 % ( cat /proc/mdstat )

note : after replace with new disk you must type grub-install /dev/md0 to write
grub.conf to new disk

Tidak ada komentar:

Posting Komentar