码迷,mamicode.com
首页 > 其他好文 > 详细

fdisk分区

时间:2016-03-04 22:48:01      阅读:279      评论:0      收藏:0      [点我收藏+]

标签:fdisk   逻辑分区   扩展分区   

fdisk用于小于2T的磁盘。大于2T的分区需要用parted。

语法:fdisk[-l][设备名称]

-l后面不跟设备名会直接列出系统中的磁盘设备和分区表。

加上设备名称则列出该设备的分区表。


不加[-l]对磁盘进行分区操作。例:fdisk /dev/sdb

[root@one ~]# fdisk /dev/sda3
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xadaa5408.
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): m           //输入m列出常用的命令
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):p             //键入p,查看分区状况

Disk /dev/sda3: 19.2 GB, 19221446656 bytes
255 heads, 63 sectors/track, 2336 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: 0xadaa5408

     Device Boot      Start         End      Blocks   Id  System

Command (m for help): n                //键入n,添加一个新分区
Command action
   e   extended                       //扩展分区 
   p   primary partition (1-4)          //主分区?(1-4)
p                                      //键入p,选择格式为主分区
Partition number (1-4): 1               //键入分区号
First cylinder (1-2336, default 1): 1     //选择柱面的数值
Last cylinder, +cylinders or +size{K,M,G} (1-2336, default 2336): +1000M   //分1000M

Command (m for help):

然后按照上面的步骤继续分区。全部都分为主分区的话,最多只能分4个,如果想分更多的分区,需要创建扩展分区。

前三个分为主分区,第四个将剩余所有空间都分给扩展分区吗(不然剩余空间会浪费)。

扩展分区不能够格式化,可以看作是一个空格。

再往下分区,第五个分区就是扩展分区的子分区,称为逻辑分区。

逻辑分区的id是从5开始的。

分区完之后需要输入w保存。

删除分区,键入命令d,根据提示输入要删除的分区id,如果扩展分区被删除了,那扩展分区下的逻辑分区也会被删除。

fdisk分区

标签:fdisk   逻辑分区   扩展分区   

原文地址:http://1024079574.blog.51cto.com/10921986/1747717

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!