Jump to content











Photo
- - - - -

CFC to CFC


  • Please log in to reply
12 replies to this topic

#1 Dinosaur

Dinosaur
  • Deactivated
  • 7 posts
  • Location:All around Australia
  • Interests:Industrial Machiner Control
  •  
    Australia

Posted 06 March 2015 - 09:01 AM

Hi All

 

I use CFC's to boot industrial CPU boards on various machines, and have done for many years.

All was well using WinImage until the CFC's got over 1 gB, and after that it was problematic.

 

Then the CFC's changed and only the Industrial versions were bootable.(on Windows)

Simply creating a vhd image and then writing it onto another didn't work anymore.

 

Now I am in situation where the 2gB CFC's are no longer available, so I need to read a 2gB CFC and rewrite

it to a 4gB.

So, discovered RMPrepUSB, and downloaded the latest version, but there are some problems.

Reading the source CFC with "Drive -> File" and picking various formats (vhd,img , raw etc) does not transfer the second partition when you use File->Drive and select the .vhd you just created. Strangely the .raw image is

the right size , but it writes nothing to the target CFC with "File->Drive"

 

The detail of the source CFC.

WinXP embedded

HORM protected C: as primary partition.

Second partition as D: used for changable files.

 

I selected / used  the following options in RMPrepUSB

Bootloader WinPE , NTFS, Boot as HDD

 

There has to be a better and simpler way to do this.

 

Can SKS tell me how make a 4gB bootable CFC with two partitions from a source CFC that is less then 4gB.

 

Regards

 



#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 06 March 2015 - 11:10 AM

What is CFC? :w00t:

http://en.wikipedia.org/wiki/CFC

You mean a CF Card? :dubbio:

 

What is SKS? I believe Some Kind Soul :), but it could well be a SAC (Soviet Army  Carbine):

http://en.wikipedia.org/wiki/SKS

or a DEBAP (German Bike Air Pump):

http://www.sks-germany.com/

 

Whenever possible, try to be explicit, please, it is a board, not a SMS.

 

Now seriously, if you have an "original" (of *whatever*), it can always be "cloned", though RMPREPUSB is not necessarily the most suitable tool.

What you need is *any* dd-like tool, depending on the specific OS you are running, there may be "better" (in the sense of "easier") or "worse" (in the sense or "slightly more complex") tools, both command line or GUI.

 

Assuming you are running a Windows OS of *some* kind, I would suggest you Clonedisk, which is GUI and has quite a few additional features:

http://labalec.fr/erwan/?page_id=42

http://reboot.pro/to...8480-clonedisk/

 

The standard procedure in situations like yours is to make an image of the "original" disk-like device on a hard disk (useful also as a backup) and then deploy this image to a new media.

 

But essentially what you need is a much simpler tool, such as dsfi/dsfo (part of the DSFOK toolkit), which coincidentally was written by a fellow Aussie:

http://members.ozema...eezip/freeware/

 

dsfi/dsfo will work nicely on 2k and XP,  on Vista you will need to "lock" the disk (the destination one):

http://reboot.pro/to...t-v0300-update/

same applies to 7 and later though you might as well on these take the disk  (the destination one) "offline".

 

In dsfi/dsfo disks are numbered exactly like in Disk Manager, so, example:

dsfo \\.\PhysicalDrive5 0 0 c:\CFImages\mynice2Gb.img

will make an image of the CF Card mounted as disk 5, while:

dsfi \\.\PhysicalDrive6 0 0 c:\CFImages\mynice2Gb.img

will deploy it to disk 6.

 

The only possible issue with CF Cards (when used with Windows) specifically is that they may be seen as "Removable" or as "Fixed" (some old models had a tool to change this setting, but I doubt that it will still work for newer ones), there may be the need for a filter driver (there are a few different ones available), but this won't affect a "dd-like" operation.

 

:duff:

Wonko



