Linux iscsi 挂载存储及扩容.docx

上传人:小飞机 文档编号:4886064 上传时间:2023-05-21 格式:DOCX 页数:9 大小:132.22KB
返回 下载 相关 举报
Linux iscsi 挂载存储及扩容.docx_第1页
第1页 / 共9页
Linux iscsi 挂载存储及扩容.docx_第2页
第2页 / 共9页
Linux iscsi 挂载存储及扩容.docx_第3页
第3页 / 共9页
Linux iscsi 挂载存储及扩容.docx_第4页
第4页 / 共9页
Linux iscsi 挂载存储及扩容.docx_第5页
第5页 / 共9页
亲,该文档总共9页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《Linux iscsi 挂载存储及扩容.docx》由会员分享,可在线阅读,更多相关《Linux iscsi 挂载存储及扩容.docx(9页珍藏版)》请在三一办公上搜索。

1、Linuxiscsi挂载硬盘及扩容、Linux iscsi挂载硬盘1.先在Equallogic存储上创建一个“testl” volume,大小为5G,如图所示:卧折岫咽施1IhiStLVolume t*t1Activities匚召B孙 H :孕空:由阳f:RI :三睥M:; 商,言异硕IL二 Si V4J.Ufl4 Cllya tLCaiE :. E伽也做极冲赦炉| JiCCftEE |5o.ipTfiDt50.plicatLOTiCflllCtL0Ti55ctwd.ijlfE CaduwcHotie |甄浊脾C Dtilineudurrit 岂mI I_hiriFJrifeiiTeCl*um

2、eu腿 的M借眺也V 1口 也*13(:渤堆:Vclunies j Gr a-urp lErffisirp I令-fi) Volmts fl UUM:fir 8 Eflpu- iti EfiflUi e- 6 igu职 旧同 IiulDDL 旧(IiulDD2I i ft ME5LM0L m 祗 T” wtsl!I袒I略YIM:6Vclunw# MndrlY meffirm.Clang.SelEH店 Sd 既gMMtypw# Detete vaLme CoFfrrl tDtenipigtg2.在Linux系统启动iscsi服务(若没有安装,则需先安装Iscsi Initator客户端),确保其

3、在运行状态,如所示:rootAnybackup03 -# service iscsi statusi scsid己死一, la pid文件.仍存 ErootAnybackup03 #rootttiAnybac kupOS = # se rvi ce i scsi starti scsid已死,fn pid走件缶左_飞查定g off netvjork shutdown. Start! ng i SCSI daemon : b角定口品.讶 置 i SCSI | | ,fj.i i scsi adm : Nq records found!E E .roottciAnybackup03 # 瓣root

4、Anybackup03 # service i scsi status i scsid (pid 4181)止右:以彳 rootAnybackupOB # |3.启动后,使用iscsiadm命令discovery划分给Linux系统的test1卷,如图所示:如上图所示,已经发现了 testl卷了。4,使用 iscsiadm -m node -T targetName -p ip:3260命令将 testl 卷连接起来,如图所示:Lciro in to il=a.cc: icthO. -arnet: ion. 20(ll-0i.ct.equj.llcqii:.*-5 2MdG-c3bCi7LdS

5、f-Sd6O&21Sad7S26cl-te5i:l, porial: 152.lk十e -n to ir-acc: ificfl?- tirw1:: inn.20O1-OE-.cor.aquiI logic:-2M7ldG+-Bd&nO215id752Bcl-rfl5T 1, pa-nl : 19Z.1&B. ID. lDr3ZEQ kQfin w ; HchOn 可#口 12041-45,:prwl:尊昉G-WLH网“ Lbfi ri i:#: 1 fJiEH2 ( -Earf : tc|n. ZMI -41*5 _-Ah. tqiia 11 ngi c :4-?2i6cK-c 2bG7Id

6、F -UG4G2 lHd723il-tA-i.tl r fd-rEA 1 :ID. lB132&Dj:rwtiSX-nbacli.iipOi -f备注:iscsiadm -m node -T iqn.2001-.equallogic:4-52aed6-c2b071d6f-8d600215ad7528c1-test1 -p192.168.10.10:3260 -l5. Fdisk-l发现了刚刚挂载的盘了 Disk /dev/sdb,如图所示:Disk / dev/sdb doesn 11 contai n a val i d parti ti on ta.bl eDisk /dev/sdc: |

7、5 379 Met 53 79194880 bytes 166 heads, 62 sectors/track, 1020 cylinders Units = cyli nders of 10292 * 512 = 5269504 bytes6.格式化分区Disk /dev/sdb,如图所示:rootAnybackup03 fdisk /dev/sdbDevice contains nei ther a valid dos partition tabla+ nor sun h SCI or OSF di sklaJbiel Bui Idli ng a new DOS di sklabel. C

8、hanges will remain in meoLD ry onl r until you dcito ivrits them. Afr th.t, of course, ths previous content wonJt be recoverable,Warning: i rival id flag 0x0000 of partition table 4 will be corrected Iby w(rite)comand (m for help) : n commaL-d acticine extended .p priioary parti11on (1-4)Partition n

9、umber (1-4): 1Fi cyli nder Cl-1020, default 1):Using ault vsiuc 1Last cylinder or tsize ar +sTzeu or +sizeK Cl-10201 default 1020):using default value 1020Conwand (m for help); wThe partition table has been altered!Cal ling icctl Q t:c re-read partition talkie.Sy tic i disks,roo tAn ybac kupO 37,使用m

