# Hard disk Trouble

## Major

I add a new HD so I use 

```
cfdisk /dev/hdd
```

to make a partition and 

```
mke2fs -j /dev/hdd5 
```

to format it 

I mount it and start moving some stuff in it ... after a while I heard some sound like if the reading head was hitting somewhere ... and My whole system froze ... I waited for about and hour or 2 and nothing add change so I just turn reset the PC but I cannot mount the partition again I 'm getting this error 

```
mount /dev/hdd5 /mnt/stuff

mount: /dev/hdd5 is not a valid block device

```

and I cannot check the partion with cfdisk 

```
 

 FATAL ERROR: Cannot open disk drive

                          Press any key to exit cfdisk

```

Im I screwed?

----------

## NeddySeagoon

Major,

Have you got a /dev/hdd entry in /dev?

Can you do 

```
dd if=/dev/hdd of=/dev/null bs=512 count=2
```

What have you got on /dev/hdc?

If the above works, have a look at the drive diagnostics with smartmontools. Emerge smartmontools then 

```
/usr/sbin/smartctl -h
```

is a good place to start

----------

## Major

```
dd if=/dev/hdd of=/dev/null bs=512 count=2

dd: opening `/dev/hdd': No such device or address
```

hdc is my main hard drive with gentoo and other partition ... 

hda : cdrom/dvdrom

hdb : cdrw

 *Quote:*   

> What have you got on /dev/hdc? 

 

```

dd if=/dev/hdc of=/dev/null bs=512 count=2

2+0 records in

2+0 records out

```

Ill check with smartmounttools ... I have to emerge first

----------

## Major

Ok the disk was not detected in the BIOS ... so I reboot ... but now I got these :

```

root # cfdisk /dev/hdd

No partition table or unknown signature on partition table

Do you wish to start with a zero table [y/N] ?

```

```

root # dd if=/dev/hdd of=/dev/null bs=512 count=2

2+0 records in

2+0 records out

```

```

root # smartctl -i /dev/hdd

smartctl version 5.26 Copyright (C) 2002-3 Bruce Allen

Home page is http://smartmontools.sourceforge.net/

 

=== START OF INFORMATION SECTION ===

Device Model:     MAXTOR 6L040J2

Serial Number:    662204946345

Firmware Version: AR1.0500

Device is:        Not in smartctl database [for details use: -P showall]

ATA Version is:   5

ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1

Local Time is:    Sun Apr  4 11:59:25 2004 EDT

SMART support is: Available - device has SMART capability.

SMART support is: Enabled

```

----------

## NeddySeagoon

Major,

Thats bad news about your partition table. Its gone just now but if you remember how you partitioned the drive, you can re-enter the data. Do not remake the filesystems.

There are tools around that will attempt to recreate the partition table from scanning the drive. I haven't need them (yet) so I cannot reccomend one. 

```
/usr/sbin/smartctl -a /dev/hdd
```

will show you everything the drive knows and  

```
/usr/sbin/smartctl -H /dev/hdd
```

will give you a pass/fail indication.

----------

## Major

 *Quote:*   

>  Its gone just now but if you remember how you partitioned the drive, you can re-enter the data

 

Is that mean that Ill loose the data or the data will be back ?

----------

## NeddySeagoon

Major,

It means the data is still there but you can't get at it. You may be able to restore the partition table and if that is all thats wrong, you data will reappear. If you have other things wrong, you will get to see them.

----------

## Major

so I just need to make the partition back using 

```
 cfdisk /dev/hdd 
```

and putting back the same type and size and evering ... and (crossing fingers) everything will be back ...

----------

## NeddySeagoon

Major,

Yes. *Exactly* the same. The partition table will then point to your old partitions, which will still contain the old data, unless its been trashed by whatever trashed your partition table.

----------

## Major

Sorry but again : 

```
No partition table or unknown signature on partition table

Do you wish to start with a zero table [y/N] ?

```

is that YES or NO ... what does a Zero Table means ... 

I really dont wanna loose all my stuff ...

----------

## NeddySeagoon

Major,

Your partition table lives at the end of block 0 on your hard drive.

Back it up with 

```
dd if=/dev/hdd of=/bootblock bs=512 count=1 
```

You can have a look at the file bootblock with hexedit.

The partition table starts at 0x1be and finishes at 0x1fd

The signature is in 0x1fe and should be 0xaa 0x55 (in that order)

Hexedit can read disks too but if you do 

```
hexedit /dev/hdd
```

be very careful not to save anything.

The '0x' won't appear - thats just a convention for indicating hex numbers.

----------

## Major

ok ... I think I have made my partition table back 

but I cannot mount it yet : 

```
root # mount -t ext3 /dev/hdd1 /mnt/stuff

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

       or too many mounted file systems

```

----------

## NeddySeagoon

Major,

Well, the good news is that the superblock for hdd1 can't be in the wrong place, like it can for other partitions. It can be bad though.

When you made the filesystem, several superblocks were created.

Read 

```
man mount
```

 to see how to specifiy an alterative superblock for mount to use.

You could also run fsck on /dev/hdd1 to see what it says. Don't let it attempt to fix anything though.

----------

## Major

ok that's means that the partition was on hdd5 and now its on hdd1 .... 

so that is why I got the error ? right ?

----------

## NeddySeagoon

Major,

Tell us eaxtly how you thought the drive was partitioned.

hdd5 was a logical partition in the extended partition. It can't now be hdd1. Primary partitions are 1-4, logical partitions are 5 onwards.

In answer to your question - probably not.

----------

## Major

There was only one partition of 40gig ... and it  was identified hdd5 ... 

So I guess that was in fact and logical partition. I thought I did an primary partition first ... but as u told Primary partitions ar 1-4 .... 

Ill try to make it logical by removing the primary and putting an logical instead ... 

If I do that it wont erase all the data ... by going into 

```
cfdisk /dev/hdd
```

and delete the partition and making a new one ? right?

----------

## NeddySeagoon

Major,

I would guess that the drive was partially partioned when you came to it. It must have had an extended partition on it for you to create a logical partition in.

If you don't know where the extended partition was, get one of the surface scan tools because you can't guess.

There are other threads on the forums about lost partition tables, so search for them - some ended in success.

----------

