# Urgent file system help needed

## bichodomato

Urgent file system help needed

Hello

I'm currently trying to resurrect a machine I installed 1 year ago. When I tried to start the machine a kernel panic occurred: VFS: Cannot open root device hda3 etc etc.

I've made what I think are a series of errors and I'm wondering what I can do:

I booted with the live CD and noticed with fdisk -l the partitions were listed as hdd1, hdd2 and hdd3 - ie. not hda. It should have occurred to me that the hdd had been removed, then replaced and cabled up differently by others  but it didn't....

I ran e2fsck /dev/hdd3 and then after fixing the errors  on boot, the system attempted to mount the partition as an ext2 rather than a ext3.

eg. when booting from the live cd I was able to do:

mount -t ext2 /dev/hdd2 but not mount -t ext3 /dev/hdd3

when doing the former, the contents of /mnt/gentoo were: autoresponse-1.1.4.conf (i think) and lost+found

I then did what I think was an even bigger mistake:

tune2fs -j /dev/hda3

It now mounts with mount -t ext2 /dev/hdd3 but again my file system is absent from /mnt/gentoo

Is the situation terminal or can I recover the system from this??

Hope someone can help!

Iain

----------

## erik258

IF it's supposed to be hda it needs to be the primary ide master.  hdd is the secondary ide slave.

----------

## anthrax

Well ext3 is able to be mounted as ext2 since it just doesnt bother using the ext3 journal.

Did you mean "tune2fs -j /dev/hdd3" because if you meant what you typed you never made a new journal for anything since no devices were present on the end of those device nodes. Even if you did, that just recreates the journal which as far as I am aware doesnt format the filesystem. If you did mean the /dev/hda3 part then that partition had lost data before you came to it because as I mentioned tune2fs would have been aimed at a non-existant partition on a non-existant drive. 

Clarification if you would be so good  :Wink: 

----------

## bichodomato

Thanks for the replies. Yes i did mean tune2fs -j /dev/hdd3, sorry. In answer to the first reply. Yes you're right - and it seems the drive was set up as a slave device in my absence. Trying to fix that up now.

iain

----------

## bichodomato

OK - have fixed the drive so partitions appear as hda1/2/3 when running fdisk -l from LiveCD. Running "mount -t ext3 /dev/hda3 /mnt/gentoo" produces no errors. However /mnt/gentoo still contains only two entries: autoresponse-1.1.4.conf and lost+found.

i

----------

## bichodomato

Running out of time - the machine is due to be used in an exhibition in a few days - hope someone can help - else i'll install a new hdd and start again.    :Sad: 

cheers, 

Iain

----------

## bichodomato

Sorry to keep bumping this - but the output of "fdisk -l /dev/hda3" looks revealing:

Disk /dev/hda3: 79.4 GB, 79464430080 bytes

255 heads, 63 sectors/track, 9661 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/hda3 doesn't contain a valid partition table

Could this last line be the clue?

hda1 and hda2 are also identified as having no valid tables

iain

----------

## erik258

 *Quote:*   

> 
> 
> Disk /dev/hda3: 79.4 GB, 79464430080 bytes
> 
> 255 heads, 63 sectors/track, 9661 cylinders
> ...

 

no, this output is fine.  

/dev/hda is the hard disk iteslf.  

/dev/hda3 is the third partition on that  hard disk.  

/dev/hda3 the partition could have a valid partition table i guess, and i remember in netBSD, if I recall properly, the root partition was divided up into many subdivisions, and probably had a partition table at the usual place, which i think is the 446th byte or so from the beginning, right after the master boot record,  but i'm not sure.   

On the other hand, if you followed the gentoo howto you certainly shouldn't have partition tables anywhere but the beginning of the drive.  So the result of the command fdisk -l /dev/hda3 looks fine. 

 *Quote:*   

> Running out of time - the machine is due to be used in an exhibition in a few days - hope someone can help - else i'll install a new hdd and start again. 

 

let's try to find those files of yours ; )

first step is to make sure the right partition really is mounted at the right spot, so type 'mount' with no options and doubl.e-check, then triple-check.  

i think in fact you'll find that /dev/hda2 snuck in there somewhere, because you report: 

 *Quote:*   

> 
> 
> when booting from the live cd I was able to do:
> 
> mount -t ext2 /dev/hdd2 but not mount -t ext3 /dev/hdd3
> ...

 

it looks to me like that one's still mounted there.  your commands could have wiped out that whole drive, for all i know, but i can be very certain that  the commands you showed here did notput autoresponse-whatever on there.  so it looks like we haven't yet found your root partition.  

frankly now with the typo and everything i'm confused as to which partition you are supposted to be mounting as the root of your system.  better 

```
fdisk /dev/hda #note the lack of any numbers after hda
```

and post the output just to make sure.  

i would think you can drop the -t ext3 and -t ext2; just trust that mount will know the filesystem type, and that it will be journaled now if it was before.  mount is pretty smart on my machines ; ) .  

