1

Topic: Drive not bootable after resize

I hope someone here can help me, I'm in way over my head! sad

I have used Gparted a number of times it the past with great success. I use it to delete a second partition and resize the system "C" partition on drives where their system partition is running out of space.

This time I screwed up and don't know what to do to fix it. When examining this drive with Gparted, I found a small partition listed first, then the main (C) partition and then the extended (D) partition that I wanted to delete and resize the system partition to the full size of the drive (120 GB)

So, I deleted the small partition at the beginning and then deleted the extended partition and resized the system partition to take in all the "unallocated"  space.

This seemed to work fine and when I was finished it showed just one, active, bootable partition. But, It will not boot. When I boot up with "PT Edit" it shows a small empty partition as number 1 and then the good bootable partition as number 2. Several other programs show the same. The data seems intact but Windows cannot access the drive to run a chkdsk as has been suggested. Gparted now shows the single partition as bootable, but says it cannot mount the drive.

I hope I have explained the problem so it makes sense and that someone here can tell me what to do to make the drive boot.

Thanks much!

Musky

If the voices inside my head paid rent, I'd be rich!

2

Re: Drive not bootable after resize

Hi!

You should never delete a partition if you don't know what it is good for. Some computers might have e.g. some diagnostic tiools used by the BIOS on a hidden partition, or some low-level data encryption environment or even your boot loader might reside there.
The other point is that different tools slow different partiton tables - so something seems to have gone wrong with your partition table. You should open a command line within GParted, issue the following commands and post their results here:

fdisk -lu /dev/sda
dd if=/dev/sda bs=512 count=1 | hexdump

The first one simply uses the Linux fdisk tool to read the partition list and display it. The second one reads the first sector of your hard drive, converts the data to hex so all byte values can be displayed, and prints the stuff out to the screen - so one who understands how the partition data is encoded in the first sector of your drive can have a close look at your partition table at the lowest possible level.

3

Re: Drive not bootable after resize

Thank you for the reply

I will run those commands as you suggest in the morning and post them here. Will I be able to save these logs in a text file to a floppy from within Gparted?

Thanks again!

Musky

If the voices inside my head paid rent, I'd be rich!

4 (edited by cmdr 2009-06-29 16:20:02)

Re: Drive not bootable after resize

Hello Musky,

Will I be able to save these logs in a text file to a floppy from within Gparted?

yes, just type from within a "Terminal" window under "GParted", confirm each line with [Enter].

1. Mount your floppy drive (formatted media inserted):
mkdir  /mnt/floppy
mount  /dev/fd0  /mnt/floppy

2. Copy something to your floppy :
cp  /root/fdisk.txt  /mnt/floppy/

or - as an alternative to "copy" -

3. Create a print-out file directly :
fdisk -lu /dev/sda > /mnt/floppy/fdisk.txt

Regards
cmdr

5 (edited by Musky 2009-06-29 22:21:30)

Re: Drive not bootable after resize

Please bear with me, I know these are "Newby" questions.

First of all the command window in gparted is so small that the text is almost unreadable, but just almost.

I tried entering these instructions first:

fdisk -lu /dev/sda
dd if=/dev/sda bs=512 count=1 | hexdump

The first command seems to take.

The problem is, I don't have this character  "|" on my keyboard that I can see anyway.

Also, when I type in the commands to mount the floppy drive to copy the log file (if it was created) I get this error:

mount: Special drive /dev/fd0 does not exist

I know that the floppy drive in the system is working properly.

EDIT: I was able to mount a USB drive and Gparted recognizes it as "/dev/sda/" but it will not copy the fdisk log or the fdisk.jpeg I created with the screenshot option to the USB drive, it appears to but nothing shows on the flash drive in my other system.

The Main Hard drive is designated "HDA" by gparted, not "SDA" is this significant?

Any further help will be appreciated.

Musky

If the voices inside my head paid rent, I'd be rich!

6 (edited by cmdr 2009-06-29 22:16:44)

Re: Drive not bootable after resize

Hello Musky,

The problem is, I don't have this character  "|" on my keyboard that I can see anyway.

No problem, omit the pipe-character (|) and the rest of the line (hexdump). We have other possibilities to get an appropriate view of your "dd" print-out.

Special drive /dev/fd0 does not exist

I assume, you had a formatted floppy in the drive (you mount a filesystem, not a device). Device name "fd0" belongs to a floppy, connected to a standard floppy motherboard interface. Perhaps your device is connected to an internal USB connector or a SCSI interface. Then it uses other names. Maybe BIOS Setup gives you a hint, what kind of interface is used.

