Page 1 of 1

Ooops... I've re-formatted my boot sector

Posted: Fri Feb 17, 2017 6:09 am
by ScottBouch
What a schoolboy error.. I was using gparted in a rush last night and accidentally re-formatted my boot partition.

Now when I boot, I get this:

grub-rescue.jpg


I'm happy to re-install Mint, but want to know if there is a way I can backup the files form my desktop? My drive is encrypted using the standard encryption that you can choose to do at installation.

If I re-install Mint, will it give me the option t retain my files?

Thanks, Scott (feeling like an idiot)

Re: Ooops... I've re-formatted my boot sector

Posted: Fri Feb 17, 2017 7:46 am
by fabien85
I think you should just reinstall grub, and hopefully that would solve the problem.
If you installed in Legacy/BIOS mode, here is the tutorial :
https://sites.google.com/site/easylinuxtipsproject/grub
If you installed in UEFI mode, follow that one instead :
https://sites.google.com/site/easylinuxtipsproject/6

Because your install is encrypted, it makes it more complicated to back up your files now. But it's still possible if you remember the password you used for encryption.
I need to search the references again and will post them here when I find them.
It makes a difference whether you went for whole disk encryption or just encrypted the home. Given that you mention a /boot partition, I guess you went for whole disk encryption but correct me if I'm wrong.

If you reinstall Mint, the files will be gone, and with absolutely no way to recover them (recovery software wont find them).

Re: Ooops... I've re-formatted my boot sector

Posted: Fri Feb 17, 2017 8:11 am
by fabien85
Here is a tutorial on how to access an encrypted partition from a live USB
https://stuff.wordpress.com/2012/10/29/how-to-mount-luks-encrypted-partitions-manually/
it's for a single encrypted home. If you have whole disk encryption, I guess it's going to be a little more complicated. Look at what you have in /dev/mapper/ after the third step (cryptsetup luksOpen ...), hopefully you will have some mint--vg-root and mint--vg-swap and you want to mount the root to access your files.

Re: Ooops... I've re-formatted my boot sector

Posted: Fri Feb 17, 2017 9:56 am
by austin.texas
Please clarify If the partition that you formatted was only a /boot partition, not a / (root) partition.
Post the result of

Code: Select all

sudo parted --list

Re: Ooops... I've re-formatted my boot sector

Posted: Fri Feb 17, 2017 10:22 am
by lostfarmer
fabien85-- the link you posted is dead.
I have used viewtopic.php?f=50&t=198706&p=1043424&hilit=mount+lvm#p1043424 and it works.
if you want to correctly unmoint add step 10b) sudo sudo vgchange -an mint-vg

When you formated /boot you also lost initrd and vmlinuz so reinstalling grub is of on value.

Did you format or deleted the partition, I ask due to some people will say one when they mean the other.

Re: Ooops... I've re-formatted my boot sector

Posted: Fri Feb 17, 2017 10:56 am
by ScottBouch
Hi guys, thanks for the help.

Well, I was able to boot to a Mint live iso USB stick, and able to mount the boot partition and see that I'd reformatted it to EXT4. So I put it back to FAT32.

I was also able to mount the HDD and browse (after entering the encryption password, but then I couldn't get into my home directory...


I found the link dead too, so followed some other guidance and got grub re-installed in the boot partition from the live iso, but of course it's not configured (no update-grub as I can't run a shell form the main OS), so now when I boot, I just get the freshly installed Grub prompt.
https://www.linux.com/learn/how-rescue- ... ub-2-linux

At grub prompt, I can browse the boot partition, but not the man HDD as it's encrypted - it shows up as an unknown filesystem.

I tried using Super Grub 2 to rescue it https://sourceforge.net/projects/superg ... p_redirect , but even that couldn't boot the man drive as it's encrypted.

As for the encrypted drive, i know my password, but the long auto generated passphrase, I have no idea what it was.

I think I'm going to have to call it a day and re-install from fresh, which I'm not breaking my heart over, as I'm usually pretty good at moving files to my Raid 1 NAS and keeping a tidy computer, but there are a couple of things on the desktop I'll loose and have to re-create, but it's not the end of the world.

Thanks again, Scott

Re: Ooops... I've re-formatted my boot sector

Posted: Fri Feb 17, 2017 11:51 am
by lostfarmer
Well, I was able to boot to a Mint live iso USB stick, and able to mount the boot partition and see that I'd reformatted it to EXT4. So I put it back to FAT32
The boot partition should have been ext(4)/(2) not fat, you may have formated the EFI (fat) partition not the boot partition. If so that makes it simple to recover.

Re: Ooops... I've re-formatted my boot sector

Posted: Fri Feb 17, 2017 12:54 pm
by ScottBouch
After messing around for a while, I decided to throw in the towel as I could see it taking all night.

I'm currently installing the latest Mint version, and if I've lost anything from my desktop or home folder, be it a lesson to me to keep on top of my admin.

Thanks for all the help though guys...

Stupid part of it is, this isn't the first time I've wrecked a PC though not being careful with Gparted.. Last time I re formatted the main OS drive as I was using it.. that one was definitely a write-off!

Cheers, Scott.

Re: Ooops... I've re-formatted my boot sector

Posted: Fri Feb 17, 2017 1:36 pm
by JerryF
Just a suggestion:

You may want to ask yourself if it's really necessary to encrypt. Makes life easier if you don't.

Re: Ooops... I've re-formatted my boot sector

Posted: Fri Feb 17, 2017 6:38 pm
by Pjotr
JerryF wrote:Just a suggestion:

You may want to ask yourself if it's really necessary to encrypt. Makes life easier if you don't.

+1

If you really need to encrypt, encrypt your /home only. And for Pete's sake do not select LVM just because it's an interesting looking option during the installation... In most use cases it's a completely unnecessary complication.

Re: Ooops... I've re-formatted my boot sector

Posted: Fri Feb 24, 2017 12:00 pm
by Telyx
ScottBouch wrote:What a schoolboy error.. I was using gparted in a rush last night and accidentally re-formatted my boot partition.

Now when I boot, I get this:

grub-rescue.jpg

I'm happy to re-install Mint, but want to know if there is a way I can backup the files form my desktop? My drive is encrypted using the standard encryption that you can choose to do at installation.

If I re-install Mint, will it give me the option t retain my files?

Thanks, Scott (feeling like an idiot)

Don't feel too bad... I did that myself while testing different Linux distros on a netbook. I'd write an image to my USB drive plugged into my desktop machine, try it on the netbook, reformat the USB drive, write another image to it, etc. The 4th time or so, I forgot to check (in Disks) that I'd selected the USB drive before I hit Format. Once I realized what I'd done, I was at least able to copy my pictures, documents, Firefox and Thunderbird folders, etc. to my second internal HD before attempting (unsuccessfully) to reboot. Had to reinstall, but it could have been worse.