Change partition numbers

My current disk is partitioned with a MBR type partition table (it is a bit old). I have two partitions /dev/sda1 and /dev/sda7 (a primary and a secondary). I would like to swap these so that /dev/sda1 points to the space on the disk that was /dev/sda7 (and obviously vice versa). Is there a “simple” way to do this. I suspect that I could manually edit bytes in the partition table, but that seems a bit extreme. I don’t want to change the data on the disk either (I need to preserve it). I’d also rather not do extreme things like archive, erase, and start over. Any suggestions? Thanks.

More importantly: Why do you want to change the partition numbers? The simplest way to do this is to transfer all the data off and delete the partition table, then re-create it, though.

1 Like

What is your reason for this plan? You only wrote you want to exchange the partitions, but not why?
Do you want to create more partitions for special data or another OS?

The numbers mean nothing, they are just a part of the device name, something you don’t (seldom) use when using the computer.
Please explain what it is you want with this? So far it looks like a strange plan, something which might go wrong in the process resulting in data loss while when it all should work, you win nothing with it.

Is converting from MBR to GPT an option? With GPT there’s no distinction between primary and secondary / extended partitions.

gdisk can do the conversion in place, without erasing data. Nevertheless, make sure you have a backup (as you should anyway - every disk is going to die at some point).

I’m assuming it’s more about the primary / secondary status of the partition, rather than the numbers per se.