# Urgent Help Needed for Repairing ext3 partition

## Belboz

Help!!!

I have had my Gentoo Linux system working great for weeks now.

I have three HD's in the system.  My main boot drive is the Primary master on the motherboard.  A second drive is the primary slave and a third drive on a promise ATA133 card.  

The first drive is fine and contains my root file system and swap space.  (ext3 partition)

The second drive on the primary/slave is fine also.  It contains an ext3 partition for storage of downloads and such.

The drive on the promise card is a 160GB drive partitioned into two partitions (both ext3).   For storing captured video.

Anyway, I popped out the primary master drive (it is in a removable drive tray) and popped in my Windows XP drive.  I booted into windows so I could export my Outlook email and bring it into Evolution.

So I do that and shutdown windows.  Put the Gentoo Linux boot drive back in and boot up.

I notice when I boot though that the first partition on my 160GB drive wasn't mounted.  The partitions on the Master and slave drives on the motherboard are fine.

The second partition on the 160GB drive on the Promise controller is fine also.  I just can't mount the first one.

An fdisk -l /dev/hde reports the following

Disk /dev/hde: 255 heads, 63 sectors, 19929 cylinders

Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System

/dev/hde1             1      9971  80092026   83  Linux

/dev/hde2          9972     19929  79987635   83  Linux

Which is fine.

When I try to mount it I get the following.

mount: wrong fs type, bad option, bad superblock on /dev/hde1,

       or too many mounted file systems

I have looked at the fsck.ext3 man page but was hoping for some guidance on how to best use it.  I see pages talking about it repairing superblocks with a backup superblock, but it talks about knowing the block size and I am not sure.

I have a ton of data on that partition I would hate to lose.

So if any gurus out there can give me any guidance I would most appreciate it.

----------

## pjp

Have you tried mount -t ext3 with the first partition?

----------

## Belboz

 *kanuslupus wrote:*   

> Have you tried mount -t ext3 with the first partition?

 

Yes same error.

The system was working great and was automounting the partition on bootup.

I fear XP overwrote something when I booted it.

----------

## rommel

well when the file system is created it creates multiple superblocks...have you tried to mount the drive using another superblock other then the first or 'default'?

----------

## Belboz

 *rommel wrote:*   

> well when the file system is created it creates multiple superblocks...have you tried to mount the drive using another superblock other then the first or 'default'?

 

I wasn't sure how to know where the extra superblocks are.  I am assuming I would do something like this to try that.

mount -t ext3 -o bs=8193 /dev/hde1 /drived

I'm just not sure what the bs parameter should be.

I ran a fsck.ext3 with the -n parameter so it doesn't actually do anything.  I got a ton of the following.

Directories count wrong for group #262 (0, counted=1).

Fix? no

Free inodes count wrong for group #263 (16384, counted=16378).

Fix? no

Directories count wrong for group #263 (0, counted=1).

Fix? no

Free inodes count wrong for group #264 (16384, counted=16382).

Fix? no

Do you guys think I should do a 

fsck.ext3 /dev/hde1

?

----------

## Belboz

I did a 

mke2fs -n -b 1024 /dev/hde1

