Article sections

    If you’ve deleted a logical partition and again recreated it, you might notice ‘partition out of order‘ problem or error message like ‘Partition table entries are not in disk order‘.

    For example, when three logical partitions such as (sda4, sda5 and sda6) are deleted, and new partition created, you might expect the new partition name would be sda4. But, the system would create it as sda5. This happens because of, after the partition are deleted, sda7 partition had been moved as sda4 and free space shift to the end.

    To fix such partition order problems, and assign sda4 to the newly created partition, issue the ‘x‘ to enter an extra functionality section and then enter ‘f‘ expert command to fix the order of partition table as shown below.

    [root@tecmint ~]# fdisk  /dev/sda
    
    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): x
    
    Expert command (m for help): f
    Done.
    
    Expert command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    
    WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
    The kernel still uses the old table. The new table will be used at
    the next reboot or after you run partprobe(8) or kpartx(8)
    Syncing disks.

    After, running ‘f‘ command, don’t forget to run ‘w‘ command to save and exit from fdisk command mode. Once it fixed partition table order, you will no longer get error messages.

    in Linux Commands