Convert from GPT to MBR without losing data

Archived topics about LMDE 1 and LMDE 2
Locked
User avatar
Fred Barclay
Level 12
Level 12
Posts: 4185
Joined: Sat Sep 13, 2014 11:12 am
Location: USA primarily

Convert from GPT to MBR without losing data

Post by Fred Barclay »

G'day, guys! I'm asking this here because the machine I have in mind is running Betsy, but this really has nothing to do with Betsy that I can see. Mods, feel free to move it as needed. :)
I have a machine with a GPT-partitioned hard drive. The drive looks like this:

Code: Select all

fred@aussie ~ $ sudo lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 232.9G  0 disk 
├─sda1   8:1    0 138.7G  0 part /
├─sda2   8:2    0  46.6G  0 part 
├─sda3   8:3    0   4.7G  0 part [SWAP]
├─sda4   8:4    0    42G  0 part 
└─sda5   8:5    0  1001M  0 part 
sr0     11:0    1   7.7G  0 rom  /media/fred/LSE0NNF1
fred@aussie ~ $ sudo fdisk -l

Disk /dev/sda: 232.9 GiB, 250059350016 bytes, 488397168 sectors
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: gpt
Disk identifier: 351A555A-C6F0-4CFF-A62A-AB9A38CDE85C

Device         Start       End   Sectors   Size Type
/dev/sda1         34 290920447 290920414 138.7G Linux filesystem
/dev/sda2  292970798 390628793  97657996  46.6G Linux filesystem
/dev/sda3  390628794 400395000   9766207   4.7G Linux swap
/dev/sda4  400396288 488396799  88000512    42G Linux filesystem
/dev/sda5  290920448 292970495   2050048  1001M Linux filesystem

Partition table entries are not in disk order.
I want to change the partition table on this to MBR, but I don't want to loose any data. I've seen this and this, but I'm scared, and I want someone to hold my hand as I do it. ;) So I'm asking for advice, experience, hints, and anything that you think could be useful.
I have 5 primary partitions, but I don't need sda5, so that shouldn't be an issue. I'll just delete it.

Thanks!
Fred
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Image
"Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy."
- Albert Einstein
User avatar
Pierre
Level 21
Level 21
Posts: 13215
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: Convert from GPT to MBR without losing data

Post by Pierre »

those two links are to convert in opposite directions,
so the one from RodsBooks is the one that you want.
- both of them use the Gdisk on a live Linux_disc.

but: why do you want to convert back to a MBR system?.

either way - you want to mess with the partitions - so your back-up is a Must.
- know this - as have messed up partitions - lots of times :( And Had No Back-up :shock:
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.
vl1969

Post by vl1969 »

First of all, I am with Pierre, why do you want to convert to older, less desirable schema?

Second, with any kind of major change like this a backup is a MUST. I would even say do all the data backup AND a full drive image to be safe.
The easiest and fool proof way is a new reinstall of all system. Do the backup, than boot into live cd and use gparted to dump the drive and create new partition table. As mbr. Than partition it as you want and do anew install. Converters work, but it's very risky and put an unnecessary strain on drive.


Also, what do you mean partition table is not in disk order?


Sent from my phone
srs5694
Level 6
Level 6
Posts: 1386
Joined: Mon Feb 27, 2012 1:42 pm

Re: Convert from GPT to MBR without losing data

Post by srs5694 »

I'm the author of GPT fdisk (gdisk, sgdisk, cgdisk, and fixparts), and I concur completely with Pierre and vl1969 -- unless you've got a compelling reason to do so, don't try a GPT-to-MBR conversion. Of course, there are compelling reasons to do such a conversion for specific situations, but you haven't presented one. If you really have such a reason, see this section of the GPT fdisk documentation, which describes the process in detail.

Note that you've got five partitions, which is one more than the number of primary partitions available in MBR. You haven't presented enough detail for me to know if any of these partitions can be converted to logical form. If not, you'll have to either resize at least one partition (maybe two or more) or drop at least one partition to do the conversion. The need for such changes is one of the many reasons to not do a GPT-to-MBR conversion unless it's really necessary.
User avatar
Fred Barclay
Level 12
Level 12
Posts: 4185
Joined: Sat Sep 13, 2014 11:12 am
Location: USA primarily

Re: Convert from GPT to MBR without losing data

Post by Fred Barclay »

Hey, guys, thanks for responding. The reason I want to go to MBR is that this is a BIOS machine, not UEFI. I'm trying to install Kali, and it nearly always crashes at login (LMDE Betsy does fine) and I'm thinking that the GPT/nonUEFI setup might be confusing it.
I've installed Kali many times on an MBR disk and never seen this problem. I've asked about it on Stack Exchange Unix & Linux, and on the Kali forums, and haven't really got any info from there, so I'm trying to track down the bug myself.
Image
"Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy."
- Albert Einstein
srs5694
Level 6
Level 6
Posts: 1386
Joined: Mon Feb 27, 2012 1:42 pm

Re: Convert from GPT to MBR without losing data

Post by srs5694 »

Fred Barclay wrote:Hey, guys, thanks for responding. The reason I want to go to MBR is that this is a BIOS machine, not UEFI. I'm trying to install Kali, and it nearly always crashes at login (LMDE Betsy does fine)
No, if it gets as far as a login screen, the problem is NOT caused by the partition table. Such incompatibilities are rare. When they're present, they manifest in the form of an inability to boot -- BIOS incompatibilities will prevent GRUB from starting up, boot loader problems (most likely not GRUB) will prevent the boot loader from starting or cause the kernel to not launch, and kernel problems will prevent the root filesystem from mounting. A login screen indicates that you've cleared all those hurdles and then some, so switching the partition table type will not help.
I've installed Kali many times on an MBR disk and never seen this problem. I've asked about it on Stack Exchange Unix & Linux, and on the Kali forums, and haven't really got any info from there, so I'm trying to track down the bug myself.
A crash at login sounds like a bug in the desktop environment, or maybe a problem with your video driver. If you've got an ATI or nVidia chipset, you might try switching from the open-source to the proprietary driver (or vice-versa). You could also try going to a text-mode console (via Ctrl+Alt+F2 or the like), log in that way, and examine your log files (in /var/log) for clues about what happened. If by "crash" you mean the system hung completely or spontaneously rebooted, this might be tricky, since at best you'll have a bunch of new log entries at the end of each file, and at worst the crash will happen in a way that will leave no log-file traces. If by "crash" you mean the desktop environment crashes and you get back to a new login prompt without a reboot, then there's more likely to be something helpful in one of the log files -- perhaps one of the X log files (/var/log/Xorg.0.log or similar).

If you focused on the GPT/MBR thing in your previous posts to other forums, I recommend you go back and focus on desktop environment and video driver problems as possibilities. That might get you further. Personally, I've never used Kali, so I'm not familiar enough with its setup to give you more specific suggestions, and of course this isn't a Kali forum.
Locked

Return to “LMDE Archive”