#3 Dinosaur

Dinosaur
  • Deactivated
  • 7 posts
  • Location:All around Australia
  • Interests:Industrial Machiner Control
  •  
    Australia

Posted 07 March 2015 - 02:02 AM

Hi All

 

Thank you Wonko for your detailed reply.

Yes CFC is Compact Flash Card,  and you are right again Some Kind Soul.

 

I use an XP laptop for all my development work, and write the CFC's with a professional Lexar reader writer.

Normally on a new Win XPe project I use the image of an old one and modify it.

Then create a new image that the customer can use to make backup copies.

 

The whole process is complicated by the fact that the Industrial CPU board requires the Win XPe to be set up

specifically for that board. I cant just boot XP and customise it.

 

If only there was more usb support for FreeDos then I would simply re-compile for Dos and  ANY CFC will boot.

 

I will follow your links so kindly provided and let you know in a follow up, how I went.

 

Regards



#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 07 March 2015 - 11:54 AM

Well, there is actually no real need for USB support to boot a DOS (or FreeDOS) from a Compact Flash card, not even if the CF card is connected through an USB bus, as it is the BIOS that provides (if it has it) USB support.

And there are however DOS USB drivers, though they tend to be "picky", thus the y may or may not work in your specific case.

 

Maybe if you describe in more detail what you are actually doing/what your needs are it is possible to find a different solution from XP Embedded, which JFYI, is not necessarily XPe, which is (or maybe was :() an (optional) GUI applied to a PE (Pre-install Environment) to make it more similar to a "full" XP:

https://web.archive....collewijn.info/

https://web.archive....nfo/screenshots

 

Still JFYI, re-reading your post, the actual reason of the issues you had with RMPREPUSB derive from an old time misnaming of things.

 

A hard disk drive (or a hard disk drive like device, i.e. any device which first sector is a MBR) is often called wrongly "drive" (while it should be called "disk") and the *thing* to which DOS or Windows assign a drive letter is often called wrongly :w00t: "drive" (while it should be called "volume").

To recap (think of diskpart items):

disk=the "whole" thing=\\.\PhysicalDrive <- rather confusing :(

partition=a part of the disk which contains a volume, which, IF it is a primary partition. in practice is the same as a volume

AND same as a "drive" i.e. the *thing* to which a drive letter is assigned=volume or "LogicalDrive" 

 

:duff:

Wonko



#5 Dinosaur

Dinosaur
  • Deactivated
  • 7 posts
  • Location:All around Australia
  • Interests:Industrial Machiner Control
  •  
    Australia

Posted 08 March 2015 - 02:53 AM

Hi All

 

The reason for usb is not the booting, as the industrial cpu's have on-board cfc slots.

It is for driving various usb serial devices.

For example I have used the UBW32 board for lots of things such as Phase Angle firing of power relays,

Stepper motor control and general I/O.

Most of the usb drivers for Dos are to recognise printers and storage devices.

There is one I am aware of but the limited trial allowed before having to purchase failed.

 

So now I simply use RS232 to 485 converters and daisy chain RS485 devices to perform the same functions.

Disadvantage is software complexity in separating the comms to different type of devices, whereas in usb

you could open 3 or 4 ports (one for each device).

 

Anyhow, getting off Topic there.

 

The CloneDisk application appears to qualify as a simple "leave with customer"  type of program.

Tomorrow I will be back on site, and will know if the simple cloning from 2gB to 4gB worked and it will boot without error.

 

One question, some of the more advanced options state that it has to be "A PART type"

Havent come across that term, what is it.



#6 Dinosaur

Dinosaur
  • Deactivated
  • 7 posts
  • Location:All around Australia
  • Interests:Industrial Machiner Control
  •  
    Australia

Posted 09 March 2015 - 08:05 AM

Hi All

 

Wonko, have done many tests today, and all of them failed to create a bootable 4gB cfc from a 2gB source cfc.

These tests were done on a Laptop with XP, but as some of the features in CloneDisk are only available in Vista onwards,

I will do more tomorrow and see.

 

Using WinImage:

    Reading source 2gB cfc into a fixed disk .vhd file , and then writing it to a new Transcend Industrial 4gB;    Disk Read Error.

               ditto as above but writing to a 2gB home brand cfc , worked perfectly, even though the target cfc was smaller and the write process

               quit on error at 97%.

 

Using CloneDisk:

    Read source as .raw image and wrote as .raw image to new cfc:     Disk Boot Failure.

 

Using RMPrepUSB:

    Read source as .img and wrote as .img to new cfc;    BootMngr Missing.

 

Regards



#7 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 09 March 2015 - 11:12 AM

Well, what I suggested earlier was more or less (or at least was posted meaning):

  1. DO NOT use Winimage (it is not suited for the task because it deals mainly with Volumes and NOT Disks, and the rebuilding of hidden sectors often is "queer")
  2. DO NOT use RMPREPUSB (it is not suited for the task at hand because it has way too many options )
  3. You can use CloneDisk (though it is not needed and provides way too many options) BUT what you SHOULD really use is the dsfo/dsfi or *any* similar, simple DD-like tool capable of doing an exact clone of the disk, the additional advantage of using a command line tool is that its sintax and beaviour are easily describable and repeatable, whilst GUI tools may be more difficult to deal with (when it comes to describe their usage/settings) 

You have to grasp this concept of making an exact copy of the whole disk or \\.\Physicaldrive , in this contents "read source" means nothing, you may well be reading just the volume (or writing just the volume).

 

The result with Winimage may boot, but likely you have an invalid filesystem extending beyond the actual size of the CF card.

The result of Clonedisk (even if it doesn't boot) is likely to be more accurate, but again there are many options in that tool that you don't really want/need and that may have led to the issue.

The result of RMPREPUSB means that you somehow managed to write the wrong bootsector to the volume (Windows NT/2K/XP bootector will look for NTLDR whilst the Vista and later bootsector will look for BOOTMGR).

 

It is possible that different CF cards, particularly when "switching" from 2 Gb to 4 Gb expose a different geometry to the BIOS (or the BIOS "expects" a different geometry).

 

Usually (FAT12/16) this is not an issue, but if you use XP or later and either FAT32 or NTFS, there may be this issue about the checking for geometry at boot time, which can be solved by adjusting geometry  or patching the bootsector CODE, see:

http://www.911cd.net...ic=21702&st=129

http://reboot.pro/to...sector/?p=73205

 

Now, be nice :) forget all experiments you made till now.

get the DSFOK toolkit.

Connect the "original" CF Card to your system.

Open Disk Manager and find which Disk # it is, let's say Disk N.

Open a command prompt, navigate to where you unzipped the dsfo/dsfi, let's say C:\DSFOK and run:

dsfo \\.\PhysicalDriveN 0 0 my2GB.img

 

make DOUBLE sure that the N is the numebr corresponding to the CF card.

 

The C:\DSFOK\my2GB.img is now an exact, dd-like or "forensic sound" image of the "original".

 

Then try to deploy it to a new CF card, insert it and make sure that the Disk N is still the same and run:

dsfi \\.\PhysicalDriveN 0 0 my2GB.img

 

 

Now the "new" CF card is IDENTICAL, byte by byte, sector by sector to the "original", up to the max size of the "original" of course.

 

Whether this EXACT "clone" will boot (like the "original" did) or not may now depend on the way the target machine BIOS "sees" the device, and adjustments to the bootsector CODE (as said before) or to the actual CHS DATA in the MBR may be needed.

 

While you are at it, issue also this command:

dsfo \\.\PhysicalDriveN 0 51200 myfirst100.img

 

the myfirst100.img is a copy if the first 100 sectors, containing the MBR and (supposing you created the partitioning on XP) also of the bootsector of the first partition which is usually the active/booting one.

Compress the myfirst100.img to an archive like myfirst100.zip and either attach this file to your next post or upload it somewhere and provide a link to it, so that I can have a look at it contents and maybe understand where the issue may lie.

 

:duff:

Wonko



#8 Dinosaur

Dinosaur
  • Deactivated
  • 7 posts
  • Location:All around Australia
  • Interests:Industrial Machiner Control
  •  
    Australia

Posted 10 March 2015 - 09:20 AM

Hi All

 

Wonko, firstly I really appreciate the time and effort you are making for  a complete stranger.

Due to our time zone differences, I wont get to test the dsfi created cfc for another 12 hours when I am back on site.

 

I did not get your inference regarding WinImage etc, but was never very good at reading between the lines.

 

My only problem is that I must a leave a tool on site for them to make backup's, but I guess when I have succesfully

copied onto a 4gB cfc, then some of the GUI tools will suffice for them.

 

Below the results from the copy:

Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.

D:\>cd\dsfok

D:\dsfok>dsfo \\.\e: 0 0 my2gb.img
OK, 2002419712 bytes, 161.985s, MD5 = 92487d43d5a33dc2fd5f8c1cb03a24c0

D:\dsfok>

;------------------------------------------------------------------------
Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.

D:\dsfok>dsfi \\.\e: 0 0 my2gb.img
OK, written 2002419712 bytes at offset 0

D:\dsfok>
'------------------------------------------------------------------------

D:\dsfok>dsfi \\.\e: 0 0 my2gb.img
OK, written 2002419712 bytes at offset 0

D:\dsfok>dsfo \\.\e: 0 51200 myfirst100.img
OK, 51200 bytes, 0.063s, MD5 = 2026cdd8c8735ca0689278bb1c16b744

D:\dsfok>
'------------------------------------------------------------------------

Attached File  myfirst100.7z   4.34KB   1 downloads

 

Also .7z file attached.

 

Regards



#9 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 10 March 2015 - 11:31 AM

Good. :)

 

I now see where we where we are talking of different things.

 

These CF cards are (as it is normal) used as hard disks, but what you posted is the beginning of the image of a volume (or if you prefer of a "super-floppy") as it's first sector is a boot sector.

 

The bootsector has (among the rest) these data:

Sectors Before=63 <- this means that the volume is intended to be first volume of a hd-like device partitioned on XP or earlier, i.e Cylinder aligned

Sectors per cluster=1 <- this may mean that this small cluster size was intentionally chosen when formatted or that the volume derives from "expanding" a smaller one

Sectors per Head=63 <- this is OK, and "normal"

Number of heads=64 <- this is "normal", but NOT OK, as it will make the volume not bootable on a larger device with a different geometry, such as 128 or more likely 255, this is what may be corrected by patching the code int he bootsector as said.

 

But I asked:

dsfo \\.\PhysicalDriveN 0 51200 myfirst100.img

 

and you issued INSTEAD:w00t::

dsfo \\.\e: 0 51200 myfirst100.img

 

Can you spot the difference? :whistling:

 

You need to get this concept that the PhysicalDrive is the WHOLE thing and starts at absolute LBA sector 0, while the drive letter is assigned to a volume, in this case of a first volume at LBA 63.

 

Imagine the disk as if it was a book with several chapters.

At the beginning of the book there is the title, an index of chapters and the preface,and the book actually starts with it's chapter 1.

Your CF card has:

  • the very  first page sector - is called the MBR or Master Boot Record - and it contains the title Disk SIgnature and the index of chapters  partition table, indexed as LBA0
  • following 62 pages sectors are the preface (which in your case are actually blank pages), indexed as LBA1-62
  • on the 64th page sector Chapter 1 (the volume) begins, it's first page sector is called PBR or VBR (Partition Boot Record or Volume Boot Record) or bootsector, indexed as LBA 63

 

Now, if you are tasked to make an INTEGRAL photocopy of the book, you start from it's very first page, and NOT from the first page of Chapter 1.....

 

:duff:

Wonko



#10 Dinosaur

Dinosaur
  • Deactivated
  • 7 posts
  • Location:All around Australia
  • Interests:Industrial Machiner Control
  •  
    Australia

Posted 11 March 2015 - 07:43 AM

Hi All

Wonko, not only are you patient, but you have a sense of humour, which I like.
But your persistance is paying off, I now understand the point you have been
trying to get through.

The original image was provided by Advantech of Taiwan, whom are a Industrial computer supplier.
The image was dedicated to a PCA-6781 cpu board, which has an Intel Celeron M 600MHz (512KB L2).

From there the image was minimised to remove features I didn't want, and to make room for a partition on 2 gB cfc.
The Win XPe includes a HORM feature that protects C: from corruption or accidental deletion.
When copying the cfc's I have tried with HORM off & On, but it seems to make no difference.

I bought multiple licenses for the XPe image.

The picture attached shows the partitions.
I ran Chkdsk in XP and the result is below.
'--------------------------------------------------------
Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.

The type of the file system is NTFS.
Volume label is XP Embedded.

WARNING!  F parameter not specified.
Running CHKDSK in read-only mode.

CHKDSK is verifying files (stage 1 of 3)...
File verification completed.
CHKDSK is verifying indexes (stage 2 of 3)...
Index verification completed.
CHKDSK is verifying security descriptors (stage 3 of 3)...
Security descriptor verification completed.

   1955488 KB total disk space.
    746279 KB in 8340 files.
      2500 KB in 847 indexes.
         0 KB in bad sectors.
     23258 KB in use by the system.
     12304 KB occupied by the log file.
   1183451 KB available on disk.

       512 bytes in each allocation unit.
   3910976 total allocation units on disk.
   2366902 allocation units available on disk.
'------------------------------------------------------

When I read the source cfc with dsfo, it halted at around 1910 mB and after about 30 sec's an error
message appeared as per below. Yet it still created an img file.
'--------------------------------------------------------------------------------
D:\dsfok>dsfo \\.\PHYSICALDRIVE1 0 0 SOURCE.IMG
\\.\PHYSICALDRIVE1 - The request could not be performed because of an I/O device
 error.
This error can probably be ignored.
OK, 2004484096 bytes, 190.485s, MD5 = 16000d6f75395b09fc5d65b288c133ab
'--------------------------------------------------------------------------------

Then I ran KillCHS , which is shown here.

'--------------------------------------------------------------
:\KillCHS>killchs my2gb2nd.img

KillCHS, by Clemens Fruhwirth <clemens@endorphin.org>, 2007.
version 1.2 (revised by dencorso and Icecube, 2009).

This program patches the FAT32/NTFS boot loader to never ever
use CHS based indexing again. CHS based access is broken when
the disk geometry for heads and sectors is different from the
one stored in the BPB.

Signature not found. Not an NTFS/FAT32 or already patched.
'--------------------------------------------------------------
The Source1.img (in zip) is the read from 0 to 51200 of the source cfc.

The Target.img (in zip) is the same from the 4gB Target cfc.
I really have no idea where to go to from here.

Attached File  SOURCE1.7z   3.13KB   1 downloads

Attached File  Target.7z   3.13KB   2 downloads

Attached File  Partitions.jpg   54.31KB   0 downloads



#11 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 11 March 2015 - 10:21 AM

Good. :)
Source.img and target.img are identical (which is good).
The error in dsfo is - if not "normal" - "common enough" and it is connected to a timing problem that can happen when transferring data, as the message says:

This error can probably be ignored.

 
Now to the KillCHS program.
Our good friend Dencorso :thumbsup: with the complicity of Icecube :) meant well, i.e. to make a tool to help less experienced users apply the patch to the bootsector, BUT - unfortunately - failed when it came to documenting it's usage, just like the original Author :worship: :
http://blog.clemens....ndows_3170.html
 
What the program does (or should do) is however hinted here:
http://www.911cd.net...ndpost&p=154092
 
The issue here is that Killchs.exe is meant to have as target the bootsector or the volume (and not the whole disk) image.
 
Follow me, please:

dsfo target.img 32256 512 bstest.bin
OK, 512 bytes, 0.000s, MD5 = 077cc2f0330d2104f9dde3737640bfd1
copy /b bstest.bin bstestmod.bin
1 file copied
killchs bstestmod.bin
 
KillCHS, by Clemens Fruhwirth <clemens@endorphin.org>, 2007.
version 1.2 (revised by dencorso and Icecube, 2009).

This program patches the FAT32/NTFS boot loader to never ever
use CHS based indexing again. CHS based access is broken when
the disk geometry for heads and sectors is different from the
one stored in the BPB.

NTFS NTLDR boot loader detected. Killing CHS code.

FC /B bstest.bin bstestmod.bin
 
