天天看點

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個,如果想分更多的分區,需要建立擴充分區。

前三個分為主分區,第四個将剩餘所有空間都分給擴充分區嗎(不然剩餘空間會浪費)。

擴充分區不能夠格式化,可以看作是一個空格。

再往下分區,第五個分區就是擴充分區的子分區,稱為邏輯分區。

上一篇: fdisk 指令
下一篇: linux fdisk

繼續閱讀