一步步做raid5+lvm实验.docx

上传人:b****8 文档编号:9851634 上传时间:2023-02-07 格式:DOCX 页数:11 大小:18.32KB
下载 相关 举报
一步步做raid5+lvm实验.docx_第1页
第1页 / 共11页
一步步做raid5+lvm实验.docx_第2页
第2页 / 共11页
一步步做raid5+lvm实验.docx_第3页
第3页 / 共11页
一步步做raid5+lvm实验.docx_第4页
第4页 / 共11页
一步步做raid5+lvm实验.docx_第5页
第5页 / 共11页
点击查看更多>>
下载资源
资源描述

一步步做raid5+lvm实验.docx

《一步步做raid5+lvm实验.docx》由会员分享,可在线阅读,更多相关《一步步做raid5+lvm实验.docx(11页珍藏版)》请在冰豆网上搜索。

一步步做raid5+lvm实验.docx

一步步做raid5+lvm实验

一步步做raid5+lvm实验

实验目的:

1。

将sdb,sdc,sdd3块硬盘组成raid5模式

2。

建立LVM

3。

模拟故障,sdc出故障,删除该硬盘,再重新添加硬盘,恢复raid5

4。

增加LVM容量

实验步骤

1,格式化3块硬盘 

[root@RHEL5-1~]# fdisk/dev/sdb //格式化/dev/sdb

DevicecontainsneitheravalidDOSpartitiontable,norSun,SGIorOSFdisklabel 

BuildinganewDOSdisklabel.Changeswillremaininmemoryonly, 

untilyoudecidetowritethem.Afterthat,ofcourse,theprevious 

contentwon'tberecoverable.

Warning:

invalidflag0x0000ofpartitiontable4willbecorrectedbyw(rite)

Command(mforhelp):

 n //增加一个新的分区

Commandaction 

  e  extended 

  p  primarypartition(1-4) 

p //创建主分区

Partitionnumber(1-4):

 1 //分区号为1

Firstcylinder(1-130,default1):

 //设置分区大小

Usingdefaultvalue1 

Lastcylinderor+sizeor+sizeMor+sizeK(1-130,default130):

 

Usingdefaultvalue130

Command(mforhelp):

 t   //改变系统的ID

Selectedpartition1 

Hexcode(typeLtolistcodes):

 fd //设置系统HEX为fd,即raid模式

Changedsystemtypeofpartition1tofd(Linuxraidautodetect)

Command(mforhelp):

 w //保存

Thepartitiontablehasbeenaltered!

Callingioctl()tore-readpartitiontable. 

Syncingdisks. 

[root@RHEL5-1~]# fdisk/dev/sdc //格式化/dev/sdc

DevicecontainsneitheravalidDOSpartitiontable,norSun,SGIorOSFdisklabel 

BuildinganewDOSdisklabel.Changeswillremaininmemoryonly, 

untilyoudecidetowritethem.Afterthat,ofcourse,theprevious 

contentwon'tberecoverable.

Warning:

invalidflag0x0000ofpartitiontable4willbecorrectedbyw(rite)

Command(mforhelp):

 n 

Commandaction 

  e  extended 

  p  primarypartition(1-4) 

Partitionnumber(1-4):

 1 

Firstcylinder(1-130,default1):

 

Usingdefaultvalue1 

Lastcylinderor+sizeor+sizeMor+sizeK(1-130,default130):

 

Usingdefaultvalue130

Command(mforhelp):

 t 

Selectedpartition1 

Hexcode(typeLtolistcodes):

 fd 

Changedsystemtypeofpartition1tofd(Linuxraidautodetect)

Command(mforhelp):

 w 

Thepartitiontablehasbeenaltered!

Callingioctl()tore-readpartitiontable. 

Syncingdisks. 

[root@RHEL5-1~]# fdisk/dev/sdd  //格式化/dev/sdd

DevicecontainsneitheravalidDOSpartitiontable,norSun,SGIorOSFdisklabel 

BuildinganewDOSdisklabel.Changeswillremaininmemoryonly, 

untilyoudecidetowritethem.Afterthat,ofcourse,theprevious 

contentwon'tberecoverable.

Warning:

invalidflag0x0000ofpartitiontable4willbecorrectedbyw(rite)

Command(mforhelp):

 n 

Commandaction 

  e  extended 

  p  primarypartition(1-4) 

Partitionnumber(1-4):

 1 

Firstcylinder(1-130,default1):

 

Usingdefaultvalue1 

Lastcylinderor+sizeor+sizeMor+sizeK(1-130,default130):

 

Usingdefaultvalue130

Command(mforhelp):

 t 

Selectedpartition1 

Hexcode(typeLtolistcodes):

 fd 

Changedsystemtypeofpartition1tofd(Linuxraidautodetect)

Command(mforhelp):

 w 

Thepartitiontablehasbeenaltered!

Callingioctl()tore-readpartitiontable. 

Syncingdisks. 

[root@RHEL5-1~]# fdisk-l  //查看分区情况

Disk/dev/sda:

8589MB,8589934592bytes 

255heads,63sectors/track,1044cylinders 

Units=cylindersof16065*512=8225280bytes

  DeviceBoot     Start        End     Blocks  Id System 

/dev/sda1  *          1         13     104391  83 Linux 

/dev/sda2             14        268    2048287+ 83 Linux 

/dev/sda3            269        395    1020127+ 83 Linux 

/dev/sda4            396       1044    5213092+  5 Extended 

/dev/sda5            396        522    1020096  82 Linuxswap/Solaris 

/dev/sda6            523       1044    4192933+ 83 Linux

Disk/dev/sdb:

1073MB,1073741824bytes 

255heads,63sectors/track,130cylinders 

Units=cylindersof16065*512=8225280bytes

  DeviceBoot     Start        End     Blocks  Id System 

/dev/sdb1              1        130    1044193+ fd Linuxraidautodetect

Disk/dev/sdc:

1073MB,1073741824bytes 

255heads,63sectors/track,130cylinders 

Units=cylindersof16065*512=8225280bytes

  DeviceBoot     Start        End     Blocks  Id System 

/dev/sdc1              1        130    1044193+ fd Linuxraidautodetect

Disk/dev/sdd:

1073MB,1073741824bytes 

255heads,63sectors/track,130cylinders 

Units=cylindersof16065*512=8225280bytes

  DeviceBoot     Start        End     Blocks  Id System 

/dev/sdd1              1        130    1044193+ fd Linuxraidautodetect

 建立raid5

[root@RHEL5-1~]# mdadm--create/dev/md0--level=5--raid-device=3/dev/sdb1/d 

ev/sdc1/dev/sdd1  //创建raid5,/dev/md0阵列设备名,level=5阵列模式raid5,raid-device=3raid有3块硬盘

mdadm:

array/dev/md0started. 

[root@RHEL5-1~]# cat/proc/mdstat  //查看数据同步情况

Personalities:

[raid6][raid5][raid4] 

md0:

activeraid5sdd1[3]sdc1[1]sdb1[0] 

     2088192blockslevel5,64kchunk,algorithm2[3/2][UU_] 

     [========>............] recovery=40.0%(419060/1044096)finish=1.4minspeed=7423K/sec 

unuseddevices:

 

[root@RHEL5-1~]# cat/proc/mdstat   //看到这个说明同步结束

Personalities:

[raid6][raid5][raid4] 

md0:

activeraid5sdd1[2]sdc1[1]sdb1[0] 

     2088192blockslevel5,64kchunk,algorithm2[3/3][UUU] 

unuseddevices:

 

[root@RHEL5-1~]# tail/var/log/messages  //查看系统日志

Jun 111:

34:

10RHEL5-1kernel:

md:

syncingRAIDarraymd0 

Jun 111:

34:

13RHEL5-1kernel:

md:

minimum_guaranteed_reconstructionspeed:

1000KB/sec/disc. 

Jun 111:

34:

15RHEL5-1kernel:

md:

usingmaximumavailableidleIObandwidth(butnotmorethan200000KB/sec)forreconstruction. 

Jun 111:

34:

19RHEL5-1kernel:

md:

using128kwindow,overatotalof1044096blocks. 

Jun 111:

36:

01RHEL5-1kernel:

md:

md0:

syncdone. 

Jun 111:

36:

01RHEL5-1kernel:

RAID5confprintout:

 

Jun 111:

36:

01RHEL5-1kernel:

 ---rd:

3wd:

3fd:

Jun 111:

36:

01RHEL5-1kernel:

 disk0,o:

1,dev:

sdb1 

Jun 111:

36:

01RHEL5-1kernel:

 disk1,o:

1,dev:

sdc1 

Jun 111:

36:

01RHEL5-1kernel:

 disk2,o:

1,dev:

sdd1

建立raid5的配置文件

[root@RHEL5-1~]# echodevice/dev/sdb1/dev/sdc1/dev/sdd1>/etc/mdadm.conf 

[root@RHEL5-1~]# mdadm--detail--scan >>/etc/mdadm.conf 

[root@RHEL5-1~]# cat/etc/mdadm.conf 

