马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的小伙伴们!Linux硬盘分区(一):增加
********************************
*************************
历程简述
*************************
[plain]viewplaincopy
- --增加磁盘
- #fdisk-l--检察磁盘情形
- #fdisk/dev/sdb--为/dev/sdb装备分区
- n--增加分区
- p/e--主分区/逻辑分区
- w--保留加入
- #mkdir/data--创立挂载目次
- #mkfs.ext3/dev/sdb--格局化磁盘为ext3文件体系
- #fdisk-l--再次检察磁盘情形
- #mount/dev/sdb/data--挂载磁盘到创立的挂载目次下
- #vi/etc/fstab--修正启动主动挂载项
- /dev/sdb/dataext3defaults00
*************************
申明
*************************
1、以上操纵为精华精辟总结,若如能够看懂,上面内容无需扫瞄;
2、以下复杂枚举两例,细化操纵历程。
*****************************************************************************************************
举例1:增加1块90G磁盘,将其分为1个分区
*****************************************************************************************************
*************************
检察磁盘情形
*************************
[plain]viewplaincopy
- [root@hyldb/]#fdisk-l
- Disk/dev/sda:128.8GB,128849018880bytes
- 255heads,63sectors/track,15665cylinders
- Units=cylindersof16065*512=8225280bytes
- DeviceBootStartEndBlocksIdSystem
- /dev/sda1*164514048+83Linux
- /dev/sda265586419296582Linuxswap/Solaris
- /dev/sda358715665121122067+83Linux
- Disk/dev/sdb:96.6GB,96636764160bytes
- 255heads,63sectors/track,11748cylinders
- Units=cylindersof16065*512=8225280bytes
- Disk/dev/sdbdoesntcontainavalidpartitiontable
*************************
磁盘分区
*************************
[plain]viewplaincopy
- [root@hyldb/]#fdisk/dev/sdb
- DevicecontainsneitheravalidDOSpartitiontable,norSun,SGIorOSFdisklabel
- BuildinganewDOSdisklabel.Changeswillremaininmemoryonly,
- untilyoudecidetowritethem.Afterthat,ofcourse,theprevious
- contentwontberecoverable.
- Thenumberofcylindersforthisdiskissetto11748.
- Thereisnothingwrongwiththat,butthisislargerthan1024,
- andcouldincertainsetupscauseproblemswith:
- 1)softwarethatrunsatboottime(e.g.,oldversionsofLILO)
- 2)bootingandpartitioningsoftwarefromotherOSs
- (e.g.,DOSFDISK,OS/2FDISK)
- Warning:invalidflag0x0000ofpartitiontable4willbecorrectedbyw(rite)
- Command(mforhelp):m
- --输出m检察匡助:指令提醒
- Commandaction
- atoggleabootableflag
- beditbsddisklabel
- ctogglethedoscompatibilityflag
- ddeleteapartition
- llistknownpartitiontypes
- mprintthismenu
- naddanewpartition
- ocreateanewemptyDOSpartitiontable
- pprintthepartitiontable
- qquitwithoutsavingchanges
- screateanewemptySundisklabel
- tchangeapartitionssystemid
- uchangedisplay/entryunits
- vverifythepartitiontable
- wwritetabletodiskandexit
- xextrafunctionality(expertsonly)
- Command(mforhelp):n
- --增加新分区
- Commandaction
- eextended
- pprimarypartition(1-4)
- p
- --输出p增加主分区
- Partitionnumber(1-4):1
- --填写分区号
- Firstcylinder(1-11748,default1):
- Usingdefaultvalue1
- Lastcylinderor+sizeor+sizeMor+sizeK(1-11748,default11748):
- Usingdefaultvalue11748
- Command(mforhelp):p
- --打印分区列表
- Disk/dev/sdb:96.6GB,96636764160bytes
- 255heads,63sectors/track,11748cylinders
- Units=cylindersof16065*512=8225280bytes
- DeviceBootStartEndBlocksIdSystem
- /dev/sdb111174894365778+83Linux
- Command(mforhelp):w
- --保留加入
- Thepartitiontablehasbeenaltered!
- Callingioctl()tore-readpartitiontable.
- Syncingdisks.
*************************
创立挂载目次
*************************
[plain]viewplaincopy
*************************
格局化磁盘
*************************
<divclass="dp-highlighterbg_plain"style="font-family:Consolas,CourierNew,Courier,mono,serif;width:700.90625px;overflow:auto;padding-top:1px;color:rgb(51,51,51);line-height:26px;margin:18px0px!important;background-color:rgb(231,229,220);">[plain]viewplaincopy
<olstart="1"style="padding-right:0px;padding-left:0px;border:none;list-style-position:initial;list-style-image:initial;color:rgb(92,92,92);margin:0px0px1px45px!important;background-color:rgb(255,255,255);"><liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;">[root@hyldb/]#mkfs.ext3/dev/sdb<listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);">--格局化sdb1,格局成ext3格局文件体系<liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;">mke2fs1.39(29-May-2006)<listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);">/dev/sdbisentiredevice,notjustonepartition!<liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;">Proceedanyway?(y,n)y<listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);">Filesystemlabel=<liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;">OStype:Linux<listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);">Blocksize=4096(log=2)<liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;">Fragmentsize=4096(log=2)<listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);">11796480inodes,23592960blocks<liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;">1179648blocks(5.00%)reservedforthesuperuser<listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);">Firstdatablock=0<liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;">Maximumfilesystemblocks=4294967296<listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);">720blockgroups<liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;">32768blockspergroup,32768fragmentspergroup<listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);">16384inodespergroup<liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;">Superblockbackupsstoredonblocks:<listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);">32768,98304,163840,229376,294912,819200,884736,1605632,2654208,<liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;">4096000,7962624,11239424,20480000<listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);"><liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;"><listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);">Writinginodetables:done<liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;">Creatingjournal(32768blocks):done<listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);">Writingsuperblocksandfilesystemaccountinginformation:done<liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;"><listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);"><liclass="alt"style="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;">Thisfilesystemwillbeautomaticallycheckedevery33mountsor<listyle="border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;line-height:18px;margin:0px!important;padding:0px3px0px10px!important;background-color:rgb(248,248,248);">180days,whichevercomesfirst.Usetune2fs-cor-itooverride. |