Any way to save a corrupt partition?

Deeko

Lifer
Jun 16, 2000
30,213
12
81
So I was installing a new linux distro, when the installer decided to take it upon itself to screw up my Windows partition. It wasn't even supposed to touch that drive...yet it did, and now both partitions on that drive no longer show up as 'ntfs', they are now 'unknown' and can't be mounted.

Any way to fix this?
 

Deeko

Lifer
Jun 16, 2000
30,213
12
81
ubuntu 6.0.6

After waging a day-long battle with GRUB I have successfully managed to get back into my OLD linux (ubuntu 5.10)...still no luck with the Windows partition though.
 

cker

Member
Dec 19, 2005
175
0
0
Do you know if you've formatted over any of the NTFS space?

If the actual partition dimensions (start/end cylinder) have not changed, then you may be able to boot from a recovery disc or Tom's Root Boot or something, and change the partition type in fdisk. If you're talking about /dev/hda, with the first partition being the NTFS partition you want to retag, then you'd
fdisk /dev/hda

I think it's 't' to set the type for a partition, '1' to select the first partition, then 'L' should list the partition types. Look for NTFS and try that.

In my case, I deleted my partition table but, since I was installing multiple OSes I had a little card with my partition geometries at hand. I was able to go back, delete the bad partition table, and create partitions that matched the old layout.

Please note, though, if you've formatted the old NTFS partition, you're unlikely to recover anything. I don't know about the viability of attacking an NTFS partition overwritten with a Linux filesystem with recovery tools. Maybe you could get something back? I tried some Windows file recovery stuff a while back with poor results, so I don't really recall the (free) tool I tried. Maybe some others have suggestions for NTFS recovery programs?
 

Deeko

Lifer
Jun 16, 2000
30,213
12
81
I haven't formatted over anything. The Windows stuff is on a completely different drive from the one I was working with (yes, it is hda - the linux partitions are on hdd). If I can find a book disk lying around I'll give fdisk a try, thanks. If I can't though...are there any linux utilities that will do something similar? I have gparted but all it seems to be able to do is create/delete partitions. It has a "convert to" option, but says it deletes everything.
 

SleepWalkerX

Platinum Member
Jun 29, 2004
2,649
0
0
Maybe you could try to see if the windows install cd can detect it and then try to do a repair install or something.
 

Deeko

Lifer
Jun 16, 2000
30,213
12
81
I'm trying to use gpart, but I get a seek failure...even when I try to check the drive that is good (the one I'm on). hmm
 

cker

Member
Dec 19, 2005
175
0
0
Tom's root boot is at http://www.toms.net/rb/

SleepWalkerX could be on to something, but I expect Windows will not look past the partition type. Still so long as Windows isn't going to overwrite anything, it may be worth a shot.

fdisk is really the lowest-common-denominator -- it is a basic partition table editor. If the system is up and running under Linux you can probably run fdisk without a boot disk. I had it in my head that the system was not bootable. It's just bad karma to be editing the partitions you're running in at the time, but if your Windows is on hda and Linux is on hdd, then you should be fine.

If Ubuntu will boot for you then you should be able to edit your old hda partition table with (in a shell)

sudo fdisk /dev/hda

Be sure to List your partitions and note the mapping before changing anything. You should only have to change the Type of the Windows partitions.

If you can tag the partition(s), let's say /dev/hda1, as NTFS, then you can mount it readonly to confirm the contents:

sudo mkdir /media/windows
sudo mount /dev/hda1 /media/windows/ -t ntfs -o nls=utf8,umask=0222
ls -alp /media/windows
 

Deeko

Lifer
Jun 16, 2000
30,213
12
81
hmmm....still isn't working. I saved the original(unworking) partition table and tried to rewrite it with both fdisk and cfdisk...still can't get the syetem to mount it. It says

mount: wrong fs type, bad option, bad superblock on /dev/hda1,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

which says

[ 2579.040940] NTFS-fs error (device hda1): read_ntfs_boot_sector(): Primary boot sector is invalid.
[ 2579.040948] NTFS-fs error (device hda1): read_ntfs_boot_sector(): Mount option errors=recover not used. Aborting without trying to recover.
[ 2579.040954] NTFS-fs error (device hda1): ntfs_fill_super(): Not an NTFS volume.
 

Deeko

Lifer
Jun 16, 2000
30,213
12
81
I think I've lost this war.....I can get it to mount now, but it says its an empty disk. wtf? Nothing wrote anything to that disk, nothing formatted the partitions....damn you ubuntu.