To find all detected block device names with "GParted", type the following commands :
Unplug ALL external block(storage) devices (USB, Firewire) to minimize the choice.

cd /sys/block
echo *

Ignore all devices "ram." and "loop.". Note the few with other names and type them here, so that we can tell you, which one to choose. It would be helpful to know, whether there is more than one DVD/CDROM player/burner, a 2nd Harddisk, a flash card reader or other stuff of that kind installed.

If you have a USB flash stick, you could use it instead of a floppy. Just plug it in, before you boot "GParted" and you can see, what device name is used.

Mounting (e.g. "sdb1") :

mkdir /mnt/sdb1
mount /dev/sdb1 /mnt/sdb1

Regards
cmdr

7

Re: Drive not bootable after resize

Hi!

I've seen many recent kernels that did not have the floppy driver compiled into the kernel - which is not so bad, since floppy drives become more and more uncommon. For these kernels, the floppy drive is accessible only after the floppy driver in inserted into tghe running kernel:

modprobe floppy

Maybe this step is required for recent GParted LiveCDs, too?

8

Re: Drive not bootable after resize

@stormhead

stormhead wrote:

For these kernels, the floppy drive is accessible only after the floppy driver in inserted into tghe running kernel.
...
Maybe this step is required for recent GParted LiveCDs, too?

I just checked it with "GParted Live 0.4.5-2".  My Floppy is definitely "/dev/fd0".

Regards
cmdr

9

Re: Drive not bootable after resize

Hello CMDR and all.

As I said in my last post, it Gparted sees my USB flash drive as /dev/sda/

I also tried the little USB mounting program within my version of gparted and when it's finished, it tells me the USB drive is mounted as /mnt/usblive

I have tried everything I can think of to copy the fdisk.txt from the root to this drive and even though it seems to work as I don't get any command line errors, the drive is empty when I try to read it from my other computer to try and post the fdisk results here. I also tried what you suggested to have the fdisk.txt file written directly to this flash drive, but that didn't work either.

As you say, my floppy drive is connected to a standard floppy interface on the motherboard and is recognized it the BIOS as such. If I could get the USB stick to work, I would rater use that anyway.

The hard drive in question is listed in Gparted as "hda2" when when I do the fdisk command on "hda2" I get a message that says "you probably chose the wrong drive", but I still get some drive information listed.

I think I'm just confusing myself more. I will try the device list command that you posted and post the results.

Musky

If the voices inside my head paid rent, I'd be rich!

10

Re: Drive not bootable after resize

OK, After running:

cd /sys/block
echo *

Omitting the RAM and loop entries, I get:

hda hdc

The version of Gparted I am using is a few years old I believe. It is Version:

GParted-Live-CD 0.3.4-10-Beta Auto configuration

Would a different version work better for me?

Musky

If the voices inside my head paid rent, I'd be rich!

11

Re: Drive not bootable after resize

I apologize for the thrid post in a row.

I downloaded the latest version of Gparted and this allowed me access to my floppy drive.

Here is the context of the fdisk.txt:

Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x4c213995

   Device Boot      Start         End      Blocks   Id  System
/dev/hda2   *          63   234436544   117218241    7  HPFS/NTFS

When I run the other command (dd if=/dev/hda bs=512 count=1) everything goes garbled:

3ÀŽÐ¼ |ûPPü¾|¿PW¹åó¤Ë½¾±8n |    uƒÅâôÍ‹õƒÆIt8,tö µ´‹ð¬< tü» ´ÍëòˆNèF s*þF€~ t €~ t ¶uÒ€FƒFƒV
è! s ¶뼁>þ}Uªt €~ tÈ ·ë©‹üW‹õË¿ ŠV ´Ír#ŠÁ$?˜ŠÞŠüC÷ã‹Ñ†Ö±ÒîB÷â9V
w#r9Fs¸» |‹N‹V ÍsQOtN2äŠV ÍëäŠV `»ªU´AÍr6ûUªu0öÁt+a`j j ÿv
ÿvj h |jj´B‹ôÍaasOt 2äŠV ÍëÖaùÃInvalid partition table Error loading operating system Missing operating system                                                          ,Dc•9!L                  € þÿÿ?   ‚7ù
                                Uª

The rest of the text entered into the command windows is also garbled from this point on. I have to close the window and reopen it to be able to read the text again.

I hope this info helps you help me! smile

Musky

If the voices inside my head paid rent, I'd be rich!

12 (edited by cmdr 2009-06-30 14:36:19)

