開始重新分割

  1. fdisk 重新分割 crtefi15g-20190112.img。
    [root@controller src]# fdisk crtefi15g-20190112.img 
    Welcome to fdisk (util-linux 2.23.2).
    
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    
    Command (m for help): p
    
    Disk crtefi15g-20190112.img: 15.7 GB, 15728640000 bytes, 30720000 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x55654248
    
                     Device Boot      Start         End      Blocks   Id  System
    crtefi15g-20190112.img1   *        2048      329727      163840   83  Linux
    crtefi15g-20190112.img2          329728    29689855    14680064   8e  Linux LVM
    crtefi15g-20190112.img3        29689856    29700095        5120   ef  EFI (FAT-12/16/32)
    
  2. 刪除第一分割區。
    Command (m for help): d
    Partition number (1-3, default 3): 1
    Partition 1 is deleted
    
    Command (m for help): p
    
    Disk crtefi15g-20190112.img: 15.7 GB, 15728640000 bytes, 30720000 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x55654248
    
                     Device Boot      Start         End      Blocks   Id  System
    crtefi15g-20190112.img2          329728    29689855    14680064   8e  Linux LVM
    crtefi15g-20190112.img3        29689856    29700095        5120   ef  EFI (FAT-12/16/32)
    
  3. 建立新的分割區 2M ,type 是 EFI。
    Command (m for help): n
    Partition type:
       p   primary (2 primary, 0 extended, 2 free)
       e   extended
    Select (default p): p
    Partition number (1,4, default 1): 
    First sector (2048-30719999, default 2048): 
    Using default value 2048
    Last sector, +sectors or +size{K,M,G} (2048-329727, default 329727): +2M
    Partition 1 of type Linux and of size 2 MiB is set
    
    Command (m for help): t
    Partition number (1-3, default 3): 1
    Hex code (type L to list all codes): ef
    Changed type of partition 'Linux' to 'EFI (FAT-12/16/32)'
    
    Command (m for help): p
    
    Disk crtefi15g-20190112.img: 15.7 GB, 15728640000 bytes, 30720000 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x55654248
    
                     Device Boot      Start         End      Blocks   Id  System
    crtefi15g-20190112.img1            2048        6143        2048   ef  EFI (FAT-12/16/32)
    crtefi15g-20190112.img2          329728    29689855    14680064   8e  Linux LVM
    crtefi15g-20190112.img3        29689856    29700095        5120   ef  EFI (FAT-12/16/32)
    
  4. 刪除第三個分割區。
    Command (m for help): d
    Partition number (1-3, default 3): 
    Partition 3 is deleted
    
  5. 新增第三個分割區。
    Command (m for help): n
    Partition type:
       p   primary (2 primary, 0 extended, 2 free)
       e   extended
    Select (default p): 
    Using default response p
    Partition number (3,4, default 3): 
    First sector (6144-30719999, default 6144): 
    Using default value 6144
    Last sector, +sectors or +size{K,M,G} (6144-329727, default 329727): 
    Using default value 329727
    Partition 3 of type Linux and of size 158 MiB is set
    
    Command (m for help): p
    
    Disk crtefi15g-20190112.img: 15.7 GB, 15728640000 bytes, 30720000 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x55654248
    
                     Device Boot      Start         End      Blocks   Id  System
    crtefi15g-20190112.img1            2048        6143        2048   ef  EFI (FAT-12/16/32)
    crtefi15g-20190112.img2          329728    29689855    14680064   8e  Linux LVM
    crtefi15g-20190112.img3            6144      329727      161792   83  Linux
    
  6. 新增的第三個分割區,位置是在第二個分割區,但編號是 3,所以要重新排序,x 命令進入專家命令。
    Partition table entries are not in disk order
    
    Command (m for help): x
    
  7. f 命令調整編號。
    Expert command (m for help): f
    Done.
    
  8. r 退出專家命令模式。
    Expert command (m for help): r
    
  9. p 查看分割區,已重新排序。
    Command (m for help): p
    
    Disk crtefi15g-20190112.img: 15.7 GB, 15728640000 bytes, 30720000 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x55654248
    
                     Device Boot      Start         End      Blocks   Id  System
    crtefi15g-20190112.img1            2048        6143        2048   ef  EFI (FAT-12/16/32)
    crtefi15g-20190112.img2            6144      329727      161792   83  Linux
    crtefi15g-20190112.img3          329728    29689855    14680064   8e  Linux LVM
    
  10. 設定第二個分割區為 Linux 開機分割區。
    Command (m for help): a
    Partition number (1-3, default 3): 2
    
    Command (m for help): p
    
    Disk crtefi15g-20190112.img: 15.7 GB, 15728640000 bytes, 30720000 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x55654248
    
                     Device Boot      Start         End      Blocks   Id  System
    crtefi15g-20190112.img1            2048        6143        2048   ef  EFI (FAT-12/16/32)
    crtefi15g-20190112.img2   *        6144      329727      161792   83  Linux
    crtefi15g-20190112.img3          329728    29689855    14680064   8e  Linux LVM
    
  11. 寫入分割表並退出。
    Command (m for help): w
    The partition table has been altered!
    
    Syncing disks.