4

I used to have a primary partition, /dev/sdb1, and an extended partition, /dev/sdb2. Since I deleted sdb1 and merged it into sdb2, I’ve been trying to think of a way to modify the id '/dev/sdb2' to '/dev/sdb1' (beacuse there won’t be /dev/sdb1 anymore).

There’s also two logical partitions inside /dev/sdb2: /dev/sdb5 and /dev/sdb6.

Is there an easy way to modify the numeric id?

My partition table looks like this:

Device Boot     Start        End     Blocks  Id  System
----------------------------------------------------------------
/dev/sdb2        2048  234440703  117219328   f  W95 Ext’d (LBA)
/dev/sdb5       16065   87249014   43616475   7  HPFS/NTFS/exFAT
/dev/sdb6    87251063  234440703  73594820+   7  HPFS/NTFS/exFAT


Nr  AF  Hd  Sec  Cly   Hd  Sec   Cly  Start       Size  ID
----------------------------------------------------------
 1  00   0    0    0    0    0     0      0          0  00
 2  00  32   33    0  254   63  1023   2048  234438656  0f
 3  00   0    0    0    0    0     0      0          0  00
 4  00   0    0    0    0    0     0      0          0  00
 5  00   0    1    1  254   63  1023  14017   87232950  07
 6  00  32   33  311  254   63  1023   2048  147189641  07
2
  • 2
    Why? There's nothing wrong with not having a partition 1.
    – psusi
    Feb 24, 2012 at 14:06
  • I know. But I feel that the thing may be done simply in some way, I just don't know how. Feb 24, 2012 at 14:52

2 Answers 2

-2

Delete the partitions, and recreate them in exactly the same positions. Make sure you are using sectors as the unit to avoid rounding errors.

1
  • 1
    Can we agree that suggesting to destroy even potentially very large partitions full of useful data, when there is a solution that with one command, 5 steps and 2 minutes of total time achieves the same result, is total nonsense?
    – Avio
    Jan 25, 2021 at 20:46
16

To fix partitons order, enter fdisk with root privileges

$ sudo fdisk /dev/sdb

enter "extra functionality (experts only)"

> x

fix partition order

> f

then return to main menu

> r

preview & check new partiton "order"

> p

write table to disk and exit

> w

in any menu list available commands at the time (for help)

> m 
1
  • 1
    Suggest first command should be "$ sudo fdisk /dev/sdb" rather than "$ sudo fdisk /dev/sdb2" as the command works on the whole disk rather than a single partition. With that modification your instructions are perfect.
    – Gannet
    Jul 16, 2019 at 23:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .