Score:1

Reverting to MBR partition

kg flag

I was trying to create a GTP partition table in an SD card using the following command:

sudo sgdisk --clear --new=1:2048:67583 --new=2 --typecode=1:3000 --typecode=2:8300 /dev/sdb

My problem is that the device I wanted to partition was the /dev/sdf instead of the /dev/sdb which I used in the command, which also happens to be the partition into which I am currently booted, running on Ubuntu 20.04.

Once the command finished executing it printed a message that the changes would take hold after a reboot or after running partprobe which I did. I am currently backing up my data in case I can not log in after reboot but I would also like to know if there is any chance of reverting back to the old partition table.

I run an fdisk both before and after running the sgdisk command and here is the partitions of the disk:

BEFORE

Disk /dev/sdb: 465,78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: WDC WD5000AAKX-0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcd8fe8f7

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 1050623 1048576 512M ef EFI (FAT-12/16/32)
/dev/sdb2 1052671 976771071 975718401 465,3G f W95 Ext'd (LBA)
/dev/sdb5 1052672 976771071 975718400 465,3G 83 Linux

AFTER

Disk /dev/sdb: 465,78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: WDC WD5000AAKX-0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcd8fe8f7

Device Boot Start End Sectors Size Id Type
/sdb1 * 2048 1050623 1048576 512M ef EFI (FAT-12/16/32)
/dev/sdb2 1052670 976771071 975718402 465,3G 5 Extended
/dev/sdb5 1052672 976771071 975718400 465,3G 83 Linux

Any ideas? Thank you in advance.

oldfred avatar
cn flag
It shows dos in both cases. "Disklabel type: dos" So no change. Actually if UEFI booting, you should use gpt. And even if BIOS booting can use gpt. The only place MBR(msdos) is required is for BIOS boot of Windows. But if you convert a drive, you change UUIDs & GUIDS, so have to reinstall grub and edit fstab with new UUIDs. Conversion works ok with data only drives, but with boot drives usually better to reinstall. But if using UEFI, you should use gpt.
Score:0
kg flag

After backing up my data I restarted my computer, thinking I would have trouble booting. Turns out that was not the case, and I managed to log in. So indeed, as @oldfred mentioned I was already using GPT, so all the sgdisk command did was to create a new partition on my disk. From the location of the new partition I thought the boot partition would be affected but it turns out it wasn't. It is possible the system recognised a corrupt partition table and used the back up. So it all seems to be working fine. Thank you all.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.