Question Locked

Copy smart card on Linux system?

0 helpful
23 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

We have a 'CompactFlash' format media card with a couple of programs we use to test one of our products. We have only this single card, which is both a production bottleneck and a point of failure. We need multiple copies of this card.

We can't read the card with a Windows system, but we can read it with a Linux (RedHat) box. Unfortunately, this box has only a single USB slot, so we can only attach one card reader at a time.

Is there a (easy?) way to make copies of this CF card?

Thanks.

23 replies

by tobif

Smart cards are called "smart cards" because they typically have some "smart" functions.

The card may contain secret information, like encryption keys, which you can't retrieve.

This can be used to have the card function as a licensing tool.

So, you could try to extract files and write them in some binary format to your hard drive and then copy them to another card. But probably there are files hidden on the card that you can't get to.

by charliespencer

I was going from the user's description, something I should know better than to do. Once I looked at it, I realized it's a CompactFlash format media card. I don't think there are any 'smart' capabilities to it. It was loaded several years ago by an employee who has since left.

We're about to try a Ghost disk-to-disk operation on it.

by tobif

Well, then there shouldn't be any big hurdles.
Maybe you don't even need to use the same bearer on newer machines?

by robo_dev

Perhaps loading a Linux emulator on the PC, or even a CD-ROM or USB-based linux distro?

Oh wait, here's a Windows driver to allow EXT2 file-system to be read on a windows box:

http://www.fs-driver.org/

by charliespencer

Thanks for the software recommendation. I've forwarded it to the guy I'm assisting with this mess.

by hal 9000

But couldn't you use a USB Hub to add more than 1 Card Reader/Writer?

This shouldn't be a Problem on any Red Hat Box just copy from one Card to another as I'm assuming that you'll need several Card Readers for the different Cards that you make.

What am I missing here?

Col

by robo_dev

and Windows surely does not. The solution is to either find a Linux emulator that allows copying to/from a EXT2 volume.

The better solution is to load the add-on driver for windows which lets you read Linux EXT2 file system:
http://www.fs-driver.org/

by oh smeg

This card wasn't being used with Windows Platforms as it's obviously not a Native Windows Partition type.

Yep I do agree that adding the Emulator to a Windows Platform will be the best idea here provided that this is Documented. Unfortunately too often I've seen one tech do something and then others who come latter end up in all sorts of problems because I saw "Joe" do this but I can not get it to work. When you start to add additional things to basic Windows Systems that are undocumented or others don't know about that's a recipe for problems latter. Had that happen to me way too often in the past particularly when I ask Users what's gone wrong? They just say that such and such used to happen and it's stopped working. Never something common and always a nasty little used thing. Or back in the Main Frame Days the fitters would move in install the new system and not document anything and then we had to come in after and make it work without knowing where anything was going. ;)

Col

by charliespencer

We don't have any USB hubs but borrowed one. We slapped it on the RH box, but attempting to copy from one card to the other failed.

There's something really bizarre going on here. The card's manufacturer's label says '128 Mb'. However, when we look at the card, it's full of files that are EACH 1.4 GIG. When we try to copy them to the second card, it reports insufficient file space (no kidding).

My only guess is that there's some other file system on the original card. When Windows wouldn't read it, I -assumed- it must have been in EXT2. Now I'm thinking it's formatted in something else that neither OS can read.

by seanferd

Did you try dd ? A raw copy might work better if nothing can understand the filesystem on the card properly.

Or you can download a copy of dd for Windows.

Reminds me of your your previous crazy adventure with copying something like this...

by charliespencer

It's very closely related to my previous fiasco. In that case I got lucky; we briefly employed someone with the skills to do completely rewrite of what I was struggling to streamline.

DD? I'll see if I can find my notes on that one. If I recall, last time around I had problems determining exactly which device nomenclature to use for the flash reader. I so look forward to doing that for TWO readers...

by seanferd

I can't believe I've never run across that.

Now I'll have to search for similar drivers for other filesystems, although I do tend to go with the ext2 default on most Linux distros.

The reason I mentioned dd is that both RH and Win seemed to have problems reading the FS on the card properly. Raw bit transfer will work a treat, then.

by oh smeg

What is on this Memory Card isn't a shortcut to something stored else where is it?

I seem to remember a process where you could add a shortcut that looked like the entire file from ages ago somewhere.

What are the actual Proprieties of the File and probably more importantly what type of File System is involved here?

There could also be a compression Utility involved so that it automatically compresses and decompresses when writing to or reading from the card.

Col

by seanferd

Is that what you were thinking? If not, I sure would be interested what it was you were thinking about, if you remember.

Compression - yeah - that could explain the size mismatch. A lot (all?) of Linux live images are highly compressed.

by oh smeg

But I can remember from years ago what appeared to be mounting large Files onto very small Devices that where actually a Shortcut to the full file. But for the life of me I can not remember what it's all about now but it was probably in my Unix Days so it may not even be applicable here.

Of course if I was to sit down at a half way decent Unix Station I could probably type in the instruction without thinking about it. :D

Col

by charliespencer

If that's the case, we don't know where the target resides. This card is inserted into a slot on a piece of equipment we build. Test programs (supposedly stored on the card) are run from the unit's control panel via a series of manual switches, and results are read via LED sequences. If the card held only shortcuts, they'd have to point back to the produced unit. That would render the card unnecessary, but since the tests won't run without it...

by tobif

Either the fields are in a different order and size (so that, for instance, a part of the file name incorrectly is read as file size), or the file size was entered as small-endian, but was read a big-endian...
In other words, slightly different file system...

Edit: Added "for instance"

by charliespencer

seanferd, thanks for suggesting the dd command.

robo_dev, thanks for the peer mail with the dd command parameters. It took me a few minutes to dig out the device name for the second reader.

It did something, as indicated by the media readers' LEDs. Until we can put the media in the product it tests, we won't know for sure if the copies are good. On the other hand, I can't see anything else I can do so it's out of my hair. If the dd didn't work, the guy responsible is going to order fs-driver as a couple of you recommended.

Thanks.

This discussion is closed to new replies.