i think you can have this system up soon.  if you are migrating it over to new hardware, i've done that many times and would be happy to help.  

but, assuming you did mount the right partition and you have in fact lost your files...

 it doesn't look like tune2fs would destroy anything if you told it to create a new ext3 journal on an already journaled filesystem.  but it certainly seems like it did ; ) so if that's so, i would guess it probably destroyed the filesystem's metadata, rather tha n the data itself, or just corrupted the metadata a little maybe.  in that case, perhaps we can recover your files.  

i looked into e2fsck, the program responsible for checking ext[23] filesystems.  some interesting options are   -b to specify a backup superblock to check (rmad man page) and 

 *Quote:*   

>        -p     Automatically repair ("preen") the  file  system.   This  option
> 
>               will  case  e2fsck  to automatically fix any filesystem problems
> 
>               that can be safely fixed without human intervention.  If  e2fsck
> ...

 

you may find this to bolster your hope...

 *Quote:*   

> SEE ALSO
> 
>        badblocks(8),   dumpe2fs(8),   debugfs(8),    e2image(8),    mke2fs(8),
> 
>        tune2fs(8)

 

...but none of it seemed that helpful to me.  c

by the way, ext3 is much, much slower than xfs and reiserfs.  Accordingto the developer that wrote the Developer's Stage 1 + NPTL Howto, reiserfs4 puts the other filesystems to shame and is wonderfully stable.  I can certainly agree that it's much faster than ext[23] and seems faster than xfs too.  I can also vouch for the stability.  Only once, with all my computers' crashes and breakings, have I ever managed to a corrupt reiserfs on a working hard disk, and in that case it was raided and the problem stemmed from a bizarre combination of all kinds of NFS & RAID sparks.  Even them, I was able to fix the few dozen inode tree errors without problems and, even with the additional complication of raid, i lowt no data.  I recommend using rieserfs if it does come to reinstalling ..

----------

## bichodomato

Hi erik258  thanks again for the reply. I'm in the process of rebuilding the system on a new drive using Ubuntu  but if it can be fixed in Gentoo that would be great - because the setip is complicated. So  while your there I'll re-insert the gentoo drive......

To clear things up: 

1. I have one hard disk on the machine. After fixing up the canling there are 3 partitions now showing up as /dev/hda1 /dev/hda2 and /dev/hda3 (boot, swap and root). Yes, I did follow the Gentoo Howto closely on the initial install.

2. Yet another typo sorry. When i said  *Quote:*   

> when booting from the live cd I was able to do: 
> 
> mount -t ext2 /dev/hdd2 but not mount -t ext3 /dev/hdd3 
> 
> when doing the former, the contents of /mnt/gentoo were: autoresponse-1.1.4.conf (i think) and lost+found

 

I really meant:

when booting from the live cd I was able to do: 

mount -t ext2 /dev/hdd3 /mnt/gentoo but not mount -t ext3 /dev/hdd3 /mnt/gentoo

The output of fdisk -l /dev/hda is:

Disk /dev/hda: 80.0 GB, 80026361856 bytes

255 heads, 63 sectors/tracks, 9729 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

[ index line skipped ]

/dev/hda1 * 1 5 40131 83 Linux

/dev/hda2   6 68 506047+ 82 Linux swap / Solaris

/dev/hda3   69 9729 77601982+ 83 Linux

cheers,

iain

----------

## erik258

what a nice synopsis.  the only point i need to discuss is, 

Yet another typo sorry. When i said

Quote:

when booting from the live cd I was able to do:

 *Quote:*   

> 
> 
>  *Quote:*   mount -t ext2 /dev/hdd2 but not mount -t ext3 /dev/hdd3
> 
> when doing the former, the contents of /mnt/gentoo were: autoresponse-1.1.4.conf (i think) and lost+found 
> ...

 

oh yeah, i guess you didn't specifiy the mount point.  but i don't care about that.  i didn't even notice ; ) more importantly, you say hdd2 had those files on it, then mysteriously after running tune2fs as indicated these files show up on /dev/hdd3.  I'm just saying it's mighty suspicious that this would happen.  are you sure you had the right thing mounted?  

and while i'm at it - i find it odd that the second partition is mountable as ext2.  it should be swap, right?  

 *Quote:*   

> /dev/hda2 6 68 506047+ 82 Linux swap / Solaris 

 

----------

## bichodomato

no sorry hdd2 was the typo (/mnt/gentoo an omission). Didn't ever mount hdd2 - just hdd3 (now hda3).

i

----------

## erik258

welll, it doesn't look like there ever was   a gentoo installation on there.  i have no idea what autoresponse is.  

i guess you should go ahead and continue the reinstall : ( sorry.

----------

## bichodomato

Well there was once (grub still shows on boot) - but it was left with others for a year and anything could have happened....

ok - will press on with ubuntu... thanks for trying.

iain

----------

