11

I have a 2TB GPT drive that for some reason is mounted as /dev/sdc2. I would prefer all my data drives to be mounted as /dev/sd*1.

If I use sudo parted /dev/sdc print I get:

Model: ATA WDC WD20EARS-07M (scsi)
Disk /dev/sdc: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start  End     Size    File system  Name                  Flags
 2      135MB  2000GB  2000GB  ntfs         Basic data partition

Is it possible to change the partition number without losing any data?

2 Answers 2

16

I eventually found the solution by using gdisk (gdisk - Interactive GUID partition table (GPT) manipulator). This what I did:

  1. Run sudo gdisk /dev/sdc
  2. Option s to sort the partitions
  3. Review changes by using option p
  4. And finally write the changes to the disk with option w
1
  • 3
    This is unrelated, but if someone wants to force a disk to have different number, there is in experts menu (x) a tool called t, which can be used for this.
    – Smar
    Jan 5, 2013 at 11:41
1

Classic (DOS) partition table is just that, a table. There are four primary rows (lines). You can have an entry in a second row, while the first line is empty (all zeros).

First of all, make a backup. Then I would rather use a very dumb and simple tool like fdisk:

  1. run fdisk /dev/sdc
  2. Switch to extended commands (x) and use "Fix partition order" (f) command to reorder the partition table. This, hopefully, will move the second line to the first place.

If this does not work, you can always do it manually. E.g. create a first partition with exactly the same parameters as the second one, and then delete the second partition. Be sure to use a very simple tool like fdisk, which does not do anything with the actual data behind the scenes, and only modifies the partition table.

After that: make sure all partition pointers in fstab and its likes are correct. Reboot ASAP.

3
  • Does fdisk support GPT?
    – Jens
    May 25, 2012 at 16:41
  • Oops. I missed your GPT tag. No, fdisk does not support GPT. I think you can do the same trick with parted (which does support GPT), but I never tried this myself. Still, the device minor number (sd1, sd2, etc.) is derived from the row number of the partition in the partition table, and GPT is still a table, just like a legacy MBR partition table.
    – haimg
    May 25, 2012 at 20:31
  • I did not really find how to fix partition order in parted.
    – Jens
    May 26, 2012 at 20:10

You must log in to answer this question.

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