Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Safely converting MBR to GPT
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6289

PostPosted: Wed Mar 25, 2015 8:56 am    Post subject: Safely converting MBR to GPT Reply with quote

According to the discussion in this thread, it seems that I should better convert my disk to GPT format.

I found out that "gdisk" from sys-apps/gptfdisk is theoretically able to do it, but my question is how to do it safely (without data loss).

I conjecture that I should make a backup of the first 2048 blocks (this is the space before the first partition starts) and of the blocks after the last partition: Although fdisk does not report any free space after the last partition (which is worrying me, to be honest), there is a discrepancy between the disk size and the end of the last partition, and indeed with
Code:
dd bs=512 skip=[end of last reported partition + 1] ...
I got a file whose length corresponds to this discrepancy.

Should this be enough for a "backup"? Since I have an extended partition (containing 6 "logical" partitions), there is some space between the partitions: Will gdisk leave this completely untouched so that after restoring the above data in an emergency case, I would have msdos partitions again?

And after conversion, should/can grub2 be just (re-)installed with
Code:
grub2-install /dev/sda
or are other measurements needed? Do I have to change something in the BIOS/UEFI?
Sorry for these stupid questions: I never used gpt and always thought that it is related with UEFI booting (which I do not want to use, at least not now).
Back to top
View user's profile Send private message
bstaletic
Apprentice
Apprentice


Joined: 05 Apr 2014
Posts: 225

PostPosted: Wed Mar 25, 2015 10:17 am    Post subject: Reply with quote

I converted my HDDs with gdisk (four of them), without issues, though I have no idea how safe that is. Get a backup. After conversion gdisk reports gPT as active and MBR as protective. This should mean that both are usable but GPT is prefered. You can reinstall grub with grub-install /dev/sdX.

EDIT:

You're using legacy boot, or do not have UEFI support at all. in either case grub will expect a partition the size of 1 to 2 MB and with the type of ef02. Do not know if the partition must be at the begining of the drive (considering BIOS/legacy limitation that may be the case). Using (f|g)disk usually leaves sectors 34 to 2048 unalocated, which can be used for this partition, but may result in misaligned partition table.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6289

PostPosted: Wed Mar 25, 2015 12:37 pm    Post subject: Reply with quote

bstaletic wrote:
grub will expect a partition the size of 1 to 2 MB and with the type of ef02

Thanks for the hint. This sounds dangerous to arrange afterwards. Perhaps I leave it as it is:

Although the disk is 3TB, no partition is larger than 2TB, and so far I seemed to have no problem.
More important: The fdisk and cfdisk utililities of current util-linux report the size/end of that partition which goes over the 2TB-limit to the end correctly.
Moreover, I would also have expected parted to complain when I partitioned it: It refused to create a partition larger than 2TB, but did not print a warning with my setup.
So I suppose that my partitioning is at least semi-officially supported.
To me, it is only important that the current linux kernel (in particular, the dm-crypt device mapper) does not calculate "modulo 2TB".
There is a slight chance that it does and I was just "lucky" and did not realize the damage yet...

However, it seems both, doing the conversion (and adding artificially a "grub" partition) or just going on, is somewhat risky...
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43359
Location: 56N 3W

PostPosted: Wed Mar 25, 2015 6:45 pm    Post subject: Reply with quote

bstaletic,

The protective MSDOS partition table is a fake. It contains exactly one partition of type 0xee.
Its sole use is to carry the bootable flag when you mix GPT and BIOS since the BIOS can only read the MSDOS partition table.

mv,

Many years ago there was a convention in MSDOS land that partitions must start and end on a cylinder boundary.
It was only a convention - DOS doesn't care. fdisk obeys the convention, so any space less than a complete cylinder at the end of the drive is wasted.
fdisk won't tell you about it. With GPT, thats all changed.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum