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

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
ScottBouch
Level 1
Level 1
Posts: 21
Joined: Tue Mar 01, 2016 6:34 am

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

Postby ScottBouch » Fri Feb 17, 2017 6:09 am

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)

fabien85
Level 5
Level 5
Posts: 802
Joined: Tue Mar 11, 2014 4:30 pm

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

Postby fabien85 » Fri Feb 17, 2017 7:46 am

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 5
Level 5
Posts: 802
Joined: Tue Mar 11, 2014 4:30 pm

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

Postby fabien85 » Fri Feb 17, 2017 8:11 am

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.

User avatar
austin.texas
Level 20
Level 20
Posts: 10343
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

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

Postby austin.texas » Fri Feb 17, 2017 9:56 am

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.1 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Microsoft-free environment since 1996

Linux Linx 2017

lostfarmer
Level 3
Level 3
Posts: 135
Joined: Mon Feb 10, 2014 11:59 pm
Location: Idaho

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

Postby lostfarmer » Fri Feb 17, 2017 10:22 am

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.

ScottBouch
Level 1
Level 1
Posts: 21
Joined: Tue Mar 01, 2016 6:34 am

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

Postby ScottBouch » Fri Feb 17, 2017 10:56 am

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
Level 3
Level 3
Posts: 135
Joined: Mon Feb 10, 2014 11:59 pm
Location: Idaho

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

Postby lostfarmer » Fri Feb 17, 2017 11:51 am

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
Level 1
Level 1
Posts: 21
Joined: Tue Mar 01, 2016 6:34 am

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

Postby ScottBouch » Fri Feb 17, 2017 12:54 pm

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 4
Level 4
Posts: 461
Joined: Mon Jun 08, 2015 1:23 pm
Location: Rhode Island, USA

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

Postby JerryF » Fri Feb 17, 2017 1:36 pm

Just a suggestion:

You may want to ask yourself if it's really necessary to encrypt. Makes life easier if you don't.
Don't forget to edit your original post as [SOLVED] if your problem has been fixed.
My main language is English. I speak very little Portuguese, and a whole lot of gibberish.

User avatar
Pjotr
Level 17
Level 17
Posts: 7667
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland)
Contact:

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

Postby Pjotr » Fri Feb 17, 2017 6:38 pm

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 18.1 Serena
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.

Telyx
Level 1
Level 1
Posts: 21
Joined: Sat Mar 29, 2014 7:04 pm

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

Postby Telyx » Fri Feb 24, 2017 12:00 pm

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
Level 1
Level 1
Posts: 21
Joined: Tue Mar 01, 2016 6:34 am

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

Postby ScottBouch » Tue Apr 04, 2017 7:12 am

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: https://forums.linuxmint.com/viewtopic.php?f=90&t=240284&p=1282974#p1282974

Cheers, Scott.


Return to “Installation & Boot”

Who is online

Users browsing this forum: No registered users and 7 guests