Author Topic: Rescuing HDD [SOLVED]  (Read 10395 times)

Riki

  • Guest
Rescuing HDD [SOLVED]
« on: August 03, 2009, 12:58:34 AM »
The following post by Old-Polack has been transferred from another thread (Moving Windows partition with GParted) which was going off topic:

Riki:

If fdisk can't read the drive properly, in it's present state, neither can the rest of the applications. What's being reported is a combination of flags left behind by previous partitioning and it will only confuse things and make them worse, if you try to install anything new. The partition table needs to be rebuilt, and stabilized, before you can proceed with anything else.

It wound take writing a book to explain fully what I think is happening, and there are already plenty of them around, so I'll try with a short form version.

1. The partition table provides for 4 primary partitions only.

2 If more partitions are needed 1 of the primaries can become an extended partition.

3 An extended partition acts as a container, to hold logical partitions.

4 The extended partition should be the last primary partition used, and should start at the first cylinder after the previous primary partition, and extend to the end of the drive.

5 If the extended partition begins before the end of a primary partition, or if a primary partition is included within the extended partition, it is said to be overlapping.

6 Some software, mostly GUI, is written so that it still works with overlapping partitions, whether by design or sloppy coding.

7 Software that allows this is very bad practice, as it leads to problems such as you are experiencing, where other software, with more strict rules, becomes totally confused.

8 Depending on how the partitions are actually written to disk, Linux can still, sometimes, work with these odd arrangements, but if they get changed, and the change is written slightly different, the whole thing becomes total confusion, and the apps like fdisk can no longer make sense of what information is left.

9 When you created the partition on /dev/hda1 you created it as an extended partition, which extended to the end of the drive.

10 The windows partition now became a totally overlapping partition; a primary partition, withing the extended partition. This is very bad practice, and should not have been allowed in the first place.

11 However this was handled, and written to disk, fdisk was still able to sort it out, at the time.

12 Whatever has changed since then, while trying to remove the first partition, which was an extended partition, properly holding /dev/hda5 through /dev/hda8, and improperly holding the primary windows partition, /dev/hda2, has thrown the whole partitioning scheme into disarray.

13 If you have not tried to write further to the drive, overwriting the information/data on the disk, we should be able to recreate a correct partition table, using the same boundaries for each partition, but with correct partition form for each, making the partitions both accessible, and able to be properly manipulated by GParted.

----------------------------------------------------------------------------------------------------------------------------------

These are the partitions as they were. All we need to concern ourselves with, at this time are the boundaries; the start and end cylinders.

Quote from: Riki on July 28, 2009, 08:25:21 AM

[root@localhost root]# fdisk -l

Disk /dev/hda: 80.0 GB, 80026361856 bytes
16 heads, 63 sectors/track, 155061 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk identifier: 0x17df17de

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1      155061    78150712+   5  Extended
/dev/hda2   *       12496       64812    26367768    7  HPFS/NTFS
/dev/hda5               1       12495     6297417   83  Linux
/dev/hda6           64813       72938     4095472+  83  Linux
/dev/hda7           72939       75018     1048288+  82  Linux swap / Solaris
/dev/hda8           75019      155061    40341640+  83  Linux


The partitions we would want to create would take this form;

Device               Start           End          Type

/dev/hda1             1           12495         Primary
/dev/hda2         12496        64812         Primary
/dev/hda3          64813      155061        Extended
/dev/hda5          64813        72938        Logical
/dev/hda6          72939       75018         Logical
/dev/hda7          75019      155061        Logical

If we can get this far, the individual partitions should be able to be read and used. There would need to be further edits to /etc/fstab on the new /dev/hda5, and also to the /boot/grub/menu.lst on that partition, so that it and Windows could then be booted, to check out whether Windows has truly survived all this. Grub would need to be reinstalled to the MBR for this purpose.

