Currently I’m in an interesting situation…
- Incorrectly formatted M.2 which has a bad partition format, that does not support booting via UEFI
- Full two systems already installed and in use(Fedora and win)
I need to have my system as a UEFI bootable, format the whole M.2 drive and restore the existing systems so they would still work as before.
Best solution would be creating a backup and copy/paste it with dd like
dd if=/dev/sba1 of=/home/backup bs=16M
Which I’m nearly sure will have problems, what would a proper way of going about this be? Perhaps any software anyone could suggest?
P.S. lmgtfy has failed to answer this specific question
As in the M.2 has a MBR partition table vs GPT? Or your missing an ESP?
I am not sure at this moment, as I cannot check, but the problem came to me when I attempted to install fedora on the drive with UEFI, the installation stated that disk has invalid partition format(or table) and UEFI installation cannot proceed without formatting the whole drive. After I attempt the installation again, I will provide full details of this.
That reads like the m.2 has MBR partitioning. UEFI (needs/easier) GPT(GUID partition table) partitioning.
MBR has a small partition in the beginning that contain the boot loaders. GPT has a legitimate FAT32 partition(100mb-1GB depending on OS defaults when it’s a fresh drive) containing .EFI files for each OS.
For some more info on all this mess http://www.rodsbooks.com/efi-bootloaders/index.html
Dude makes a bootloader called rEFInd that might be in Fedora repos if your lucky. Think of it like GRUB for UEFI.
But if your m.2 is MBR and you need GPT, dd is a good/safe option. Keep in mind that it copies empty space into the backup, so if you have 10GB of data in a 100GB partition, the resulting image will be 100GB for the command you have listed in OP
Any tips on safely dd’ing the partition back, without fucking things up?
Did you make a backup of the partition or the entire drive?
Drive is ~500GB, partition is ~120GB, I can do both, if necessary for a full byte to byte backup before doing anything “extreme”.
I don’t assume changing to GPT and recovering partitions would work
Are you trying to retain an OS partition?
These are all relevant questions for safety purposes
Either way, make sure the partition being backed up/written to are NOT mounted, makes sure other things aren’t touching the data, potential read/write error prevention.
MAKE sure the partition being written to by the backup exists first or dd will put data where you don’t want it
dd if=/dev/sdX# conv=sync,noerror bs=## | gzip -c > /path/to/backup.img.gz
gunzip -c /path/to/backup.img.gz | dd of=/dev/sdX#
Run as root#
If you don’t want to play with pipes and gzip
dd if=/dev/sdX# conv=sync,noerror bs=## of=/path/that/you/want/file.stuff
dd if=/path/that/you/want/file.stuff of=/dev/sdX# bs=##
bs is your call, won’t affect actual drive bs, rule of thumb is half the transfer speed of the drive or just disk cache size.
Obviously don’t delete the backup till you verify it’s good.
SuperEdit: I’m on mobile so check formatting, also look at manage of dd for distro your using to dd. Not all dds are the same.
TASK COMPLETE! But one thing… grub2 nor grub detects the partition as a bootable windows partition… How do I go about that?
Sorry Tom_Lee haven’t been here in a bit.
Do you still have the bootx64.EFI in your ESP for windowzer?
May need to do a repair disk job for Windows. I don’t really remember anything about the OS and I haven’t played with 10 yet, so I probably won’t be much help here.
You can try rEFInd. I find it’s search capabilities much better then GRUB, being that you can rebuild from boot instead of having to rebuild when in OS.
Have you tried reconfiguring GRUB or whatever the hell the verb is for rebuilding the configuration of bootables is that has eluded me?
M.2 -> now efi boot, gpt partition table
HDD -> efi boot, gpt partition, has windows 10 ( that I WILL DELETE, no remorse)
Now I have a backup of the windows MBR boot partition and Windows partition (350MB and ~120GB)
I would like to restore the partition to M.2. I’ve dd’ed it back to m.2, it recognized it properly, BUT I cannot, for the love of spaghetti monster, get GRUB2 ( EFI boot ) to recognize it, I’ve also attempted to restore the boot partition of windows (350MB backup), but since the location of windows partition is invalid - it effectively would fail.
Unless you you want to play with EFI shell v2, then you may want to try rEFInd.