CF cards as storage - wear leveling

Warner Losh imp at
Sun Mar 19 13:20:45 CDT 2017

On Sun, Mar 19, 2017 at 10:06 AM, Jules Richardson via cctalk
<cctalk at> wrote:
> I just bought an IDE-CF adapter the other day with the intention of
> replacing the spinning rust in my disk imaging system (which is some
> early/mid-90s 80486-based thing).
> However, the CF entry on Wikipedia says:
> "Most CompactFlash flash-memory devices limit wear on blocks by varying the
> physical location to which a block is written. When using CompactFlash in
> ATA mode to take the place of the hard disk drive, wear leveling becomes
> critical because low-numbered blocks contain tables whose contents change
> frequently. Current CompactFlash cards spread the wear-leveling across the
> entire drive. The more advanced CompactFlash cards will move data that
> rarely changes to ensure all blocks wear evenly."
> ... I'm a little wary about the way it says "most CF cards", implying that
> there are some out there which don't do any wear-leveling at all. So, the
> obvious question: is there a way of knowing which cards are going to be good
> and which are useless as IDE replacements? Maybe by age, capacity,
> manufacturer? I'd prefer not to invest time into setting software up only to
> find that the card fails in a matter of weeks.

Just about ANY CF card you buy today new will have wear leveling. It's
almost impossible without trying to be an ass to the card to have it
fail in a few weeks. I've run 64MB cards in Soekris boxes for a decade
w/o any problems. The key, as with all flash purchases, is to buy the
best, fastest you can rather than the cheapest you can. But most unix
systems can do many things to mitigate wear. There's dozens of
tutorials about mounting noatime (to keep access times from being
updated), to more advanced features like putting /var/tmp and friends
on memory disks, etc. With a 486, though, that might not be an option.
Not sure what kind of system you are migrating though...

CF cards tend to be much more compatible with systems than SD card
adapters, but on extremely old system can be picky even with CF cards.
I had a system back in the day not present the CF card as a bootable
device because something in its ID string was a bit wonky to it. SD
cards tend to be crap too without careful selection (which usually
means getting a couple of the faster cards and hoping that at least
one of them is good). These days, it's more a precaution than an
actual requirement though, but see below.

For $40 you can get a 32GB Lexar Professional that boasts 1066x speed
and UDMA7. You'll likely not do UDMA at all in a system of that age.
DMA is another area where you have to buy the right CF card (though
it's hard to buy the wrong kind new, random used stuff is a crap shoot
whether all the pins needed for UDMA are present). If you have
problems, try setting the to PIO. Seems like overkill. If you are
looking for a smaller card because the BIOS just can't cope with
anything that big, you'll need to buy the professional grade used
cards, though that too is a crap shoot (so buy several). If you have a
reasonable sized system (say 2GB) the way you cope with failure is to
backup an image every so often with DD and just blast it out to a new
card if the one you get fails. But if you do that, the size has to be
>= the old one. And with a 486, you likely don't have an LBA BIOS, so
you need to make sure the geometry matches which can be tricky. The
geometry reported by CF<->USB adapters will almost certainly be
different than what the CF<->IDE adapter reports.

So good luck!


More information about the cctalk mailing list