Comparing files bstest.bin and BSTESTMOD.BIN
000000D9: 0F 90
000000DA: 82 90
000000DB: 3A 90
000000DC: 00 90

 
So the four intended bytes were patched successfully and you can now issue:
 

dsfi target.img 32256 512 bstestmod.bin

OK, written 512 bytes at offset 32256

 

To get back to the book comparison, if the first page of Chapter 1 (in your integral photocopy)  has a single word (or just a few words) that needs to be corrected a suitable procedure would be to make a further copy of of just that page, make the correction on this copy and then replace the single page within the book.

 

The issue here may be that you know that you want to copy/replace a single page sector and that page sector is indexed as LBA 63, whilst dsfo/dsfi know nothing about pages sectors, as they only can count words bytes.

Luckily enough we know that each page sector of this book contains EXACTLY 512 words bytes, so we can use 63*512=32256 as offset and 512 as extents so that dsfo/dsfi are happy, dsfo can find the page sector, and extract it, killchs is happy to find the expected target (a bootsector and not a MBR) and patches it happily, dsfi can put the modified page sector back where it should be, and hopefully everything ends well :).

 

I hope the above is clear.

 

:duff:

Wonko



#12 Dinosaur

Dinosaur
  • Deactivated
  • 7 posts
  • Location:All around Australia
  • Interests:Industrial Machiner Control
  •  
    Australia

