B
B
BlagoYar Silence2021-10-13 04:14:27
linux
BlagoYar Silence, 2021-10-13 04:14:27

Is it possible to restore an MBR backup to GPT?

That is, I make a backup through --one-file-systemthe MBR system (Debian).
Is it possible to format a disk in GPT and deploy such a backup?
Will work?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
hint000, 2021-10-13
@hint000

1. It should have been clarified in the question that you are backing up with tar, because there are a hundred other ways.
2. Yes, you can; tar knows nothing about how to partition a disk, it doesn't care, it works at a higher level - with the file system, not with the block device. So the partition must already have a file system before tar restores it (i.e. it must be formatted if the partition was re-created by the partitioning utility).
3. What about the boot partition? It needs to be thought of separately.

R
rPman, 2021-10-13
@rPman

hint000 absolutely right
From myself I will add, for the boot partition in gpt
* if legacy boot is used (using mbr boot sector), you need to create a 1mb biosboot partition (it will fill grub automatically when you do grub-setup)
* if you use uefi boot, then you need to create a ~128mb efiboot partition , fat format, grub-setup will fill it automatically (if the current linux boot is done using the efi menu, an important point, otherwise efimgr will not be able to access the partition table in the BIOS)
In both cases, the /boot partition is not required, if the root system is simple(not hosted on raid, lvm or not encrypted and other complex configs) and formatted into the well-known grub file system ext/btrfs/...
ps boot partitions should be located approximately from the beginning of the disk, up to 2tb, otherwise there may be problems at uefi. For this reason, the /boot partition is still created to ensure that boot files do not go beyond this border
, you can restore the backup simply by expanding tar, provided that the file system structure is mounted properly (it happens that when creating a backup, only the root system is placed in it without /boot /efi and other things, then don't care)
after restoring grub-setup and grub-update are required (when working with cdrom and mounting the root not to the root, specify it using --root-directory
grub-setup (more precisely, it launches efibootmgr) is required for uefi boot, it prescribes a link to the disk in the BIOS in the menu (thanks to microsoft for this crap in the standard), it is not required to boot from flash drives (removable devices).
pps do not forget to correct /etc/fstab, if the partitions are registered there by uuid, creating new partitions, they are given new identifiers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question