If we can still get both systems to run, (Actually there are three, counting the one on the new /dev/hda1) and if GParted can now see them, you should then be able to eliminate /dev/hda1, and move /dev/hda2 to the beginning of the drive, where it could then be fixed, with fdisk, to become /dev/hda1.

Should we get that far, The Linux involved partitions should also be able to be either fixed by growing, moving etc. or can be eliminated, for a fresh installation with correct partitions. As you don't have a backed up version of the Windows MBR boot code, you would not be able to use Windows, without a working grub installed, or you would have to find an image of a Win98 repair floppy to burn to a floppy disk, to restore the Windows code to the MBR. These are available on the web,

Two other choices that everyone running a dual boot with Windows and Linux should have, are the Ultimate Boot CDs.

http://www.ultimatebootcd.com/               <-- General purpose

http://www.ubcd4win.com/                        <-- Windows specific

One, or both, of the above should have an app to restore the Windows MBR code.
« Last Edit: August 02, 2009, 11:11:26 PM by old-polack »    Report to moderator   Logged
Old-Polack

Of what use be there for joy, if not for the sharing thereof?

 
« Last Edit: August 08, 2009, 05:48:20 AM by Riki »

Riki

  • Guest
Re: Rescuing HDD
« Reply #1 on: August 03, 2009, 01:13:21 AM »
Quote
Should we get that far, The Linux involved partitions should also be able to be either fixed by growing, moving etc. or can be eliminated, for a fresh installation with correct partitions. As you don't have a backed up version of the Windows MBR boot code, you would not be able to use Windows, without a working grub installed, or you would have to find an image of a Win98 repair floppy to burn to a floppy disk, to restore the Windows code to the MBR. These are available on the web,

Two other choices that everyone running a dual boot with Windows and Linux should have, are the Ultimate Boot CDs.

http://www.ultimatebootcd.com/               <-- General purpose

http://www.ubcd4win.com/                        <-- Windows specific

One, or both, of the above should have an app to restore the Windows MBR code.


I will try the above as my laptop does not have a floppy.


Riki

  • Guest
Re: Rescuing HDD
« Reply #2 on: August 03, 2009, 01:48:20 AM »
OP, I want to make sure that I am doing the right thing. What mirror would you recommend (SOFTPEDIA?) here:

http://www.ubcd4win.com/downloads.htm
« Last Edit: August 03, 2009, 01:57:33 AM by Riki »

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11541
  • ----IOFLU----
Re: Rescuing HDD
« Reply #3 on: August 03, 2009, 02:24:36 AM »
OP, I want to make sure that I am doing the right thing. What mirror would you recommend (SOFTPEDIA?) here:

http://www.ubcd4win.com/downloads.htm


Shouldn't make a difference, as long as it has the 3.5 version. They don't specify the actual locations of the mirrors, so you can't just pick the closest. Whatever you do, don't try using the disk until we get the partitions sorted. Download it and burn it to disk, so we'll have it read when the time is right. I would get both the regular UBCD, and the windows specific versions, if I were you. I personally don't have the Windows one burned to disk, because I haven't run Windows for many years. I actually do have the image, in case my son's computer needs it at some time, but haven't needed to burn it so far.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Xenaflux

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3834
Re: Rescuing HDD
« Reply #4 on: August 03, 2009, 03:57:55 AM »
http://www.ausgamers.com/files/details/html/43349

Also, in a previous post you said you were able to read what's on XP.
If that's still the case, back up your important files.

I have great confidence in OP, but " better safe than sorry ".
The great thing in this world is not so much where we stand,
as in what direction we are moving.
                                                    (Oliver Wendell Holmes )

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11541
  • ----IOFLU----
Re: Rescuing HDD
« Reply #5 on: August 03, 2009, 04:57:29 AM »
Riki:

When I last asked you to post the results of fdisk -l /dev/hda you replied with;

Quote
All I get is "Unable to seek on /dev/hda"

Even if that's the only result, I still want to see the prompt, the command, and the results, in this form;

[root@fatman ~]# fdisk -l /dev/hda

Disk /dev/hda: 300.1 GB, 300069052416 bytes
255 heads, 63 sectors/track, 36481 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00057fe7

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1          13      104391   83  Linux
/dev/hda2              14         275     2104515   82  Linux swap / Solaris
/dev/hda3             276        2886    20972857+  83  Linux
/dev/hda4            2887       36481   269851837+   f  W95 Ext'd (LBA)
/dev/hda5            2887       15941   104864256   83  Linux
/dev/hda6           15942       18733    22426708+  83  Linux
/dev/hda7           18734       21541    22555228+  83  Linux
/dev/hda8           21542       36481   120005518+  83  Linux

If all it gives back is the single error line, I still want to see it as if I were looking at your screen.

[root@localhost ~]# fdisk -l /dev/hda
Unable to seek on /dev/hda

This is very critical for me, if I am to know what to do next. One more time;

[root@localhost ~]# fdisk -l /dev/hda

Post your results, including the prompt, command, and results, exactly as you see it.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Xenaflux

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3834
Re: Rescuing HDD
« Reply #6 on: August 03, 2009, 06:55:45 AM »
Note to OP
on some systems (like mine )  fdisk -l /dev/hda  doesn't work
It has to be   ' sda '  to provide an output.

Xena
The great thing in this world is not so much where we stand,
as in what direction we are moving.
                                                    (Oliver Wendell Holmes )

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11541
  • ----IOFLU----
Re: Rescuing HDD
« Reply #7 on: August 03, 2009, 07:01:04 AM »
Note to OP
on some systems (like mine )  fdisk -l /dev/hda  doesn't work
It has to be   ' sda '  to provide an output.

Xena

But his has already responded to an fdisk -l with a /dev/hda readout. (See above, first post in this thread.)
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Xenaflux

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3834
Re: Rescuing HDD
« Reply #8 on: August 03, 2009, 07:05:38 AM »
I know, and it has nothing to do with him.
It was just a personal note.

Should have sent it by PM, but was to lazy
The great thing in this world is not so much where we stand,
as in what direction we are moving.
                                                    (Oliver Wendell Holmes )

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11541
  • ----IOFLU----
Re: Rescuing HDD
« Reply #9 on: August 03, 2009, 07:07:48 AM »
I know, and it has nothing to do with him.
It was just a personal note.

Should have sent it by PM, but was to lazy

Been there, done that, many times. ;D ;D
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Riki

  • Guest
Re: Rescuing HDD
« Reply #10 on: August 03, 2009, 08:59:06 AM »
Quote
Post your results, including the prompt, command, and results, exactly as you see it.

Here is what I get now:

[root@localhost root]#  fdisk -l /dev/hda
[root@localhost root]#

Nothing...

Riki

  • Guest
Re: Rescuing HDD
« Reply #11 on: August 03, 2009, 10:29:03 AM »
OP, I want to make sure that I am doing the right thing. What mirror would you recommend (SOFTPEDIA?) here:

http://www.ubcd4win.com/downloads.htm


Shouldn't make a difference, as long as it has the 3.5 version. They don't specify the actual locations of the mirrors, so you can't just pick the closest. Whatever you do, don't try using the disk until we get the partitions sorted. Download it and burn it to disk, so we'll have it read when the time is right. I would get both the regular UBCD, and the windows specific versions, if I were you. I personally don't have the Windows one burned to disk, because I haven't run Windows for many years. I actually do have the image, in case my son's computer needs it at some time, but haven't needed to burn it so far.


I have downloaded UBCD4WinV350.exe and saved it to an external drive, pending burning to disk. I've been on the other site but haven't found so far the relevant download.

Riki

  • Guest
Re: Rescuing HDD
« Reply #12 on: August 03, 2009, 10:52:02 AM »
Here are more results using both commands:

[root@localhost root]# fdisk -l /dev/hda
[root@localhost root]# fdisk -l

Unable to seek on /dev/hda
[root@localhost root]#

The first command only produces another prompt.

Riki

  • Guest
Re: Rescuing HDD
« Reply #13 on: August 03, 2009, 11:01:46 AM »
http://www.ausgamers.com/files/details/html/43349

Also, in a previous post you said you were able to read what's on XP.
If that's still the case, back up your important files.

I have great confidence in OP, but " better safe than sorry ".


Thanks for reminding me Xena. I already have all my personal files saved on an external drive. All I'm interested in is rescuing the XP OS and above all do a proper PCL install. If XP can't be recouped I will then have no other option but to use the whole drive for CPL and forget XP on the laptop.
« Last Edit: August 03, 2009, 11:10:35 AM by Riki »

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11541
  • ----IOFLU----
Re: Rescuing HDD
« Reply #14 on: August 03, 2009, 05:35:02 PM »
Here are more results using both commands:

[root@localhost root]# fdisk -l /dev/hda
[root@localhost root]# fdisk -l

Unable to seek on /dev/hda
[root@localhost root]#

The first command only produces another prompt.

OK, that's what I wanted to see. Fdisk sees no partitions at all. Now I want to see if fdisk will work with the drive to create the new partition table. I'll show you output from one of my drives, and I want to see what the same commands produce on yours. Each command is executed when the Enter key is pressed, and you already know that, so I'll leave out the <Enter> on the command lines.

[root@fatman ~]# fdisk /dev/hda

The number of cylinders for this disk is set to 36481.
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)

Command (m for help): m     <-- The fdisk prompt and command.
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
  o   create a new empty DOS partition table    <-- This is the second command
   p   print the partition table                           <-- We use this first to see how it identifies the drive
   q   quit without saving changes                      <-- This is the third command, to leave fdisk
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): p

Disk /dev/hda: 300.1 GB, 300069052416 bytes
255 heads, 63 sectors/track, 36481 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00057fe7

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1          13      104391   83  Linux
/dev/hda2              14         275     2104515   82  Linux swap / Solaris
/dev/hda3             276        2886    20972857+  83  Linux
/dev/hda4            2887       36481   269851837+   f  W95 Ext'd (LBA)
/dev/hda5            2887       15941   104864256   83  Linux
/dev/hda6           15942       18733    22426708+  83  Linux
/dev/hda7           18734       21541    22555228+  83  Linux
/dev/hda8           21542       36481   120005518+  83  Linux

Command (m for help): o
Building a new DOS disklabel with disk identifier 0xc6762790.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.


The number of cylinders for this disk is set to 36481.
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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): q

[root@fatman ~]#

-----------------------------------------------------------------------------

As you can see, the fdisk commands are all single letters. When we get to the actual creation of partitions we will press <Enter> to accept a suggested default, enter a letter for partition type, or a number for the size. That's as complicated as it gets.

I've already worked out most of this, but need to see your results of the above commands to complete the instructions. They will be in the form shown above, so you will know what to expect for/from each command. If you make a mistake, or receive an error, you can quit the program at any time with the q command. All you see with fdisk exists in memory only. Nothing is written to disk until you give the final w command. Any partition created wrong, can be removed and redone, without exiting the application. You can run the p command to print to screen what has been done so far, to check your progress. The m command gives a fresh look at the menu choices.

What I will give you is the complete run through of every step needed to built a new partition table with the same boundaries as the original, but with the proper partition types. Don't vary from the "script". You'll be doing this from the liveCD, so you can have the instructions open on one desktop while running the program in a terminal on another desktop, or run in half sized, full width windows, one on top of the other, on a single desktop. Whichever you are most comfortable with.

After I post the instructions, if there are any questions, ask them before starting the actual procedure. If you use the q command to quit, you'll have to start over from the beginning.

Show me your results from the above, so I can complete the instructions.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...