# [SOLVED] Messed Up Partitions - fdisk cannot seek

## linuxpyro

A couple days ago I had a power failure and had to restart one of my machines.  The disk in this machine is a Hitatchi 120 GB one with 7 partitions on it.  I could not get the machine to boot up when I restarted, so I stuck the drive into a different machine to run fsck on the file systems (all ext3 except /dev/hda1, boot, which is ext2).  

The partition map is as follows (actually, these show up as a different hard drive since they're not in the original machine, but I've changed them all to hda as that's what the drive shows up as on the system I'm fixing):

/dev/hda1  /boot

/dev/hda2  swap

/dev/hda3  /

/dev/hda4  extended

/dev/hda5  /usr

/dev/hda6  /var

/dev/hda7  /home

Now, things get weird.  I'm only able to pick up 6 of the 7 partitions (all except for /dev/hda7).  I ran fsck on all the partitions I could get to.  When I run it on hda6 I get the following:

```

fsck 1.40.2 (12-Jul-2007)

e2fsck 1.40.2 (12-Jul-2007)

/dev/sda6 contains a file system with errors, check forced.

Pass 1: Checking inodes, blocks, and sizes

Error reading block 2523138 (Attempt to read block from filesystem resulted in short read) while getting next inode from scan.  Ignore error<y>? 

```

If I answer no, fsck exits.  If I answer yes, I get this:

```

Force rewrite<y>? yes

Error reading block 2523139 (Attempt to read block from filesystem resulted in short read) while getting next inode from scan.  Ignore error<y>? yes

Force rewrite<y>? yes

```

And if I keep saying yes it repeats, with the block number incrementing for seemingly forever.  Now, the data on this disk isn't horrendously important; I can stand to lose what's not backed up.  (Recovering the data, and the whole install would be nice, but not necessary.)  So, I tried fdisk next.  I get this:

```

The number of cylinders for this disk is set to 4111.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

Unable to seek on /dev/sda

```

I next tried cfdisk, and got this:

```

FATAL ERROR: Bad primary partition 3: Partition ends after end-of-disk

                          Press any key to exit cfdisk

```

While I try this, I find things like this in my dmesg:

```

Buffer I/O error on device sda6, logical block 20185106

lost page write due to I/O error on sdb6

attempt to access beyond end of device

sda: rw=1, want=66259591, limit=66055248

attempt to access beyond end of device

sda: rw=1, want=66259592, limit=66055248

attempt to access beyond end of device

sda: rw=1, want=66259593, limit=66055248

attempt to access beyond end of device

sda: rw=1, want=66259594, limit=66055248

attempt to access beyond end of device

sda: rw=1, want=66259595, limit=66055248

attempt to access beyond end of device

sda: rw=1, want=66259596, limit=66055248

attempt to access beyond end of device

sda: rw=1, want=66259597, limit=66055248

attempt to access beyond end of device

sda: rw=1, want=66259598, limit=66055248

attempt to access beyond end of device

sda: rw=1, want=66259599, limit=66055248

attempt to access beyond end of device

sda: rw=1, want=66259600, limit=66055248

attempt to access beyond end of device

sda: rw=1, want=66259601, limit=66055248

attempt to access beyond end of device

sda: rw=1, want=66259602, limit=66055248

attempt to access beyond end of device

sda: rw=1, want=66259603, limit=66055248

```

I've tried searching the forums, and have not found occurrences of some of the errors I get, but nothing much of help.  At this point I'm thinking it might be a hard drive problem, but if possible I would like to save the disk.  Any thoughts?Last edited by linuxpyro on Mon Jul 28, 2008 4:12 am; edited 1 time in total

----------

## djanderson

Have you taken a look at debugfs? There appear to be a few ways to mount damaged file systems with that ... sorry I can't be more specific...

```
man debugfs
```

-Doug

----------

## linuxpyro

Hmm, I'll have to look into debugfs some more, I've never used it before.

I did some more searching, and tried this command from [url=]this thread[/url]:

```

# dd if=/dev/zero of=/dev/hda bs=512 count=1

```

This erased the partition table, and now fdisk don't complain.  However, it seems to think that the drive is only 33 GB now.  I created a partition of that size (I was trying to create one the size of the disk), and though it worked I have not been able to mount it.

----------

## linuxpyro

OK, I think I fixed it.  Turns out it was a jumper setting on the drive itself that forced it to be a 32 GB drive instead of a 123.5 GB drive (why they made this an option I have no idea).  I pulled one of the jumpers out, and I was able to see the entire drive.  I then used fdisk to create a huge partition, and now all seems to be well.  (I didn't bother trying to recover any data, but I didn't really need to as I already mentioned.)

----------

## x22

This jumper exists for old computers which does not work with large drives.

----------

