Tripredacus

Project: Image DOS with Imagex

18 posts in this topic

I'm working on a project to image a DOS hard disk using Imagex in WinPE 3.0 x64. Here is some preliminary steps and testing results. While I have already done a bit of work on this project already, I am "starting over" but using what I have learned already. One

problem I've encountered was that I am not quite able to replicate the exact disk properties using Diskpart, so the first thing

to do is get some data about the original HDD with the DOS image on it.

The original HDD is a 500GB Seagate Barracuda SATA. My testing drive is a 60GB Toshiba HDD2D35. I am using a different sized

drive for testing on purpose, since I do not want to lock the deployment method down to a particular hard disk or volume size.

Since I am using a 64bit WinPE, there are some inherent limitations to what kinds of programs I can run, since there is no WoW

in WinPE. Fortunately, Systemintegrasjon has available a 64bit binary of MbrFix.exe:

http://www.sysint.no/nedlasting/mbrfix.htm

I found that it is important to get this information first, so I can compare the after-effects to maybe help determine how to

properly image with Imagex. First up is what Diskpart can tell us about the original drive.

DISKPART> detail disk

Disk ID: F0F97B27
Type : SATA
Status : Online
Path : 0
Target : 0
LUN ID : 0
Location Path : PCIROOT(0)#PCI(1F02)#ATA(C00T00L00)
Current Read-only State : No
Read-only : No
Boot Disk : No
Pagefile Disk : No
Hibernation File Disk : No
Crashdump Disk : No
Clustered Disk : No

Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 C FAT32 Partition 465 GB Healthy

DISKPART> detail part

Partition 1
Type : 0C
Hidden: No
Active: Yes
Offset in Bytes: 32256

Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
* Volume 0 C FAT32 Partition 465 GB Healthy

DISKPART> detail vol

Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
* Disk 0 Online 465 GB 1024 KB

Read-only : No
Hidden : No
No Default Drive Letter: No
Shadow Copy : No
Offline : No
BitLocker Encrypted : No
Installable : Yes

Volume Capacity : 465 GB
Volume Free Space : 465 GB

And also what MBRFix says:

D:\>mbrfix64 /drive 0 driveinfo
Drive 0
Cylinders = 60801
Tracks (heads) per cylinder = 255
Sectors per track = 63
Bytes per sector = 512
Disk size = 500105249280 (Bytes) = 465 (GB)

D:\>mbrfix64 /drive 0 listpartitions
# Boot Size (MB) Type
1 Yes 476937 12 WIN95 OSR2 32-bit FAT, LBA-mapped

D:\>mbrfix64 /drive 0 /partition 1 getpartitiontype
12

So shut down the client, plug in the testing drive, boot back into WinPE. I made a custom Diskpart script to run to format the

drive:

sel disk 0
clean
create part pri size=31000
sel part 1
active
format fs=ntfs label="LocalDisk" quick
assign letter=c
exit

Run Diskpart, apply the image with Imagex. Compare the disk information now.

DISKPART> detail disk

Disk ID: 3F5598B3
Type : SATA
Status : Online
Path : 0
Target : 0
LUN ID : 0
Location Path : PCIROOT(0)#PCI(1F02)#ATA(C00T00L00)
Current Read-only State : No
Read-only : No
Boot Disk : No
Pagefile Disk : No
Hibernation File Disk : No
Crashdump Disk : No
Clustered Disk : No

Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 C LOCALDISK FAT32 Partition 30 GB Healthy

DISKPART> detail part

Partition 1
Type : 0C
Hidden: No
Active: Yes
Offset in Bytes: 1048576

Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
* Volume 0 C LOCALDISK FAT32 Partition 30 GB Healthy

DISKPART> detail vol

Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
* Disk 0 Online 55 GB 25 GB

Read-only : No
Hidden : No
No Default Drive Letter: No
Shadow Copy : No
Offline : No
BitLocker Encrypted : No
Installable : Yes

Volume Capacity : 30 GB
Volume Free Space : 30 GB

And MBrfix:

D:\>mbrfix64 /drive 0 driveinfo
Drive 0
Cylinders = 7296
Tracks (heads) per cylinder = 255
Sectors per track = 63
Bytes per sector = 512
Disk size = 60011642880 (Bytes) = 55 (GB)

D:\>mbrfix64 /drive 0 listpartitions
# Boot Size (MB) Type
1 Yes 31000 12 WIN95 OSR2 32-bit FAT, LBA-mapped

D:\>mbrfix64 /drive 0 /partition 1 getpartitiontype
12

And time for a reboot... but it boots to: "Remove disks or other media. Press any key to restart."

And to compare, all the volume information matches, except for the obvious difference in the two different hard disks.

I shall entertain ideas about how to make this disk bootable...

0

Share this post


Link to post
Share on other sites

