How to renumber a partition?

1

1

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

Determinant

Posted 2012-02-24T13:57:41.353

Reputation: 960

2Why? There's nothing wrong with not having a partition 1. – psusi – 2012-02-24T14:06:18.703

I know. But I feel that the thing may be done simply in some way, I just don't know how. – Determinant – 2012-02-24T14:52:09.477

Answers

-1

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

psusi

Posted 2012-02-24T13:57:41.353

Reputation: 7 195

7

to fix partitons order enter fdisk with elevated privileges

$ sudo fdisk /dev/sdb2

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 

pawelkl

Posted 2012-02-24T13:57:41.353

Reputation: 354

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 – 2019-07-16T23:12:02.690