10、kfs -t ext3命令将/dev/sdbl格式化成linux ext3格式文件,如图所 示:rootf&AnybackupOSmkfs -t ext3 /dev/sdbl mlce2f s 1.3 9 (29-May-2006)Fi 1 esystem 1abel =OS type : Lin uxBlock size=4096 (1Fracjment s,矣=4096 (locj=2) 657312 inodes, 1312222 blocks 65611 blocks (5.0馈reserved for the super user Fi rst data b 1 qcI=0Maxi

11、mum filesystem blQcks=134G3 7153441 block groups819200. S847363276S blocks per group, 3 2768 fragments per group 16032 i nodes per group superblock backups stored on blocks:32768, 93304: 1G3S40, 225376, 294912,Writi ng i node tablss: done,nfo rmati on : doneevery 21 mounts or -c r -i to overri de.Cr

12、esting journal (3 2768 blocks): done wri ti ng supe rblocks and filesystem accounti ngThi s filesystem hn11 be automat i cal 1y checked 180 days . rvti i cheve r comes f i rst. use tune2f s8.用tune2fs修改文件系统的属性,去掉自动检查的属性,如图所示:rootAnybackup03tune2fs -c 1 -i 0 /dev/sdbltune2fs 1.39 (29-May-2006)Setti ng

13、 maximal mount count to 1Setti ng interval between checks to 0 seconds rootAnybackup03 # 备注:Linux上的ext3文件系统有一个特性,对某个分区mount、umount很多 次后或者隔一个固定的时间后,系统会对该分区进行检测,这就会导致硬盘反映速 度很慢,影响业务,本操作的目的就是去掉文件系统自动检查的属性。9.用tune2fs查看文件系统的UUID:UUID: magi c number : revi si on #: features: 一1&77 703 65-拓口-44拓二872二血55 6日8

14、94。寸 OxEF53;1 (dvnami c) ,.,,ha5_journal resi ze_i node di r_i ndex fi (none) cl ean ContinueLi nux 657512rootAnvbackup03 # tuneZfs -1 /dev/dt tuneSf5 1.39 (29-M日y-2006) Fi1esy 5tem volume name : Last mounted 口n : Filesy5tem Fi1esy 5tem Fi1esy stem Filesystem.Default mount options : Fi1esy stem stat

15、e : Errors behavi or: Fi1esystem OS type: Inode count:10.用vi编辑/etc/fstab文件将/dev/sdbl挂在/mnt/testl目录下,设置自动挂载:rootAriybaekLip03 * f vi/etc/fstab/dev/volGroup00/Logvol00i /extBdefaults1 1LABEL=/bOot/bootext3dea-ul tsTfflpf S/dev/shmtmpf srsdevpts/dev/ptsdevptsq i c=5,hoc s=G 20sysfs/syssysfsdefaultsproc

16、/procprocdeults/dev/vol GrowpOO/Laavol 01B swapdefaults0 0lLJZC-6/./U3bb-bacl-44Je-8/21-c41b56aySjLij/nrt/Testlgt3 dam 1注意:1. 挂载选项使用的是“ _netdev”2. UUID要顶格写。3. Linux系统重启后,磁盘设备的名称可能会发生变化,从而引起文件系统不能挂 载上来或者不能正确挂载,使用UUID的方式进行挂载可以解决这个问题,11.用mount -a挂载文件系统,如图所示:rootAnybackup03 -# mount -a rootAnybackup03 j

17、# .12.用df查看文件系统已经挂载成功,如图所示:可.用Pff%斗载点446G/dev/sdal418G2% /S2M 14% /bootrootAnybackup03df Th一文件系统容呈13.重启系统,确认一下,是否能自动挂载。Last login: Wed Nov 20 13 ; 26 ; 06 2013 from er31LO143t. en ray. rootAnybackup03 司养 df -1 h文件系统容星lJIJ i i. J T用羯杵我疔/dev/mapper/Vol GroupOO-LogVol 00/dev/sdal446G4.8G418G2%/99MIBM82

18、M14%/boot.CG 0 2 .口G盛 /d时/139M4.6G3%/mnt/testl重启后确实能自动挂载,如上图所示14.以上就是在linux系统上挂载iscsi存储卷的步骤二、Linux iscsi无损扩容1.目前机器/mnt/test1/有以下文件,如图所示:rootlAnybackupOB茴讨2.4Gdrwx2 roar-rjij-r-r- L root-riji;-r-r- 1 root# 1s -1h /mnt/testl/roarrootrootKGG3 1Ti 1- 111-20Ll-2011-209 6 52 0 0.15 51 1 1lost+fouP10404S3P

19、10404S3UX_lof7.zix 2of7 zi2.将/dev/sdb1 先 umount 下来rootAnybackup03 umount /dev/sdbl rootAnybackup03 # 3. Df确认一下,是否umount下来,如图所示: 确实下来了,没有发现/dev/sdbl (假如出现device is busy,处理方法fuser -km /mnt/testlrootAnybackup03df 1h丈件系统容星 lJ:/dev/mapper/ValGroupOO-LogVol00 4.SG 13M Q-.H:%任载项446G/dev/sdal99mtmpfs2.0groo

20、tAnybackup03 刁#418G8 2M 2.0G2%14%0%/boot /dev/shm4,在存储服务器上将“testl”扩容至10G,然后在linux上将testl卷logout 下来,如图所示:一.| ifCfijLdn 匿 的的 T岬员t 琳 5闫71蚯十 豺切山了5网牛】吓户1. 10:3350 -Uge-MTLvg-inQ out of MiBian id: 1, target: iqn.2001-45. cn.equal lagic :4-52Aed6-c2bO71d6f-6dMO215ad7528cl-t?st 1 r portal: 142.164.19.10.B26

21、0 典网Mg qut cd* WN讪n f id: 7, rg*r: 0n,WglQ5. wg.gual 4-5Pdfi-bO71dfi1,-flrifii!Q715fld75Z&C L-CtfT1.做中印1 1能,l&.g, ID .熟由: Egwt 寸gidr L tb) 1-5 c?a. cqu-tl 1-pgi ;4-1-dGf5-h 75( prtLl; IP 2. ICS. ID. IQ i 264: a-MECBiaf h1LOijDLrt of sid: 2. tapflEt: iqn.itJD 1-Q5.coh,cqu-il 1 -aflric:4-SZaedi-e2bOTl

22、def-M&DDZ1 Ead7HZHcl-tiZStL, iwrtal: 19Z. 1B. 1D_UD, 3: uccessf uT5.然后查询login,如图所示:Logging i n to rif-ace: ieth&. t-irget: -iqn. 2001-n.t-qualop-ic:4-SZacdfe-c2b0Idb-SdWO21 S-ad?$24cL-1eit 1. portal: 1&2. Ifl. 10.SJ&O Loq-in in to Hace: iface2, target: iqn.2031-35.cor.equa 1 dgic :4-EZaed2-cZbQ71dbf

23、-BcEDOZlEau752Bc.1-tesi:1 pc-rial: LSZ. 1SB.LD.10,3ZS0 L-og *i n E ti i i i AV hO , fiqti. 7C01 0 .I I -= i- : 4 2vdG -2b3&d&DI2215j4rlIT 1, 口心*理1: 19 7. ID. ID , 3?EC ! Aue-A ill u ILogin E if-ict=: iface2. target:询n.Wg_l-05. BmtqMiil laG它&况卷-匚Z眄了比6仁$1&抵215由件氏1已3匕14 portal : 163-. 10: 14hsucx串Mud6.

24、 Fdisk -发现容量扩大至10G如图所示:rootAnybackup03fdi s一1Disk /dev/sda: 500.0 GB T 500040728576 bytes255 heads. 63 sectors/trac.G0783 cyl i ridersunits = cylinde rsof L60G5 *512 = 32252SObytesDevice BootStartEndBlocksidsYszem/dev/sdal 11310439183Linux/dev/5da214GQ7934882153508eLinuk LVNsk /d?v/sdh : 1 0 .7 GB,

25、10742661120 bjtes1ixfeb neaas P bz sectors/tracKcy M ride rsunits = cylinde rsof 102S2 我512 = 52GS504bytesDevice BootStartEndB1ocksidsy 5二已们/dev/sdbl11023524888983Linux7,删除/dev/sdbl卷,如图所示:rootAnybackupOS # 子ch 5k /日己丫7崩可The number of cyli nders for thi s di sk i s set to 2038.There i s nothi ng Viro

26、ng with that P but this i s 1 arger than 1024, and could i n cental n setups cause probl ems Vri th :1) sof t?ja re that runs at boot time (色.q . r old ver si a ns at L工 L。)2 booti ng and partial oni ng sof tpja re from other oss(e.g., DOS FDISK, OS/2 FDISK)cammand (m tor halp): 回se1ected parrition

27、1Command (m for he! p) : | Vl |The parti t i on table has bee n alta red!Cal ling i octi() to re-read parti ti on table.Sy nci ng di sks.rootAnybackup03 ,rootAnybackup03、# fdi sk -1Disk /detf/sd己:5 00.0 GB r 50D04072S576 bytes 255 heads, 63 sectors/track r &07S3 cylinders uni ts = cylinders of 16065

28、 土 512 = S225280 bytesDevice Boot start End /dev/sdal 1 13 /dev/sda2 14 GD793Blocks104391488215350d 3e18 8systemLi nux Linux LVMDisk /dev/sdb: 10.7 gb, 10742GG1120 bytes 64 heads. 32 sectors/track, 10245 cylinders units = cylinders of 2048 * 512 = 1043576 bytesDevice BootStartEndBlocksIdSystem8.重新创建

29、分区/dev/sdbl,如图所示:rQ0t3AnybackupO3 #/而可:而e ed hh n)T T al21024 ,LILO)numbe r of cy1i nde rs for this disk i s set to 10245.re i s nothing wrong with that, but this i s 1 arger than could i n certai n setups cause problems with:software that runs at boot time (e.g. , old vrsi ons of booti ng and pa rt

30、i ti oni ng software from other oss Ce.g. , DOS FDISK , OS/2 FDISK)Command (m for help): Command actione extendedp primary partition (1-4)Partition number (1-4): ITFi5t cyli nder (1-10245. aefault 1):Using default value 1Last cylinder or 十size or +sizeM or +sizel (1-L0Z45 , defau 11 10 24 5)Usi ng d

31、efault value 10245command Cm for help) :EThe partition table has been altered!Ca.1 ling iocti () to re-read partition table. Synci ng disks.rootAnybackup039.使用partprobe同步内存中分区信息rootAnybackup03 # partproberootAnybackup03 #10.使用e2fsck强制检查分区rDaTC?Anyba.ckupG3 -# e2fsck -f /dsv/sdol e2fsck 1.39 C29-May-

32、2C06).Couldn11 rd ext2 superolcck, t ryi ng backup e2fsck; Bad magic number in super-olock Mhi 1bocks.e t ryi igtoopen/dev/sdblThe superb!cck cculd rot be filesystem. Ir the device filesystem (and rot swap or i s cor rupz , and you night t eSfsck -b S193 rsac a r i 5 ualid ufs or ry runnidoes not an

33、d it r soireth ng ng e2fsckdescribe a correct extea1y cantai ns an 已xt2e se), then the superblockvr th an al ternate supe rblock:roaicSAnybc.ckupOS -#rootAny匕mckupO3 -# partorobe raDt(AnybackupO3 -# e2fsz -f /de?/scIdIeZf sck IL. 3 9Pass . - 一 PassPassP&55Pass, _,/dev/sdbl: 11/262750 files (9.1% nan

34、-CDntiguausrootAnybackup03 # |1: Cb已匚k i Fiy 2: Checkirig 3 : ckeclci ng 4: ckecki ng 5: cbecki ngi ric ds s . bl ucks , dnd si 乙已 s di rector/ structurc di rectory cannecfivity reference counts _ greup sumnary i nfo iriationL2S5L5/3245436 blacoor(aAnybackup03 # df -1 h文件系统容量己用可用己用桂或点/dev/mappe r/Vol GroupOO-LogVol0044SG4.8G41SG2%/dev/sdal99M13M8 2M14%/boottmpf s2.0G02.0G0%/dev/shm/dev/sdblBOG173M29G1%/mnt/kekeroot(flAnybackup03 # 国13.重新mount -,如图所示:14.

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

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号