Re: Drive not bootable after resize

Hello Musky,

GParted-Live-CD 0.3.4-10-Beta Auto configuration
Would a different version work better for me?

*+@@§&@+* !!! I forgot to mention, that we always expect the latest stable version to be used !

Now with the latest version, your USB stick (sda1) will be usable, too.

Analysis of your print-outs
1. fdisk :
Since you deleted the original 1st partition and resized the second one to fill the whole drive, there is no 1st partition (hda1) anymore. The "Hidden sector" value (0x3F = 63 = one track) is normal, but I doubt, whether it was updated within the Partition Boot Record. We will check this in a further step. The size seems to match reality ( 120 GB => 111.79 GiB ).

2. dd :
The print-out consists of binary data and should rather be gathered in a file than be made visible in console, because some arbitrary data might be control sequences. It's better to upload such a file to a file sharing site, than to show its content in an HTML environment like this forum.  Anyway, I managed to recover the interesting structures ( the size, 512 Bytes, didn't fit, because Nul-Bytes were replaced by spaces and some linefeeds added),  but the Partition table seems to be correct.
It's not pure cosmetic, but with one single partition, we should have it at the 1st position. We avoid difficulties later, if one day you want to have a further partition. This is very easy by just correcting the partition table manually.

You didn't state, what operating system you use, did you ?  If it is Vista, you should download and burn the free Vista Recovery ISO, too. We need it later. For XP and its derivates, we only have to adapt "boot.ini".

It' s time for you to know "MC_HxEd", which simplifies the direct access to your harddisk.

Use this link to get an instruction, how to use it.

I would like to have the Master Boot Record of "hda" ( double-click on "hda" within "MC_HxEd") as binary file (the default) and the Partition Boot Record of "hda2" ( see above, of course "hda2"). Upload all to a file sharing site like "mediafire.com".  You might add "boot.ini", too, if it's used.

Regards
cmdr

13

Re: Drive not bootable after resize

Hi CMDR, I really appreciate all the help.

Unfortunately, I am having problems getting those DAT files off the computer. I have mounted the USB drive as per instructions, it seems to recognize it because the drive blinked when I finished the "mount /dev/sda1 /mnt/usb" command. But when I get finished running the steps in MC Hex_ed and shut down the system, there is nothing on the drive.

I have tried two known working flash drives with the same results. I also mounted  the floppy drive and tried that. On the floppy, if I manually copy "drvs.dat" to the floppy, I get a DAT file on the floppy, but it's only 1KB, so I think it's just copying the name of the file.

I will keep trying and if you can offer any other suggestions on how to get the files off the system, please let me know. I do know that the files are not "automatically saved to the USB drive" when opened or closed whichever. Nothing tries to access either the floppy or USB drive from MC_HxED.

Also, the OS on the drive is Windows XP Professional.

Again, thanks for the help!

Musky

If the voices inside my head paid rent, I'd be rich!

14

Re: Drive not bootable after resize

OK, here is the link to the "Drvs.dat" file, I managed to copy that to the USB drive from the root menu in the Terminal window.

http://www.chuckscomputer.com/Gifs/drvs.dat

I tried to do the same with the hex dat, but I don't think it saves it to the root directory, or if it does, I'm not inputing the correct file name.

Musky

If the voices inside my head paid rent, I'd be rich!

15

Re: Drive not bootable after resize

Hello Musky,

"MC_HxEd" has a "Mounting Wizard". Do NOT plug in your stick, when booting "GParted", start  "MC_HxEd" as soon as this is possible. Double-click on "hda" within "MC_HxEd", and you are asked, whether you want to mount an USB Stick. Confirm and attach your stick. It should be detected and mounted automatically ( to folder "/mnt/usb"). You then see the hexadecimal view of sector 0 on "hda" (=Master Boot Record; file "hda.MBR"). By closing this window a second window with "Midnight Commander" opens. It shows on the left side folder "/mnt/usb/BootRec", which should contain "hda.MBR" (permanently stored) and on the right side folder "/home" and the same file (temporarily stored). "Midnight Commander" can also be launched in a "Terminal" window with "mc" (you can NOT use your mouse !). It's a powerful file manager; you can easily copy ( F5 ) files from one side to the other, change folders and view file content. You should be a little bit familiar with its usage, before we proceed. And most of all, we need "hda.MBR" and "hda2.PBR".

Regards
cmdr

16 (edited by Musky 2009-07-01 03:22:10)

Re: Drive not bootable after resize

CMDR: OK, we're making progress!

