Tripredacus Posted August 3, 2012 Share Posted August 3, 2012 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.htmI 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 diskDisk ID: F0F97B27Type : SATAStatus : OnlinePath : 0Target : 0LUN ID : 0Location Path : PCIROOT(0)#PCI(1F02)#ATA(C00T00L00)Current Read-only State : NoRead-only : NoBoot Disk : NoPagefile Disk : NoHibernation File Disk : NoCrashdump Disk : NoClustered Disk : No Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- Volume 0 C FAT32 Partition 465 GB HealthyDISKPART> detail partPartition 1Type : 0CHidden: NoActive: YesOffset in Bytes: 32256 Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- --------* Volume 0 C FAT32 Partition 465 GB HealthyDISKPART> detail vol Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- ---* Disk 0 Online 465 GB 1024 KBRead-only : NoHidden : NoNo Default Drive Letter: NoShadow Copy : NoOffline : NoBitLocker Encrypted : NoInstallable : YesVolume Capacity : 465 GBVolume Free Space : 465 GBAnd also what MBRFix says:D:\>mbrfix64 /drive 0 driveinfoDrive 0Cylinders = 60801Tracks (heads) per cylinder = 255Sectors per track = 63Bytes per sector = 512Disk size = 500105249280 (Bytes) = 465 (GB)D:\>mbrfix64 /drive 0 listpartitions# Boot Size (MB) Type1 Yes 476937 12 WIN95 OSR2 32-bit FAT, LBA-mappedD:\>mbrfix64 /drive 0 /partition 1 getpartitiontype12So 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 0cleancreate part pri size=31000sel part 1activeformat fs=ntfs label="LocalDisk" quickassign letter=cexitRun Diskpart, apply the image with Imagex. Compare the disk information now.DISKPART> detail diskDisk ID: 3F5598B3Type : SATAStatus : OnlinePath : 0Target : 0LUN ID : 0Location Path : PCIROOT(0)#PCI(1F02)#ATA(C00T00L00)Current Read-only State : NoRead-only : NoBoot Disk : NoPagefile Disk : NoHibernation File Disk : NoCrashdump Disk : NoClustered Disk : No Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- Volume 0 C LOCALDISK FAT32 Partition 30 GB HealthyDISKPART> detail partPartition 1Type : 0CHidden: NoActive: YesOffset in Bytes: 1048576 Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- --------* Volume 0 C LOCALDISK FAT32 Partition 30 GB HealthyDISKPART> detail vol Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- ---* Disk 0 Online 55 GB 25 GBRead-only : NoHidden : NoNo Default Drive Letter: NoShadow Copy : NoOffline : NoBitLocker Encrypted : NoInstallable : YesVolume Capacity : 30 GBVolume Free Space : 30 GBAnd MBrfix:D:\>mbrfix64 /drive 0 driveinfoDrive 0Cylinders = 7296Tracks (heads) per cylinder = 255Sectors per track = 63Bytes per sector = 512Disk size = 60011642880 (Bytes) = 55 (GB)D:\>mbrfix64 /drive 0 listpartitions# Boot Size (MB) Type1 Yes 31000 12 WIN95 OSR2 32-bit FAT, LBA-mappedD:\>mbrfix64 /drive 0 /partition 1 getpartitiontype12And 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... Link to comment Share on other sites More sharing options...
jaclaz Posted August 3, 2012 Share Posted August 3, 2012 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 .All the volume information, no .Get first sector of the physicaldrive of both the "source "and the "failed target". <- this is the MBRGet first sector of the logicaldrive of both the "source "and the "failed target". <- this is the PBR or bootsectorZip 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 Link to comment Share on other sites More sharing options...
Tripredacus Posted August 6, 2012 Author Share Posted August 6, 2012 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. Rar file in SkydriveHere 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. Link to comment Share on other sites More sharing options...
dencorso Posted August 7, 2012 Share Posted August 7, 2012 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. 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. Link to comment Share on other sites More sharing options...
jaclaz Posted August 7, 2012 Share Posted August 7, 2012 Get first sector of the physicaldrive of both the "source "and the "failed target". <- this is the MBRGet first sector of the logicaldrive of both the "source "and the "failed target". <- this is the PBR or bootsectorZip compress them together and attach the archive to your next post, so that I can have a look at them.Rar file in SkydriveWell, 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 Link to comment Share on other sites More sharing options...
dencorso Posted August 7, 2012 Share Posted August 7, 2012 HDHacker.zip Link to comment Share on other sites More sharing options...
jaclaz Posted August 7, 2012 Share Posted August 7, 2012 (edited) 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 .I have RARELY seen in my life two MBR's SO different .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 <-Deployedbut 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/#entry86021and will need a FAT32 formatter capable of running under x64:Now, what do you actually want to do? jaclaz Edited August 7, 2012 by jaclaz Link to comment Share on other sites More sharing options...
Tripredacus Posted August 7, 2012 Author Share Posted August 7, 2012 My current progress, using a .cmd to run everything:regedit /s z:\diskpart.regdiskpart /s z:\fat32.txtimagex /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:00000000And this diskpart script adding an align option (not sure if needed or what)sel disk 0cleancreate part pri size=31000 align=64sel part 1activeformat fs=fat32 label="LocalDisk" quickassign letter=cexitHowever 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... Attached is HDHacker files from deployment in this latest attempt.VDS.rar Link to comment Share on other sites More sharing options...
jaclaz Posted August 7, 2012 Share Posted August 7, 2012 (edited) 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... 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 ).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 63488000You 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 63488817Of course if you change the Registry settings BUT issue the parameter:create part pri size=31000 align=64strangely enough 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 sectorThe 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 or WIndows 7 tools (and conversely PE 2.x and 3.x ones), since those tools inserts boot code for loading BOOTMGR.Try again , run the diskpart without the "align=" parameter AND run MBRfix as detailed and post results....jaclaz Edited August 7, 2012 by jaclaz Link to comment Share on other sites More sharing options...
Tripredacus Posted August 7, 2012 Author Share Posted August 7, 2012 Do you want to hear the good news or the bad news? 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 WIN98You are about to Fix boot sector,are you sure (Y/N)? yPartition 1, type: 12 WIN95 OSR2 32-bit FAT, LBA-mappedReading sector: 16065FAT type: FAT32Creating a new FAT32 bootsector, 1536 bytes longWriting boot sector to sector 16065 and to sector 16071Function 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... 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 toolsnoalign.rar Link to comment Share on other sites More sharing options...
jaclaz Posted August 7, 2012 Share Posted August 7, 2012 Do you want to hear the good news or the bad news? Good , though you haven't a "right" (in the sense of "identical to what a normal pre-Vista 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... Allow me to doubt about this. 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 and later use.You might need to lock the disk and/or the volume 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#entry73620but cannot say what will happen with MBRfix.jaclaz Link to comment Share on other sites More sharing options...
dencorso Posted August 7, 2012 Share Posted August 7, 2012 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... Link to comment Share on other sites More sharing options...
Tripredacus Posted August 7, 2012 Author Share Posted August 7, 2012 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... Allow me to doubt about this. 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. I'll take a look at your links on Thursday (vacation day) Thanks for the help so far. Link to comment Share on other sites More sharing options...
jaclaz Posted August 8, 2012 Share Posted August 8, 2012 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. If I get it right you used successfully the tool on the MBR - Master boot record (which is NOT "locked" by Vista / 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). BTW the MBRfix tool has NO provisions to change or write to the bootsector if not this particular function "fixbootsector".Carpenter's example :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. jaclaz Link to comment Share on other sites More sharing options...
Tripredacus Posted August 8, 2012 Author Share Posted August 8, 2012 You could try putting the disk offline with diskpart:http://reboot.pro/8200/page__st__25#entry73620but cannot say what will happen with MBRfix.jaclazI 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.regdiskpart /s z:\fat32.txtimagex /apply z:\dos.wim 1 c:diskpart /s z:\offline.txtz:\mbrfix64 /drive 0 /partition 1 fixbootsector WIN98 /yesexitoffline.txt is:sel disk 0offline diskexit Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now