Which gave me the location of the superblocks (I am assuming the system is using 1K block sizes.

I tried a

mount -t ext3 -o sb=8193 /dev/hde1 /drived

And got the same error as before.  I tried a bunch of the other superblocks also and they didn't work either.

mount: wrong fs type, bad option, bad superblock on /dev/hde1,

       or too many mounted file systems

I haven't run the fsck.ext3 /dev/hde1 yet in case anyone has any other words of wisdom for me.Last edited by Belboz on Fri Jul 05, 2002 7:19 pm; edited 1 time in total

----------

## delta407

Silly question, but do you have too many mounted filesystems?  :Very Happy: 

----------

## Belboz

 *delta407 wrote:*   

> Silly question, but do you have too many mounted filesystems? 

 

What is too many?

Here is what I have now.

```

user002 root # df                    

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/hda3             28913920   5252640  22192540  20% /

tmpfs                     1024       152       872  15% /mnt/.init.d

/dev/hdb1             59084932  47007172   9076420  84% /drivef

/dev/hde2             78731104  29176420  45555304  40% /drivee

//192.168.0.1/httpd   14273280   6219520   8053760  44% /mnt/webserve

//192.168.0.1/homes   14273280   6219520   8053760  44% /mnt/music

```

----------

## delta407

Okay, nevermind, you're good.

Did you run fsck? If Windows just screwed it up a little bit fsck should be able to bring it back without losing any data.

----------

## Belboz

Well it looks like Windows XP changed it to a FAT32 partition.

Just for the hell of it I did a 

mount -t vfat /dev/hde1 /drived

and it worked.  Course the partition is listed as having complete garbage on it.

I have a bad feeling this partition is going to be completely hosed.

What sucks is all I did was boot Windows XP and then shutdown and boot Gentoo.

----------

## rommel

yeah is there a limit to the number of mounted filesystems?...seems strange that just that partition was effected when you swaped drives...wasnt there still the original slave installed too...did you copy something over from windows to that partition?

----------

## pjp

Have you tried changing it back to an ext3?

----------

## delta407

It didn't change to a FAT32 partitition; someone else a while ago had a problem where an ext3 partition was being read as a vfat partition. It's not actually vfat, run fsck on it and see what happens.

----------

## Belboz

 *rommel wrote:*   

> yeah is there a limit to the number of mounted filesystems?...seems strange that just that partition was effected when you swaped drives...wasnt there still the original slave installed too...did you copy something over from windows to that partition?

 

The original boot drive with Gentoo (the primary master) was pulled out and a new Primary master with XP was put in.

I had a primary slave drive which had one ext3 partition on it and it didn't seem efected by this.

The Primary master drive on the Promise card was the only one that was effected and only the first partition.

I can't think of anything I did that would have caused the partition to be hosed.

I basically booted XP.  Loaded Mozilla so I could import my Outlook PST file with it.  Took the mozilla mbx files and burnt them to a CD.  Shutdown XP.  

Every file operation I did was to the C drive which was the NTFS partition on the Primary master drive in the drive tray I swapped.

The only thing I can think of is that originally the last time I used Windows XP on that drive I popped in to boot from the other partitions for all those other drives were NTFS or FAT32.  I shut down XP on that drive and installed Gentoo Linux on a new primary master drive.  I then erased the NTFS or FAT32 partition on the Primary/Slave and the Promise card.

So maybe when XP was rebooted and it didn't see those drives containing any valid partitions it tried to fix it.  

Wierd thing is only the one partition was effected.

----------

## Belboz

Well after fsck.ext3 churned away on it for awhile I crossed my fingers and tried to mount it.

It mounted cleanly....

Then the big test was to see what a directory looked like on it.

It had a valid directory!

Then I tried to view some of my mpeg captures on the partition with mplayer and they played fine!

So it "looks" like it survived.  I have a ton of files on it, so I am hoping they all are fine.

I would love to know why this happened.  I will have to boot into XP again sometime and I hate the thought of having to go inside the PC case and unhook a drive just so it doesn't get damaged.

Thanks to everyone for the quick response.  I was pretty worried I was going to lose a ton of stuff.

----------

## pjp

Glad it is fixed.  In the end it wouldn't have mattered though.  You could have just restored from a backup.  :Wink: 

----------

## rommel

mm...sounds like you may have answered your question...if xp remembered the drives that were there as being ntfs or fat and tried to mount them because they were installed the last time it was running.....well good it worked out anyway

----------

## Belboz

 *kanuslupus wrote:*   

> Glad it is fixed.  In the end it wouldn't have mattered though.  You could have just restored from a backup. 

 

 :Sad: 

Sadly my biggest problem is most of the files on that partition are 2GB+ mpeg video captures I made of TV shows or movies.  So I have to edit them first to chop out the junk and then burn to SVCD or DVD. 

So since they are so big I don't back them up until I edit them to their "final" state.  They are just too big to backup (guess I could get a tape drive).

They wouldn't build up as bad if I wasn't so lazy.  It is such a pain to edit them.    :Very Happy: 

Now if there was just a good mpeg editor for Linux.....

----------

## pjp

I was just yanking your chain.  I don't backup much, cause I don't have much I can't

live without.  Mainly just some docs, not even a full CD.  If you can, you might get another

HD and use it for backup.  Only mount it readonly (if at all) until you need to write to it.  Kind 

of like /boot.  This would give you a 2nd copy.  Obviously using a partition on the same 

physical drive is not the best option.

----------