Here is the "hda.mbr file:

http://www.chuckscomputer.com/Gifs/hda.MBR

Here is the "hda2.PBR file:

http://www.chuckscomputer.com/Gifs/hda2.PBR

Windows will not access the drive, so unless I can do it from gparted, I can't supply the "boot.ini"

Musky

If the voices inside my head paid rent, I'd be rich!

17

Re: Drive not bootable after resize

Hello Musky,

cmdr wrote:

I doubt, whether it (the Hidden Sector value) was updated within the Partition Boot Record.

1. PBR Hidden Sector value matches MBR value.
2. PBR drive size (99.65 GB=92.81 GiB) does NOT match MBR value (120GB=111.79GiB).
I assume, that 92.81 GiB was the former value. Maybe growing failed or value was just not yet updated. The problem is, that you used a very old version of "GParted" for growing the filesystem, and very often upgrades improved NTFS handling meanwhile.

Now, what to do next ?

When you install XP to a blank HDD, it always uses 1st partition and makes it the "active"(bootable) partition ( always drive C: ).  You only get a choice for an alternative installation location, if a former Windows version is already present, but the boot manager of the new version gets always installed on the existing "active" partition, because otherwise drive letters would change. Windows doesn't "see" other filesystems than its own. Drives with other systems have no drive letters, even if they use Windows filesystems, but get unknown labels in its respective partition table. I suspect, that Windows (or better its MBR) doesn't like a blank 1st partition table. Or deleting the former 1st partition mixed up the drive assignment in Windows, if the former 1st partition was visible.

But "GParted" (old version) seems to have problems, too :

Gparted now shows the single partition as bootable, but says it cannot mount the drive.

I suggest, that you try to mount "hda2" with the latest version of "GParted".

mkdir /mnt/hda2
mount /dev/hda2 /mnt/hda2

Note down the fault message(s), if so.
If contrary to expectations mounting succeeds, have a look with "mc" to the content, where you should see "boot.ini" in the root directory(=/mnt/hda2). Copy it to your stick (mount it with "MC_HxEd") and load it up.

If mounting is NOT possible, we "transfer" hda2 to hda1, simply by exchanging MBR. You can download the appropriate corrected MBR (hda.MBR1) here. Store it to your stick and use the following code to write it to your HDD.
ATTENTION ! NO TYPOS HERE ! THERE IS NO UNDO ! YOU MIGHT TOTALLY CORRUPT YOUR HDD !

 dd  if=/mnt/usb/BootRec/hda.MBR1  of=/dev/hda  bs=512  count=1

Try to mount hda1 and/or let "GParted" run  a "check" (unmount it with "GParted" before). Note its result or copy "details.html" to your stick and load it up.
Try to boot your HDD.

Good luck
cmdr

18 (edited by Musky 2009-07-02 01:37:01)

Re: Drive not bootable after resize

Hi CMDR,

I'm going to take this one step at a time.

After inputing the mounting instructions for hda2:

mkdir /mnt/hda2
mount /dev/hda2 /mnt/hda2

I get this message:

mount: you must specify the filesystem type

What next, how do I specify NTFS?

Thanks!

Musky

If the voices inside my head paid rent, I'd be rich!

19

Re: Drive not bootable after resize

Hi Musky,

mount: you must specify the filesystem type
...
What next, how do I specify NTFS?

mount -t ntfs /dev/hda2 /mnt/hda2

Usually "mount" autodetects a valid filesystem. It's no good sign to have this fault message.

Regards
cmdr

20

Re: Drive not bootable after resize

Hey cmdr.

No luck. When I ran the last command you posted, I received this message:

mount: wrong fs type, bad option, bad superblock on /dev/hda2, missing codepage or helper program, or other error in some cases useful info is found in sylog- try dmesg l tail or so

Should I try the next step, loading a new MBR, or not bother trying?

If I do proceed, I have one question. Do I run the following command from within MC_hexed or from the terminal window?

dd  if=/mnt/usb/BootRec/hda.MBR1  of=/dev/hda  bs=512  count=1

Again, thank you for your help. Unfortunately, we must be in very different time zones, our exchanges are down to one a day sad

Musky

If the voices inside my head paid rent, I'd be rich!

21 (edited by cmdr 2009-07-02 19:54:58)

Re: Drive not bootable after resize

Hi Musky,
I expected the fault message. The NTFS filesystem is corrupt ! The new MBR will NOT solve the problem, that "GParted" isn't able to mount the partition. My hope is, that we get Windows to recognize the partition as corrupted and to initialize the Windows repair functions ( chkdsk /f /r).

