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

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
ScottBouch

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

Post 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)
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.
fabien85
Level 7
Level 7
Posts: 1877
Joined: Tue Mar 11, 2014 4:30 pm

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

Post 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).
fabien85
Level 7
Level 7
Posts: 1877
Joined: Tue Mar 11, 2014 4:30 pm

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

Post by fabien85 »

Here is a tutorial on how to access an encrypted partition from a live USB
https://evilshit.wordpress.com/2012/10/ ... -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.
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

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

Post 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
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
lostfarmer

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

Post by lostfarmer »

fabien85-- the link you posted is dead.
I have used viewtopic.php?f=50&t=198706&p=1043424&h ... m#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.
ScottBouch

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

Post 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
lostfarmer

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

Post 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.
ScottBouch

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

Post 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.
User avatar
JerryF
Level 16
Level 16
Posts: 6570
Joined: Mon Jun 08, 2015 1:23 pm
Location: Rhode Island, USA

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

Post 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.
User avatar
Pjotr
Level 24
Level 24
Posts: 20053
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

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

Post 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.
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Telyx
Level 2
Level 2
Posts: 53
Joined: Sat Mar 29, 2014 7:04 pm

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

Post 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.
ScottBouch

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

Post by ScottBouch »

Thanks guys..

I'm sure it won't be the last time I do something silly with Gpatrted... It's all down to rushing, and I guess it's easy to get complacent after putting in your password, since so many operations require it, you get used to putting it in and carrying on without realising the potential impact elevated permissions.

Since rebuilding the PC, I've an odd issue with no way to see thumbnails of any size files, local or remote, and I've tried every setting I can find... I'm now at the point of considering re-installing all over again to try and fix the issue.

Post: viewtopic.php?f=90&t=240284&p=1282974#p1282974

Cheers, Scott.
Locked

Return to “Installation & Boot”