Converting MBR to GPT format

Issues related to applications and software problems and general support
Post Reply
ostene
Posts: 48
Joined: 2015/01/25 16:10:17

Converting MBR to GPT format

Post by ostene » 2023/01/02 16:06:48

Hello,
Running 'gdisk' on my computers (CentOS and Ubuntu),
I got following answers:

[root@localhost name]# gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************

If I don't type 'q' (leave 'gdisk') but save by typing 'w', is the
converting of the partition done for me?
Thanks in forward!
ostene

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Converting MBR to GPT format

Post by jlehtone » 2023/01/02 16:59:09

Does the drive have data now? If yes, then definitely no, don't.

If no, I'd first wipe the MBR metadata off. Can't remember whether gdisk has such function.
The gdisk does not "convert"; it does (over)write.

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Converting MBR to GPT format

Post by TrevorH » 2023/01/02 17:34:05

I have used gdisk to convert from MBR to GPT and it seems to have been successful. However, I do have backups....
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

ostene
Posts: 48
Joined: 2015/01/25 16:10:17

Re: Converting MBR to GPT format

Post by ostene » 2023/01/11 11:36:50

After using fdisk -l, gdisk /dev/sda and parted, I have
following printout.
Is my file system ok now, or is something still missing?
----------------------------------------------------------------------------------------------------
name:~$ sudo fdisk -l <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
...
Disk /dev/sda: 931,51 GiB, 1000204886016 bytes, 1953525168 sectors
...
Disklabel type: gpt
...
Device Start End Sectors Size Type
-----------------------------------------------
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 4956159 3905536 1,9G BIOS boot
/dev/sda3 4956160 53784575 48828416 23,3G Linux filesystem

name:~$ sudo gdisk /dev/sda <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

GPT fdisk (gdisk) version 1.0.8
-------------------------------

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): q
...

name:~$ sudo gdisk /dev/sda1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

GPT fdisk (gdisk) version 1.0.8
-------------------------------
Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present

***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************

Command (? for help): q
...
name:~$ sudo gdisk /dev/sda2 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

GPT fdisk (gdisk) version 1.0.8
-------------------------------
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present

Creating new GPT entries in memory.

Command (? for help): q
...
name:~$ sudo parted -l <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Disk /dev/sda: 1000GB
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 538MB 537MB fat32 EFI System Partition boot, esp
2 538MB 2538MB 2000MB xfs bios_grub
3 2538MB 27,5GB 25,0GB xfs

Thanks!
ostene

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Converting MBR to GPT format

Post by TrevorH » 2023/01/11 13:10:08

You can't use fdisk/gdisk etc on partitions and trying to do so will lead to invalid results. Both /dev/sda1 and /dev/sda2 are partitions on /dev/sda so you cannot fisk/gdisk them.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply