View Full Version : Find lost /home partition

10th August 2008, 03:01 AM
While trying to help me get the Fedora 9 x64 upgrader to boot and install off an internet mirror, my host somehow managed to delete the partition tables from both of my server's hard disks.

I think I've managed to recover the table for the primary disk (sda) using a combination of parted, gpart (http://www.stud.uni-hannover.de/user/76201/gpart/) and fdisk. However I have been unsuccessful in my attempts to recover the table for the second disk (sdb), which is the one reserved just for /home... so as you can imagine, I'd really like it back in one piece!.

parted and gpart give very strange and very different results when I run it on sdb, as is shown in the three screenshots I've attached. parted finds a random 428MB partition at the beginning of the disk, and then nothing... gpart finds two 1024MB partitions, one at each end of the disk.

I did of course take backups of most (but not all) of the contents of the /home partition (as well as the important bits of everything else) before starting all of this, and one of the things I got was the anaconda-ks.cfg file out of /root, which has the partition configuration I used when setting up the server - I've pasted the relevant section below:

#part /boot --fstype ext3 --size=100 --ondisk=sda --asprimary
#part /var --fstype ext3 --size=30720 --ondisk=sda
#part /usr --fstype ext3 --size=30720 --ondisk=sda
#part / --fstype ext3 --size=15360 --ondisk=sda --asprimary
#part swap --size=1024
#part /opt --fstype ext3 --size=100 --grow --ondisk=sda
#part /home --fstype ext3 --size=100 --grow --ondisk=sdb

From what I can remember, I *think* that the swap partition ended up somewhere on the second disk, although I can't be 100% sure. I do have the disk space information output from logwatch, but this isn't very helpful either:

Filesystem Size Used Avail Use% Mounted on
/dev/sda2 15G 1.6G 13G 12% /
/dev/sda1 99M 48M 47M 51% /boot
/dev/sdb2 225G 98G 116G 46% /home
/dev/sda6 153G 18G 127G 13% /opt
/dev/sda5 30G 4.1G 24G 15% /usr
/dev/sda3 30G 2.0G 26G 8% /var

Since I'm now only missing /home, I should be able to get any other files out of the other system folders if they'll help (eg. /etc, /var/log, etc).

I've tried writing all kind of combination of partition sizes to sdb using fdisk, but none of them have managed to make e2fsck even remotely happy - it does nothing but complain that it can't find a superblock. Unless there's a file hidden away somewhere that might prove quicker in finding the /home partition, is there a way to search the entire disk for the elusive superblock(s)?

Thanks in advance for any help or pointers :)

10th August 2008, 03:16 AM
I have read many threads here where people successfully recovered partitions using TestDisk (http://www.cgsecurity.org/wiki/TestDisk). It is available in a variety of versions. I keep the DOS version handy on a floppy and a CD just in case. I have used it a few times for various problems. It may be worth a try for your lost partition.

10th August 2008, 01:07 PM
TestDisk found it! :D

I haven't run a full check on it yet, but e2fsck appears happy; no errors about superblocks or anything :)

I've taken backup screenshots of fdisk -l and fdsk -u -l for both disks, as recommended by another website, in case it happens again.

Many thanks for the help :)