If I do proceed, I have one question. Do I run the following command from within MC_hexed or from the terminal window?

Commands in "code" tagged frames are always for the  "Terminal" window... and yes, load the new MBR.

If you don't have an original Windows installation disk ( no OEM version !), you should download the free Vista Recovery ISO and burn it to a CDROM. It has all necessary tools for NTFS repair. They are available in a console window and work on former Windows versions, too.

Regards
cmdr

22

Re: Drive not bootable after resize

Hi cmdr,

I do have an original Windows XP disk, so I load the new MBR, and then boot up with the Windows CD to the recovery console and run CHKDSK from there, correct?

Do I still run 

dd  if=/mnt/usb/BootRec/hda.MBR1  of=/dev/hda  bs=512  count=1

from the terminal window when I am finished loading the new MBR?

I have tried running chkdsk with the /f command from recovery console in the past and usually it won't recognize the /F command, it will however run the chkdsk /r command. But I will try both.

Thanks!

Musky

If the voices inside my head paid rent, I'd be rich!

23

Re: Drive not bootable after resize

Hi Musky,

load my new hda.MBR1 BEFORE you use the repair console. Why ? Windows "fixmbr" does NOT touch the partition tables, it only exchanges the boot code. My new MBR alters the partition table to a configuration, that Windows normally expects.

Yes, you should run "chkdsk / f /r" from repair console first and as single repair task for the moment. Note down fault messages, if any.

Regards
cmdr

24

Re: Drive not bootable after resize

Hey again,

It seems to have loaded the new MBR, at least it said "one file copied" after I ran the command.

I tried mounting hda1 and it said "device not found" (not exact words)

I booted up with a Windows XP disk, went to the recovery console and attempted chkdsk. As I expected, it would not accept the /f command and trying to run chkdsk /r resulted in a message that the disk "contains unrecoverable problems."

I burned the Vista recover ISO and ran that, but I can't see how to access the tools from there. I get a screen that said it will attempt repair of the OS that I choose, but nothing shows in the windows. It also says that ONLY VISTA operating systems will show in the windows.

Please tell me what to do with the Vista recovery disk in order to run chkdsk from there,

I am losing hope that the system can be repaired. Even if I could somehow access the files would be a great help!

I did remember something that I don't know is important or not.

When I first deleted the small partition at the beginning of the drive (which said it was empty) and then deleted the extended partition and resized the active (C) partition to the largest size available on the disk. I "applied" the changes and Gparted completed them successfully.

Afterwards, I closed the graphical interface and attempted to shut Gparted down, but it would not close. I finally had to shut the system down manually which I believe may have caused the problem because Gparted was not able to do it's closing routines, closing and writing drives, etc.

Does this sound correct?

Thanks for the help!

Musky

If the voices inside my head paid rent, I'd be rich!

25 (edited by cmdr 2009-07-02 22:14:12)

Re: Drive not bootable after resize

Hello Musky,

Afterwards, I closed the graphical interface and attempted to shut Gparted down, but it would not close. I finally had to shut the system down manually which I believe may have caused the problem because Gparted was not able to do it's closing routines, closing and writing drives, etc.

Does this sound correct?

This doesn't matter, if "GParted" finished its wanted disk activities ( but think of hardware cache memory , which will work a few moments beyond that. ) "GParted" does not write  system data to any other places than the RAM. You could even cut off power within the desktop with no harm.

Concerning Vista Recovery CD:
This was intended as an alternative to the recovery/repair console of the appropriate Windows version, if you only have an OEM version.

I get a screen that said it will attempt repair of the OS that I choose, but nothing shows in the windows. It also says that ONLY VISTA operating systems will show in the windows.

If it stopped seeking for Vista, click "Next", and on next page you see a console icon to click.

I tried mounting hda1 and it said "device not found" (not exact words)

What shows "GParted" graphic ? Did you reboot "GParted CD" before? What shows "MC_HxEd" ? Could you upload the actual hda MBR as "hda.MBR2" with "MC_HxEd" to see, what went wrong ?

I am losing hope that the system can be repaired. Even if I could somehow access the files would be a great help!

"testdisk" and "photorec" are contained in "GParted". They are able to recover files without a working filesystem ( but surely not all ... and they might have no clue about  the former filenames). You need a second or external harddisk to store the recovered files.

We haven't tried yet to put the filesystem partition size value (the former) to the MBR, which holds the wanted. These two values do NOT match up to now. We don't know, which one is true.

Regards
cmdr