device/dev/sdb1/dev/sdc1/dev/sdd1 

ARRAY/dev/md0level=raid5num-devices=3UUID=36f261b7:

4899a54c:

9edf36d1:

9eb86529 

[root@RHEL5-1~]# mdadm-S/dev/md0  //停止阵列

mdadm:

stopped/dev/md0 

[root@RHEL5-1~]# mdadm-As/dev/md0  //启动阵列

mdadm:

/dev/md0hasbeenstartedwith3drives.

2建立LVM

[root@RHEL5-1~]# pvcreate/dev/md0 //建立PV

 Physicalvolume"/dev/md0"successfullycreated 

[root@RHEL5-1~]# vgcreatelvm1/dev/md0  //建立VG

 Volumegroup"lvm1"successfullycreated 

[root@RHEL5-1~]# vgdisplay  //查看VG

  ---Volumegroup--- 

 VGName              lvm1 

 SystemID             

 Format               lvm2 

 MetadataAreas       1 

 MetadataSequenceNo 1 

 VGAccess            read/write 

 VGStatus            resizable 

 MAXLV               0 

 CurLV               0 

 OpenLV              0 

 MaxPV               0 

 CurPV               1 

 ActPV               1 

 VGSize              1.99GB 

 PESize              4.00MB 

 TotalPE             509 

 AllocPE/Size      0/0   

 Free PE/Size      509/1.99GB 

 VGUUID              h7d74U-S38z-rQrw-ecGG-ePlg-48b5-87sbC1 

[root@RHEL5-1~]# lvcreate-L500m-nweb1lvm1 //建立LV,名为web1,大小为500M

 Logicalvolume"web1"created 

[root@RHEL5-1~]# lvcreate-L500m-nweb2lvm1  //建立LV,名为web2,大小为500M

Logicalvolume"web2"created 

[root@RHEL5-1~]# mke2fs-j/dev/lvm1/web1  //格式化web1

mke2fs1.39(29-May-2006) 

Filesystemlabel= 

OStype:

Linux 

Blocksize=1024(log=0) 

Fragmentsize=1024(log=0) 

128016inodes,512000blocks 

25600blocks(5.00%)reservedforthesuperuser 

Firstdatablock=1 

Maximumfilesystemblocks=67633152 

63blockgroups 

8192blockspergroup,8192fragmentspergroup 

2032inodespergroup 

Superblockbackupsstoredonblocks:

 

       8193,24577,40961,57345,73729,204801,221185,401409

Writinginodetables:

done                            

Creatingjournal(8192blocks):

done 

Writingsuperblocksandfilesystemaccountinginformation:

done

Thisfilesystemwillbeautomaticallycheckedevery26mountsor 

180days,whichevercomesfirst. Usetune2fs-cor-itooverride. 

[root@RHEL5-1~]# mke2fs-j/dev/lvm1/web2  //格式化web1

mke2fs1.39(29-May-2006) 

Filesystemlabel= 

OStype:

Linux 

Blocksize=1024(log=0) 

Fragmentsize=1024(log=0) 

128016inodes,512000blocks 

25600blocks(5.00%)reservedforthesuperuser 

Firstdatablock=1 

Maximumfilesystemblocks=67633152 

63blockgroups 

8192blockspergroup,8192fragmentspergroup 

2032inodespergroup 

Superblockbackupsstoredonblocks:

 

       8193,24577,40961,57345,73729,204801,221185,401409

Writinginodetables:

done                            

Creatingjournal(8192blocks):

done 

Writingsuperblocksandfilesystemaccountinginformation:

done

Thisfilesystemwillbeautomaticallycheckedevery39mountsor 

180days,whichevercomesfirst. Usetune2fs-cor-itooverride. 

[root@RHEL5-1~]# mkdir/web1 

[root@RHEL5-1~]# mkdir/web2 

[root@RHEL5-1~]# mount/dev/lvm1/web1/web1    //挂载

[root@RHEL5-1~]# mount/dev/lvm1/web2/web2 

[root@RHEL5-1~]# vi/etc/fstab  //编辑/etc/fstab,让系统启动时自动挂载

LABEL=/                /                      ext3   defaults       11 

LABEL=/var             /var                   ext3   defaults       12 

LABEL=/tmp             /tmp                   ext3   defaults       12 

LABEL=/boot            /boot                  ext3   defaults       12 

tmpfs                  /dev/shm               tmpfs  defaults       00 

devpts                 /dev/pts               devpts gid=5,mode=620 00 

sysfs                  /sys          

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 其它模板

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1