And to compare, all the volume information matches, except for the obvious difference in the two different hard disks.

All the volume information that you can see through the (unsuited for this use) tools you are using, yes :yes: .

All the volume information, no :no: .

Get first sector of the physicaldrive of both the "source "and the "failed target". <- this is the MBR

Get first sector of the logicaldrive of both the "source "and the "failed target". <- this is the PBR or bootsector

Zip compress them together and attach the archive to your next post, so that I can have a look at them.

On a normal 32 bit system you would normally use Hdhacker for this:

http://dimio.altervista.org/eng/

In the meantime compare them yourself in *any* disk/hex editor.

You might find several differences between them....

jaclaz

0

Share this post


Link to post
Share on other sites

Ah there is certainly a difference! A quick glance it appears that the "Physical Drive (MBR)" first sector is the same between the two, but the Logical Disk (Bootsector) is vastly different. I do have a 32bit Make_PE3 I was able to run HDHacker on just fine. Hopefully I didn't capture the USB key's bootsector like I did that other time. :whistle:

Rar file in Skydrive

Here is a question I'm not sure about. The testing drive is just that, a testing drive. Previously to me trying to put DOS on it, it had some newer version of Windows on it, 7 or 8... in case that means that something could have been leftover during the imaging process. :blushing:

0

Share this post


Link to post
Share on other sites
Here is a question I'm not sure about. The testing drive is just that, a testing drive. Previously to me trying to put DOS on it, it had some newer version of Windows on it, 7 or 8... in case that means that something could have been leftover during the imaging process. :blushing:

This being the case, I'd recommend wiping the disk up and starting over, the more so since the HDD is so small as 60 GB. But since jaclaz and I differ quite strongly about it, I'll point you to the last time we talked about it, because it's an amusing read: posts #54-63 from this thread. :D

0

Share this post


Link to post
Share on other sites

Get first sector of the physicaldrive of both the "source "and the "failed target". <- this is the MBR

Get first sector of the logicaldrive of both the "source "and the "failed target". <- this is the PBR or bootsector

Zip compress them together and attach the archive to your next post, so that I can have a look at them.

Well, if I wanted you to upload a .rar to Skydrive, I would probably had asked you to do that, INSTEAD I asked you to ATTACH the file to a post as .zip.

I don't use Skydrive and cannot access it. (I could, of course, but that would be more work for me)

jaclaz

0

Share this post


Link to post
Share on other sites

Ah there is certainly a difference! A quick glance it appears that the "Physical Drive (MBR)" first sector is the same between the two, but the Logical Disk (Bootsector) is vastly different.

You might want to have an oftalmologist check your eyes :whistle: .

I have RARELY seen in my life two MBR's SO different :w00t: .

Besides (obviously) having different MBR CODE, also the Partition Table data is VERY different (as expected).

Entry	Type	Boot	bCyl	bHead	bSect	eCyl	eHead	eSec	StartSector		NumSectors		
#0 0C 80 0 1 1 1022 254 63 63 976768002 <-Original
#0 0C 80 0 32 33 1023 254 63 2048 63488000 <-Deployed

but with a couple interesting quirks.

The "original" disk has been partitioned with a tool that INCORRECTLY set eCyl to 1022 instead of 1023 (or anyway this value has been incorrectly changed).

The "original" partition is anyway 976768002*512=500,105,217,024 bytes in size AND using the "old" (appropriate for "DOS") convention of respecting cylinder/head boundaries.

The "deployed" is 63,488,000*512=32,505,856,000 and has obviously been partitioned by diskpart using the "new" convention of "cluster alignenment" with no respect of cylinder/head boundaries.

The bootsectors reflect in the BPB the same differences, and as well have completely different CODE, the "original" has Win 9x boot code (so it is not really "DOS", in the sense of 6.22, but rather 7.x ).

Additionally, and it is normal since the huge difference in size of the partitions, also the cluster size is different (respectively 64 and 32 secots or if you prefer 32K vs. 16K)

All in all it is "improper" to call anything in this mess an "image", as you used to create the "deployed" *whatever* using tools that use a different approach and the result is obviously VERY different from the original.

MBRfix will be of use only for part of the needed fixes, you will need also MBRWIZ (or other similar tool capable of creating the partition with the "old" alignment and running on x64) or "fix" the Registry keys for partition aliignment if you want to use diskpart:

http://reboot.pro/9897/

http://reboot.pro/9897/#entry86021

and will need a FAT32 formatter capable of running under x64:

Now, what do you actually want to do? :unsure:

jaclaz

Edited by jaclaz
0

Share this post


Link to post
Share on other sites

My current progress, using a .cmd to run everything:

regedit /s z:\diskpart.reg
diskpart /s z:\fat32.txt
imagex /apply z:\dos.wim 1 c:

With this .reg file to add the VDS changes into the registry:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CURRENTCONTROLSET\SERVICES\VDS\ALIGNMENT]
"LessThan4GB"=dword:00000000
"Between4_8GB"=dword:00000000
"Between8_32GB"=dword:00000000
"GreaterThan32GB"=dword:00000000

And this diskpart script adding an align option (not sure if needed or what)

sel disk 0
clean
create part pri size=31000 align=64
sel part 1
active
format fs=fat32 label="LocalDisk" quick
assign letter=c
exit

However it still does not boot the OS. I am wondering if it is possible to use Grub4dos (no experience with this) to solve this? For some reason I tend to think Grub4DOS is some sort of miracle program someone came up with... :unsure:

Attached is HDHacker files from deployment in this latest attempt.

VDS.rar

0

Share this post


Link to post
Share on other sites

My current progress, using a .cmd to run everything:

.....

However it still does not boot the OS. I am wondering if it is possible to use Grub4dos (no experience with this) to solve this? For some reason I tend to think Grub4DOS is some sort of miracle program someone came up with... :unsure:

Attached is HDHacker files from deployment in this latest attempt.

No need to use grub4dos (not much sense in using it), as you would (besides being even less an "image") introduce an unneeded level of complexity, as you are using a 64 bit environment, whilst most of the tools/utilities are 32 bit and won't run in your environment (there are still ways, though ;), in this you are right grub4dos has "magic" possibilites).

You THIINK to have solved one issue (the alignment) but you ignored the other ones (besides actually failing at solving the alignment issue :w00t: ).

Issue #1:

Your "VDS image" is still NOT correctly aligned.

Entry	Type	Boot	bCyl	bHead	bSect	eCyl	eHead	eSec	StartSector	NumSectors
#0 0C 80 0 2 3 1023 254 63 128 63488000

You should get something *like*:

Entry	Type	Boot	bCyl	bHead	bSect	eCyl	eHead	eSec	StartSector	NumSectors
#0 0C 80 0 1 1 1023 254 63 63 63488817

Of course if you change the Registry settings BUT issue the parameter:

create part pri size=31000 align=64

strangely enough :angel you will get a partition aligned to 64 Kb (i.e. to 128 sectors or 0/2/3).

Issue #2:

When you use diskpart in a PE 3.0 it will (obviously) write the Windows 7 MBR CODE.

This is not an issue in itself as any MS MBR CODE will do the same thing: chainload the bootsector of the Active (Primary) partition in the Partition Table (but is is not anymore an "image").

Issue #3:

The real issue (once solved issue #1) is the Bootsector.

Since you use diskpart in WinPE 3.0 it will (obviously) write the Windows 7 PBR CODE. (i.e. the one invoking BOOTMGR).

BUT you want to have a PBR that invokes IO.SYS/MSDOS.SYS (or WINBOOT.SYS) like the one you have in the "original".

If you wanted a NT/2K/XP bootsector invoking NTLDR, you would use bootsect.exe /nt52 (and /nt60 to get back to the one invoking BOOTMGR)

BUT MBRfix has an option:

MbrFix /drive <num> /partition <part> fixbootsector <os> Update Boot code in boot sector

The text:

When fixing boot sector of a chosen partition, the wanted OS version must be specified. For now, the only valid choices are WIN98, DOS5 and DOS6.

The purpose of the fixbootsector command is to insert boot code for loading DOS from a partition created and formatted as FAT using the Windows 2000/XP/2003 tools, since those tools inserts boot code for loading NTLDR.

misses a part that would read something *like*:

Same goes if you are formatting the partition using Vista :ph34r: or WIndows 7 tools (and conversely PE 2.x and 3.x ones), since those tools inserts boot code for loading BOOTMGR.

Try again :yes: , run the diskpart without the "align=" parameter AND run MBRfix as detailed and post results....

jaclaz

Edited by jaclaz
0

Share this post


Link to post
Share on other sites

Do you want to hear the good news or the bad news? :rolleyes:

I ran it again without the align, see attached files... although you won't see everything you might think because of this:

X:\WINDOWS\system32>z:\mbrfix64 /drive 0 /partition 1 fixbootsector WIN98
You are about to Fix boot sector,
are you sure (Y/N)? y
Partition 1, type: 12 WIN95 OSR2 32-bit FAT, LBA-mapped
Reading sector: 16065
FAT type: FAT32
Creating a new FAT32 bootsector, 1536 bytes long
Writing boot sector to sector 16065
and to sector 16071
Function failed. Error 5: Access is denied.

But it should be noted that this isn't specifically related to MBRFix not working properly, as it can write a Vista or Win7 bootsector if I choose that option. I can also restore a backed up bootsector... :whistle:

Hmmm another thing I thought of, does this matter that I am using FAT32 (the original file system) and not FAT?

The purpose of the fixbootsector command is to insert boot code for loading DOS from a partition created and formatted as FAT using the Windows 2000/XP/2003 tools

noalign.rar

0

Share this post


Link to post
Share on other sites

Do you want to hear the good news or the bad news? :rolleyes:

Good :), though you haven't a "right" (in the sense of "identical to what a normal pre-Vista :ph34r: utility would have done), you have now a correctly aligned partition!

But it should be noted that this isn't specifically related to MBRFix not working properly, as it can write a Vista or Win7 bootsector if I choose that option. I can also restore a backed up bootsector... :whistle:

Allow me to doubt about this. :unsure:

Hmmm another thing I thought of, does this matter that I am using FAT32 (the original file system) and not FAT?

Naah, the thingy talks about 1536 bytes, which is three sectors, and casually the FAT32 bootsector is three sectors long (sectors 0, 1 and 2) whilst the FAT 12 and 16 one is only one sector long (sector 0).

There could be a "queer" issue, the DOS FAT32 bootsector is three sectors long and resides on sectors 0, 1 and 2.

BUT the NT (from 2K onwards) is still made of three sectors BUT resides on sectors 0,1 and 12.

I would suspect an actual malfunctioning of MBRFIX, cannot say if by itself, combined with stoopid Windows 7 (please read as PE 3.0) or with the stupid 64 bit version of the afore mentioned stupid Windows 7 (please read as PE 3.0).

And no, stupid+stupid doesn't make a double negation, the result is 2*stupid!

It is likely that the feature added for "real" NT OS use was not re-checked/tested/fixed*whatever for Vista :ph34r: and later use.

You might need to lock the disk and/or the volume :unsure:

Compare with:

http://reboot.pro/12413/

http://reboot.pro/15069/

You could try putting the disk offline with diskpart:

http://reboot.pro/8200/page__st__25#entry73620

but cannot say what will happen with MBRfix.

jaclaz

0

Share this post


Link to post
Share on other sites

I know that's not you main concern right now, but you should use Ridgecrop's Fat32format, to format the partition, once you get it right. Fa32format allows you to set how many sectors per cluster will be used, so you'll have one less variable to worry about...

0

Share this post


Link to post
Share on other sites

But it should be noted that this isn't specifically related to MBRFix not working properly, as it can write a Vista or Win7 bootsector if I choose that option. I can also restore a backed up bootsector... :whistle:

Allow me to doubt about this. :unsure:

Sure that's fine. I know it works because I had *tried* something just for fun... I had used Mbrfix to backup the MBR of the Seagate drive and applied it to the Toshiba drive... which obviously did not fix the booting issue.. BUT the BIOS detected the Toshiba drive as a 500GB Seagate. :whistle:

I'll take a look at your links on Thursday (vacation day) :angel

Thanks for the help so far.

0

Share this post


Link to post
Share on other sites

Sure that's fine. I know it works because I had *tried* something just for fun... I had used Mbrfix to backup the MBR of the Seagate drive and applied it to the Toshiba drive... which obviously did not fix the booting issue.. BUT the BIOS detected the Toshiba drive as a 500GB Seagate. :whistle:

If I get it right you used successfully the tool on the MBR - Master boot record (which is NOT "locked" by Vista :ph34r: / 7) and from this experience you derived that it also works in the same way on the PBR - partition boot record or VBR - Volume boot record or bootsector (which IS "locked" on a mounted volume/disk). :rolleyes:

BTW the MBRfix tool has NO provisions to change or write to the bootsector if not this particular function "fixbootsector".

Carpenter's example :whistle: :

Since I used my hammer and these type of mild steel nails for both wood and all walls in my house, and in every house I built, I know they work perfectly, and I will use them to plant a nail to hang my new calendar on the inside of this nice bank caveau, which I am told is built in reinforced concrete wih the interior lined with 3 inches thick hardened steel plates.

:lol:

jaclaz

0

Share this post


Link to post
Share on other sites

You could try putting the disk offline with diskpart:

http://reboot.pro/8200/page__st__25#entry73620

but cannot say what will happen with MBRfix.

jaclaz

I can say that this allows writing the WIN98 type bootsector. Rebooting and the DOS "image" comes up as normal.

So this will work using Mbrfix presuming the original image was created using one of the 3 boot sector types it supports. So if it were actually using a Win95 or other version of DOS, some other method would be required to deploy it properly. For the sake of documentation, here is the current .cmd file:

regedit /s z:\diskpart.reg
diskpart /s z:\fat32.txt
imagex /apply z:\dos.wim 1 c:
diskpart /s z:\offline.txt
z:\mbrfix64 /drive 0 /partition 1 fixbootsector WIN98 /yes
exit

offline.txt is:

sel disk 0
offline disk
exit

:thumbup

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.