Went crazy with fdisk and now can't boot. Grub emergency console.
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?)
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
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.