Posted 12 March 2015 - 07:37 AM

Hi All

 

Well Wonko I have Success at last. :1st:

 

Your patience has guided me through a minefield, and all without blowing something up

or destroying a disk.

 

I followed your instructions to the letter,and as a result I was able to boot the Target cfc.

Even the cheap local cfc's that I had doubts about.

 

You have saved this old timer from significant head ache.

 

Off Topic and just FYI.

 

I have been building computerised weighing machines for 25 years now, and it has included everything

from Diamonds to Garbage Bins. Then as a result of Chinese competition, had to retire about

2 years ago. However, some old customers just wont let go off me, and I get called on to consult.

But things are changing so ofton in the computer industry, that the things that worked 2 years ago, wont work now.

Particularly with Windows, so whenever I can I convert back to FreeDos. But I guess I should have got aqainted

with Linux years ago.

Even a new Laptop wont boot to an XP CD anymore, so when this one dies, I will have to REALLY retire.

 

Either way, I have really appreciated your help.

 

Regards

 

 

 



#13 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 12 March 2015 - 09:57 AM

 

Well Wonko I have Success at last. :1st:

...

Either way, I have really appreciated your help.

.

 

Very good. :)

Only to glad to have contributed to yet another happy bunny :smiling9::

http://www.msfn.org/...artup/?p=828512

 

:duff:

Wonko






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users