设为首页 收藏本站
查看: 397|回复: 0

[经验分享] fdisk工具简单使用介绍

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-11-6 09:13:48 | 显示全部楼层 |阅读模式
###########################################################
#一个IDE硬盘只能建4个分区,如果要建多于四个的分区,就要拿出一个主分区做为 #
#扩展分区,再在扩展分区里面进行其它的分区操作。                                             #
###########################################################

[iyunv@zhouqixiang ~]# fdisk /dev/sdb     #对磁盘/dev/sdb进行分区
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x68a3c8c6.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p      #打印分区表
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x68a3c8c6

   Device Boot      Start         End      Blocks   Id  System
Command (m for help): h      #帮助
h: unknown command
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition    #删除分区
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table        #打印分区表
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit    #保存分区
   x   extra functionality (experts only)

Command (m for help): n      #新增分区
Command action
   e   extended   #扩展分区
   p   primary partition (1-4)     #主分区
p
Partition number (1-4): 1    #第一个主分区,编号1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): +2G

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2     #第二个主分区,编号2
First cylinder (263-1305, default 263):
Using default value 263
Last cylinder, +cylinders or +size{K,M,G} (263-1305, default 1305): +2G

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3    #第三个主分区,编号3
First cylinder (525-1305, default 525):
Using default value 525
Last cylinder, +cylinders or +size{K,M,G} (525-1305, default 1305): +2G

Command (m for help): n      #扩展分区,编号4
Command action
   e   extended
   p   primary partition (1-4)
e        #这里选择扩展分区
Selected partition 4
First cylinder (787-1305, default 787):
Using default value 787
Last cylinder, +cylinders or +size{K,M,G} (787-1305, default 1305):
Using default value 1305

Command (m for help): p      #打印分区表
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x68a3c8c6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         262     2104483+  83  Linux
/dev/sdb2             263         524     2104515   83  Linux
/dev/sdb3             525         786     2104515   83  Linux
/dev/sdb4             787        1305     4168867+   5  Extended

Command (m for help): n      #对扩展分区再建第一个逻辑分区
First cylinder (787-1305, default 787):
Using default value 787
Last cylinder, +cylinders or +size{K,M,G} (787-1305, default 1305): +2G

Command (m for help): n      #对扩展分区再建第二个逻辑分区
First cylinder (1049-1305, default 1049):
Using default value 1049
Last cylinder, +cylinders or +size{K,M,G} (1049-1305, default 1305):
Using default value 1305

Command (m for help): p      #打印分区表,有5个可用分区(扩展分区用来建逻辑分区)
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x68a3c8c6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         262     2104483+  83  Linux
/dev/sdb2             263         524     2104515   83  Linux
/dev/sdb3             525         786     2104515   83  Linux
/dev/sdb4             787        1305     4168867+   5  Extended
/dev/sdb5             787        1048     2104483+  83  Linux
/dev/sdb6            1049        1305     2064321   83  Linux

Command (m for help): w      #保存分区表
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
#下面格式化分区,再进行手动挂载,把配置文件写入/etc/fstab
[iyunv@zhouqixiang ~]# mkfs.ext4 /dev/sdb1

手动挂载分区请访问:


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-27229-1-1.html 上篇帖子: linux磁盘空间报警脚本 下篇帖子: Linux下手动挂载新增磁盘
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

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