Linux精講——fdisk磁碟分割槽

flyingfishzxf發表於2016-02-28

磁碟分割槽原則:

  • 每個磁碟可分的“主分割槽 + 擴充套件分割槽”不能大於 4
  • 主分割槽可以分 0~4 個
  • 擴充套件分割槽最多隻能分1個,在擴充套件分割槽裡面再分成邏輯分割槽,邏輯分割槽沒有數量限制
  • 邏輯分割槽的分割槽號從 5 開始,比如:sdb5、sdb6
  • 若分割槽號在 1~4,那麼一定是主分割槽或擴充套件分割槽

fdisk 分割槽方法:

fdisk -l            # 列出所有磁碟的分割槽表資訊
fdisk -l /dev/sdxx  # 列出指定磁碟的分割槽表資訊

[root@centos01 ~]# fdisk /dev/sdb  ## 對指定磁碟進行分割槽操作

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
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
   l   logical (5 or over)
   p   primary partition (1-4)
p    ## 選擇分主分割槽
Partition number (1-4): 3    ## 分割槽號選擇3
First cylinder (917-1305, default 917):    ## enter 使用預設開始位置
Using default value 917
Last cylinder, +cylinders or +size{K,M,G} (917-1305, default 1305): +1G   ## 增加1G

Command (m for help): d   ## 刪除一個分割槽
Partition number (1-5): 3   ## 選擇要刪除的分割槽號

Command (m for help): w   ## 儲存並退出
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

相關文章