Incorrect number of heads/cylinders ???

Hello,

TestDisk 6.10 is reporting incorrect number of heads/cylinders on my HDD.
http://home.tiscali.nl/chaos_and_order.com/openSuSE/testdisk_result.png
Please see testdisk.log for more details.

Is this a serious issue?
If yes, what risks are involved?
How critical is this warning, i.e. should I fix it?
My computer is functioning fine. Both Linux and Windows systems are up and running without any hiccups. I did not experience any data loss/corruption.
Is it possible that TestDisk is wrong?
I also used gparted application to test my partitions. It did not report any problems.

I’m in favor of fixing the drive geometry, but I’m worried to make the things worse. Anyone that has experience with such problems/tools: I need your help!

Thanks in advance,
Boris

It says “warning”, so I wouldn’t worry too much about it.

I assume that it only matters for older versions of lilo and maybe grub, they never liked booting from oddly layed out disks.

If everything works ok, I would just ignore it :).

Hi,

I think that is a serious issue. What does it mean?

The first line tells us that you have a hd with 37 Gig, 63 heads and 255 cylinders (logical head and cylinders). So every primary partition has to start at cylinder 0 and end at cylinder 254 and every logical partition has to start at cylinder 1 and end at cylinder 254.

The line above the NTFS-partitions mean that in the partition table the NTFS-partition ends at cylinder 240. That’s not correct. The worst case with incorrect partition tables is that all partitions will be lost. It could be that will never happen. It could be it happens tomorrow. But don’t worry. You own testdisk.

It’s good that you are carefull. Testdisk is a powerful tool which can do a lot of good things for you but also some bad ones. I recommend:

  1. step: Read the manual
  2. step: Read the manual
  3. step: Read the manual
    :wink:

After reading all closely (good place to start it: TestDisk - CGSecurity) I also recommend to make a copy of your disk before starting to play around with the partition tables. Best thing would be to have the same disk to do so. The target disk must be at least as big as the source disk. Connect both to the same computer and type:


dd if=/dev/sda of=/dev/sdb

ATTENTION: if means input file. So in the example the bad disk would be the one after if. of means output file. So in the example the empty disk you want to copy the data to would be the second disk. If you mix up if and of the empty disk will be copied without any warning to the original one. So the original one will be deleted. After hitting ENTER you may go shoping, do the dishes or everything else you like. :wink:

DO NOT COPY THE CODE IF YOU ARE NOT 100% SURE WHAT YOU ARE DOING!

Now have fun with testdisk. :wink:

If you messed up your original disk just copy the backup back to it and start again. Now the example would be:


dd if=/dev/sdb of=/dev/sda

Again: Think three times before you hit ENTER and keep cool. :wink:

hth

Bye

Erik

Thank you for the advice!

I also recommend to make a copy of your disk before starting to play around with the partition tables. Best thing would be to have the same disk to do so. The target disk must be at least as big as the source disk.

Unfortunately, I do not have an empty spare drive for this job, but on my external USB drive I have enough space for a 40GB image.

I’m not sure if Northon Ghost is capable of creating the images of drives with ext3 file system. Do you have any suggestions here?
Is it possible to create drive image directly from Linux, which tool I should use?

I’m also curious to know, what caused the drive geometry to become wrong? For partitioning of my drives I always use either the Windows Disk Management tool or Linux partition tool (at installation). One of these tools is not doing the proper job.

Hi,

The tool is dd. You can also do this:


dd if=/dev/sda of=/media/disk/backup/image

This would create an image file of the whole disk named /dev/sda in a file named image located on /media/disk/backup. The file system has to support such big files.

To save some disk space you can also pipe dd to gzip which would be:


dd if=/dev/sda | gzip > /media/disk/backup/image.gz

To restore that file to the disk it would be:


gunzip -c /media/disk/backup/image.gz | dd of=/dev/sda

I don’t know which program messed your partition table up. I think it wasn’t Linux. :wink:

Bye

Erik

Thanks for the detailed instructions!

I suppose that I can perform these operations using a live CD. Otherwise it might be difficult to restore the image if I destroy my boot drive.

I have one more question. Is there a way to verify the image?
Before I start experimenting, I would like to make sure that the image creation is 100% successful.

Hi,

Hmmm. I always trusted dd. :wink: I think diff can do that job for you.


diff /dev/sda /media/disk/image

That will take a while.

Edit: The result must be empty.

hth

Bye

Erik

After a long time I decided to give it a try.

First I made a backup of my drive as follows:

dd if=/dev/sda | gzip > /mnt/usb/nc6000.img.gz

Then I tried to fix the geometry using testdisk. Obviously something terribly went wrong because I ended up with unusable system. I don’t know exactly what I did, but my computer refuses to boot from the HDD.


I decided to restore my HDD from the image file, using gparted live CD (at that time, gparted did not recognize any partitions on the drive)
I did the following:

cd /mnt
mkdir usb
mount -t ntfs-3g /dev/sda1 /mnt/usb
gunzip -c /mnt/usb/nc6000.img.gz | dd of=/dev/hda

The restore operation ended up with input/output error.
It said that only first 11GB were copied.


Now my computer boots, but only in Windows XP (which is the first partition on disk). So that part was recovered correctly.

Now both gparted and testdisk recognize the other HDD partitions, still I can’t start Linux. Besides testdisk now reports more issues with the HDD.

http://home.tiscali.nl/chaos_and_order.com/openSuSE/testdisk/Linux-testdisk.jpg

http://home.tiscali.nl/chaos_and_order.com/openSuSE/testdisk/Linux-gparted.jpg

I don’t know what else I could do to fix all this.
Is there a chance that my Linux partitions are still intact?
By the way, Windows is able to read logical drive Files (/dev/hda5).

The problem is solved.

I did the following:

  1. backup all HDD partitions
  2. low-level format the HDD
  3. reset bios
  4. partition the HDD
  5. restore the partitions contents (from the backups)

By the way following message is still present.

Warning: Incorrect number of heads/cylinder 240 (NTFS) != 255 (HD)

In the meantime I learned that this does not necessarily mean that something is wrong with the HDD. Since testdisk is guessing the number of heads/cylinder, sometimes the guess can be wrong.
That explains why Windows version of testdisk guesses 16 HD/CYL while Linux version guesses 255 HD/CYL.

…told ya - lol :wink:

growbag wrote:
> …told ya - lol :wink:

yep…some listen, some don’t…

on the other hand, the OP couldn’t tell if it was you who knew best,
or the other guy giving different and ok sounding advice…


platinum

Yes I know, I was being a bit cheeky, but I just couldn’t resist :D.

But the good thing is that the OP learned how to do all that stuff now, and so will have the confidence if anything else crops up.

Plus it’s always best to find things out yourself, and as you say, anyone can give advice, the trick is using the right piece!