LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-22-2016, 01:15 PM   #1
road hazard
Member
 
Registered: Nov 2015
Posts: 241

Rep: Reputation: Disabled
Went crazy with fdisk and now can't boot. Grub emergency console.


I was nuking partitions off scratch disks as I play around with mdadm and it would appear I got carried away and managed to delete my boot drive's partition. When my Mint install boots, I'm dumped out to a 'grub emergency' console. I found some steps here:
https://www.linux.com/learn/how-resc...g-grub-2-linux

but when I issue the 'ls' command, I don't see anything like this; (hd0) (hd0,msdos2) (hd0,msdos1)......... I get: (hd0), (hd1), (hd2), (hd3), (hd4), (hd5), (hd6)

If I boot from an Live CD and try to mount /dev/sda1 (where my boot drive USE to be), I get an error about "unknown partition" or "no partition exists"......(forget the exact error). Is this recoverable or am I totally boned?

N00b alert: Is there a script that can be configured to run at every shutdown that does this: grub-install /dev/sda (as a safety net so if I did something stupid while the system is up, I know grub is getting installed at every shutdown and prevent this in the future?)
 
Old 07-22-2016, 01:40 PM   #2
wagscat123
Member
 
Registered: Jan 2009
Location: Maryland-Pennsylvania border, USA
Distribution: openSUSE 15.2/15.3, Tumbleweed, Kubuntu 18.04/21.04, macOS 10.15, antiX 19, and Linux Mint 19.3
Posts: 860
Blog Entries: 45

Rep: Reputation: 120Reputation: 120
At this point the easiest thing to do might be to fire up the Live DVD, and go into fdisk and post your parition config (fdisk /dev/sda then issue the command p "p", then you should probably enter "q" ASAP). It almost sounds like you deleted your partition table - which means you may have a long road ahead of you if you want to try to recover your data.

If just your Mint boot partition is deleted, and your other partitions are intact, things won't be too hard to fix up. Also, can you boot Windows, since I see you posted under 7?

Heads up - "Don't drink and Root". You probably could put that in a systemd script, but routinely messing with your startup configuration unnecessarily can add some dangerous complications. Your better off just thinking before you su or sudo, backing up, and perhaps using some GUI partitioning tool with a ton of documentation, as well as learning about how Linux and partitioning works if you're new to those.

If you want to mess around with low lying system settings, you should try installing something under VirtualBox and messing with your partition scheme and boot settings there.

Last edited by wagscat123; 07-22-2016 at 01:45 PM. Reason: Mentioned virtual box
 
Old 07-22-2016, 01:46 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,568

Rep: Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865
While running a live CD you can view the existing partitions if any still exist using gparted or from the command line tool fdisk.

fdisk -l (that is a small L)

If you did not write data to the drive in any manner while playing with mdadm then everything is intact and by recreating the partitions exactly as they were you should be able to boot mint. Otherwise your probably boned as you put it. The difficult part is determining how the drive was originally partitioned... You can do that with testdisk.

http://www.dedoimedo.com/computers/l...-recovery.html

No, in your case grub is not the problem. You deleted the partitions on the hard drive and grub could not find them. The safety net is to have a good backup and don't mess up.
 
Old 07-22-2016, 04:47 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,767

Rep: Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209
The tool of choice for recovering lost partitions is testdisk. If all that happened was damage to the partition table, it can almost always recover the partition structure. You can find testdisk as well as a lot of other recovery tools on SystemRescueCD.
 
  


Reply

Tags
emergency, grub 2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] 911 Emergency - Remove Grub and Restore Windows 7 Boot loader anoopch Linux - General 8 10-26-2010 04:23 AM
GRUB emergency boot CD for a x64bit dual boot chasfgr Linux - Newbie 5 08-17-2010 02:51 PM
df and fdisk conflict and grub therefore won't boot or run setup mclinkor Linux - General 10 10-17-2008 03:54 PM
fdisk, sfdisk, cfdisk: driving me crazy rosslaird Linux - Software 3 02-14-2005 01:21 PM
Boot stops at Grub console? Mark Regler Linux - Newbie 7 05-28-2003 09:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration