William Denton <wtd@pobox.com>
Home ›
How I recovered a lost partition
Submitted by wtd on 31 August 2010 - 7:17pm
Last week I was setting up a bunch of drives for a new backup system (which I'll post about soon) and while partitioning and formatting I accidentally removed the single partition from my main laptop. That was not good. I knew it would keep on working as long as it stayed on, but when it rebooted, I'd be in trouble. I had backups, and if it came to the worst, I could reinstall Ubuntu and copy my files back, but that would take an evening, after all the various programs and packages I use had downloaded and installed.
With a bit of luck, though, it only took about twenty minutes.
- I booted up into Ubuntu on a USB stick.
- I installed TestDisk and used this step-by-step guide to recover my lost partition.
- I rebooted. The partition was there, but the computer didn't know how to boot.
- So I reinstalled GRUB. I can't find the actual page I used with the commands, but my drive was /dev/sda, the partition I'd recovered was /dev/sda1, and I did this:
-
sudo mount /mnt /dev/sda1 -
sudo grub-install --mount-directory /mnt /dev/sda (note -
sudo umount /mnt
/dev/sdahere, even though I mounted/dev/sda1) -
- I rebooted, and it came up fine, but with a warning about a missing disk. I'd lost my swap space.
- I used gparted to allocate swap space out of some empty disk space that probably was swap space before but got lost along the way. I had to edit
/etc/fstabto say that/dev/sda2was swap space now. - Rebooted and all was well.
Phew! TestDisk is extremely helpful.
Main menu
"Legendo autem et scribendo vitam procudito." — Marcus Terentius Varro (116 - 27 B.C.)
Links
identi.ca
Recent comments
- Quite right. I also consider
3 weeks 4 days ago - Don't forget Doom, Octopus,
3 weeks 4 days ago - Harnum finished reading the
4 weeks 1 day ago - Very excellent. Finishing up
8 weeks 1 day ago - Shouldn't this require an
8 weeks 1 day ago - This is very very
8 weeks 4 days ago - Back when I wrote using troff
8 weeks 6 days ago - These prices seem very low
12 weeks 1 day ago - Summon, abt 40.000$/yr in
13 weeks 9 min ago - There can be legitimate
13 weeks 1 day ago


Comments
Post new comment