仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 369|回复: 6
打印 上一主题 下一主题

[CentOS(社区)] 来一发CentOS磁盘分区增加删除

[复制链接]
柔情似水 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-14 20:21:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

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





  • [root@hyldb/]#mkdir/data

*************************
格局化磁盘
*************************

<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.
灵魂腐蚀 该用户已被删除
沙发
发表于 2015-1-16 13:01:44 | 只看该作者

来一发CentOS磁盘分区增加删除

一些显而易见的小错误还是用vi改正比较方便。以后的大一点的程序就得在Linux下调试了,因为有的头文件在VC里面说找不到。?
爱飞 该用户已被删除
板凳
发表于 2015-1-24 15:22:46 | 只看该作者
掌握在Linux系统中安装软件,在安装Linux工具盘后大致日常所需的软件都会有,一般网络提供下载的软件都会有安装说明。
山那边是海 该用户已被删除
地板
发表于 2015-2-2 06:47:56 来自手机 | 只看该作者
把这个问题放在其他Linux社区请求帮助也是一种选择。如果Linux得不到答案,请不要以为我们觉得无法帮助你。有时只是看到你问题的人不知道答案罢了。这时换一个社区是不错的选择。
因胸联盟 该用户已被删除
5#
发表于 2015-2-23 09:48:45 | 只看该作者
用户下达的命令解释给系统去执行,并将系统传回的信息再次解释给用户,估shell也称为命令解释器,有关命令的学习可参考论坛相关文章,精通英文也是学习Linux的关键。
蒙在股里 该用户已被删除
6#
发表于 2015-3-7 09:46:56 | 只看该作者
有疑问前,知识学习前,先用搜索。
老尸 该用户已被删除
7#
发表于 2015-3-21 19:34:13 | 只看该作者
Linux是参照Unix思想设计的,理解掌握Linux必须按照Unix思维来进行。思想性的转变比暂时性的技术提高更有用,因为他能帮助你加快学习速度。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-11-16 22:31

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表