2003-02-02 22:22:21

by Pavel Machek

[permalink] [raw]
Subject: Compactflash cards dying?

Hi!

I had compactflash from Apacer (256MB), and it started corrupting data
in few months, eventually becoming useless and being given back for
repair. They gave me another one and it is just starting to corrupt
data.

First time I repartitioned it; now I only did mke2fs, and data
corruption can be seen by something as simple as

cat /mnt/cf/mp3/* > /mnt/cf/delme; md5sum /mnt/cf/delme.

[Fails 1 in 5 tries].

Anyone seen something similar? Are there some known-good
compactflash-es?

Pavel
--
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?


2003-02-02 23:53:08

by Willy Tarreau

[permalink] [raw]
Subject: Re: Compactflash cards dying?

Hi Pavel !

I had this same problem with my very first CF (16 MB) connected to a home-made
IDE adapter. I quickly discovered that the power wire (+5V) had been cut and
that the power was driven through the logic signals, which were strong enough
to let the card work correctly... nearly correctly. Because it got uncorrectable
defects, detected as bad sectors at IDE level. So may be your adapter is too
weak. Or may be you also use it in a battery-powered device which has frequent
power outages ?

Cheers,
Willy

On Sun, Feb 02, 2003 at 11:30:09PM +0100, Pavel Machek wrote:
> Hi!
>
> I had compactflash from Apacer (256MB), and it started corrupting data
> in few months, eventually becoming useless and being given back for
> repair. They gave me another one and it is just starting to corrupt
> data.
>
> First time I repartitioned it; now I only did mke2fs, and data
> corruption can be seen by something as simple as
>
> cat /mnt/cf/mp3/* > /mnt/cf/delme; md5sum /mnt/cf/delme.
>
> [Fails 1 in 5 tries].
>
> Anyone seen something similar? Are there some known-good
> compactflash-es?
>
> Pavel
> --
> Worst form of spam? Adding advertisment signatures ala sourceforge.net.
> What goes next? Inserting advertisment *into* email?
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2003-02-03 00:27:20

by Daniel Egger

[permalink] [raw]
Subject: Re: Compactflash cards dying?

Am Son, 2003-02-02 um 23.30 schrieb Pavel Machek:

> First time I repartitioned it; now I only did mke2fs, and data
> corruption can be seen by something as simple as

> cat /mnt/cf/mp3/* > /mnt/cf/delme; md5sum /mnt/cf/delme.

> Anyone seen something similar? Are there some known-good
> compactflash-es?

CF has limited write cycles. A few hundred if you're lucky.
And depending on the type of flash it's quite likely that every
changed byte will result in a whole block being written back.

I'm running dotzends of CF cards and due to some care not a single
one has developped bad blocks as of yet.

--
Servus,
Daniel


Attachments:
signature.asc (189.00 B)
Dies ist ein digital signierter Nachrichtenteil

2003-02-03 01:54:48

by Martin K. Petersen

[permalink] [raw]
Subject: Re: Compactflash cards dying?

>>>>> "Daniel" == Daniel Egger <[email protected]> writes:

Daniel> CF has limited write cycles. A few hundred if you're lucky.

Aah, that's a bit pessimistic. Even for a regular flash.

It is true that the number of write cycles varies between cards. Some
vendors have both consumer and industrial grade cards, and the
industrial grade ones use better parts inside.

However, I have yet to see a CF card which didn't survive beyond a
million writes.

Note that CF cards do transparent wear averaging inside. So it's
obviously not a million writes to the same physical spot. Also, most
vendors claim they have spare blocks for relocating areas that are
completely worn out.

So while a Compact Flash isn't a hard disk, it is at least a couple of
orders of magnitude better than "hundreds of writes".

--
Martin K. Petersen Wild Open Source, Inc.
[email protected] http://www.wildopensource.com/


2003-02-03 07:02:48

by Bryan Andersen

[permalink] [raw]
Subject: Re: Compactflash cards dying?

Use a file system that is designed for use on FLASH devices. In general
FLASH devices are not very useable for systems that need to modify data
on the disk often.

You may wish to look at the virtual memory file system available in the
kernel if you have enough RAM. You would mount your CompactFlash device
read only and have all updates go to the virtual memory filesystem.
When you want to commit the changes, remount the CompactFlash read/write
and save the changes then remount it read only.

You would be surprised how fast a million writes can happen on a disk.

- Bryan

Pavel Machek wrote:
> Hi!
>
> I had compactflash from Apacer (256MB), and it started corrupting data
> in few months, eventually becoming useless and being given back for
> repair. They gave me another one and it is just starting to corrupt
> data.
>
> First time I repartitioned it; now I only did mke2fs, and data
> corruption can be seen by something as simple as
>
> cat /mnt/cf/mp3/* > /mnt/cf/delme; md5sum /mnt/cf/delme.
>
> [Fails 1 in 5 tries].
>
> Anyone seen something similar? Are there some known-good
> compactflash-es?
>
> Pavel


2003-02-03 07:21:03

by Andreas Jellinghaus

[permalink] [raw]
Subject: Re: Compactflash cards dying?

> I had compactflash from Apacer (256MB), and it started corrupting data
> in few months, eventually becoming useless and being given back for
> repair. They gave me another one and it is just starting to corrupt
> data.

last year we had some problems with compactflash. It was only 7bit
clean, not 8bit. However the cards worked fine via usb devices,
but not when used as IDE device.

test if writing 7bit data is reliable :-)

Andreas


2003-02-03 08:30:23

by Jörn Engel

[permalink] [raw]
Subject: Re: Compactflash cards dying?

On Sun, 2 February 2003 21:04:23 -0500, Martin K. Petersen wrote:
> >>>>> "Daniel" == Daniel Egger <[email protected]> writes:
>
> Daniel> CF has limited write cycles. A few hundred if you're lucky.
>
> However, I have yet to see a CF card which didn't survive beyond a
> million writes.
>
> Note that CF cards do transparent wear averaging inside. So it's
> obviously not a million writes to the same physical spot. Also, most
> vendors claim they have spare blocks for relocating areas that are
> completely worn out.

This apears to be the same statement, except that Daniel forgot to add
"per block".

J?rn

--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+: a- C++ UL++++ P+(++) L++++$ !E W++ N+ o? K? w- O- M- V?
PS+(++) PE++ Y+ PGP>+ t+@ 5? X+ R@ !tv b+ DI+ !D G- e h-- r y+
------END GEEK CODE BLOCK------

2003-02-03 08:41:28

by Miquel van Smoorenburg

[permalink] [raw]
Subject: Re: Compactflash cards dying?

In article <1044232591.545.8.camel@sonja>,
Daniel Egger <[email protected]> wrote:
>CF has limited write cycles. A few hundred if you're lucky.
>And depending on the type of flash it's quite likely that every
>changed byte will result in a whole block being written back.

Then why if I google for 'compact flash write cycles' all specs
of flash cards I found say 100000 write cycles at least ?

Mike.
--
Anyone who is capable of getting themselves made President should
on no account be allowed to do the job -- Douglas Adams.

2003-02-03 13:48:45

by Martin K. Petersen

[permalink] [raw]
Subject: Re: Compactflash cards dying?

>>>>> "J?rn" == J?rn Engel <[email protected]> writes:

>> Note that CF cards do transparent wear averaging inside. So it's
>> obviously not a million writes to the same physical spot. Also,
>> most vendors claim they have spare blocks for relocating areas that
>> are completely worn out.

J?rn> This apears to be the same statement, except that Daniel forgot
J?rn> to add "per block".

They'd have to use really shitty flash parts to go as low as 100
writes per physical block. Off by a couple of orders of magnitude.

--
Martin K. Petersen Wild Open Source, Inc.
[email protected] http://www.wildopensource.com/

2003-02-03 13:59:00

by Martin K. Petersen

[permalink] [raw]
Subject: Re: Compactflash cards dying?

>>>>> "Bryan" == Bryan Andersen <[email protected]> writes:

Bryan> Use a file system that is designed for use on FLASH devices.
Bryan> In general FLASH devices are not very useable for systems that
Bryan> need to modify data on the disk often.

Just a heads up that flash (as in MTD) != Compact Flash.

For all practical purposes a Compact Flash is an IDE disk (Or a an IDE
controller with a disk behind it. Depends how you wire it).

Internally, the Compact Flash does all the wear averaging that a flash
filesystem like jffs2 provides. Transparently to the application.

All Linux sees is a linear stream of bytes. Just like a disk. And it
should be treated as such.


Bryan> You may wish to look at the virtual memory file system
Bryan> available in the kernel if you have enough RAM. You would
Bryan> mount your CompactFlash device read only and have all updates
Bryan> go to the virtual memory filesystem. When you want to commit
Bryan> the changes, remount the CompactFlash read/write and save the
Bryan> changes then remount it read only.

tmpfs to the rescue!


Bryan> You would be surprised how fast a million writes can happen on
Bryan> a disk.

Yup.

You would also be surprised how long it takes to actually *perform* a
million writes on a slow piece of media like Compact Flash ;)

--
Martin K. Petersen Wild Open Source, Inc.
[email protected] http://www.wildopensource.com/

2003-02-03 14:04:05

by Padraig

[permalink] [raw]
Subject: Re: Compactflash cards dying?

> Bryan> You would be surprised how fast a million writes can happen on
> Bryan> a disk.

especially if you don't mount with noatime.
I mounted my filesystems ro in conjunction with tmpfs
and never had problems with CF.

P?draig.

2003-02-03 14:14:51

by John Bradford

[permalink] [raw]
Subject: Re: Compactflash cards dying?

[snip discussion about Compact Flash cards]

On a somewhat-related subject, is there currently an easy way to use a
PROM as a read-only filesystem?

I.E. I'd like to write a raw filesystem image to an PROM using a PROM
burner then connect that, probably to the parallel port, and use it as
a block device.

It should be fairly simple to build the parallel port -> PROM adaptor,
as it would essentially just be a ZIF socket, and a whole load of
latches to multiplex the limited number of I/O lines to the 32 or so
needed for address and data, and the driver should be straightforward
to write as well.

Or is there a reason why this hasn't been done? PROMs are much
cheaper than Compact Flash...

John.

2003-02-03 14:20:15

by John Bradford

[permalink] [raw]
Subject: Re: Compactflash cards dying?

> > Bryan> You would be surprised how fast a million writes can happen on
> > Bryan> a disk.
>
> especially if you don't mount with noatime.

noatime only suppresses access time updating on reads, writes still
update the access time.

John

2003-02-03 19:59:30

by Pavel Machek

[permalink] [raw]
Subject: Re: Compactflash cards dying?

Hi!

> > I had compactflash from Apacer (256MB), and it started corrupting data
> > in few months, eventually becoming useless and being given back for
> > repair. They gave me another one and it is just starting to corrupt
> > data.
>
> last year we had some problems with compactflash. It was only 7bit
> clean, not 8bit. However the cards worked fine via usb devices,
> but not when used as IDE device.
>
> test if writing 7bit data is reliable :-)

Ouch... I can't imageine how even VFAT would work on something not
8-bit-clean. I doubt FAT only uses 7bits...

--
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?

2003-02-03 19:59:30

by Pavel Machek

[permalink] [raw]
Subject: Re: Compactflash cards dying?

Hi!

> I had this same problem with my very first CF (16 MB) connected to a home-made
> IDE adapter. I quickly discovered that the power wire (+5V) had been cut and
> that the power was driven through the logic signals, which were strong enough
> to let the card work correctly... nearly correctly. Because it got uncorrectable
> defects, detected as bad sectors at IDE level. So may be your adapter is too
> weak. Or may be you also use it in a battery-powered device which has frequent
> power outages ?

I've seen it on sharp zaurus, and same flash had bad problems in
toshiba 4030cdt notebook. Zaurus is PDA but it *does* monitor voltage;
I can't imagine toshiba having problems with power.

Pavel
--
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?

2003-02-03 21:09:42

by Bryan Andersen

[permalink] [raw]
Subject: Re: Compactflash cards dying?

Take a look at all the embedded Linux distributions. There are
solutions for this out there. I haven't looked into them as I just
stuck a hole PC into my robot.

The issue with ROM style data storage is once written, any changes
require replacement of the devices. That adds up after a few revisions.
All motherboards once had PROMS (usually windowless EPROMS) for
storing the BIOS. It is just the cost of FLASH type devices has come
down to the point where they are cheep when you look at the costs of
going about it some other way.

- Bryan

> On a somewhat-related subject, is there currently an easy way to use a
> PROM as a read-only filesystem?
>
> I.E. I'd like to write a raw filesystem image to an PROM using a PROM
> burner then connect that, probably to the parallel port, and use it as
> a block device.
>
> It should be fairly simple to build the parallel port -> PROM adaptor,
> as it would essentially just be a ZIF socket, and a whole load of
> latches to multiplex the limited number of I/O lines to the 32 or so
> needed for address and data, and the driver should be straightforward
> to write as well.
>
> Or is there a reason why this hasn't been done? PROMs are much
> cheaper than Compact Flash...



2003-02-03 23:03:08

by David Woodhouse

[permalink] [raw]
Subject: Re: Compactflash cards dying?

On Mon, 2003-02-03 at 12:54, Pavel Machek wrote:
> Ouch... I can't imageine how even VFAT would work on something not
> 8-bit-clean. I doubt FAT only uses 7bits...

So use a pseudo-file-system which lets you store 8-bit data on such a
device storing only 7-bit data.

It's no less sensible than taking a real flash device and hacking up a
pseudo-file-system which makes it pretend to be a block device, then
using a 'normal' file system on top of that.

It's just a shame that CF doesn't generally give you real access to the
underlying flash and let you use a real file system designed for the
purpose rather than its silly 'translation layer' :)

--
dwmw2

2003-02-03 23:50:44

by Roger Larsson

[permalink] [raw]
Subject: Re: Compactflash cards dying?

On Sunday 02 February 2003 23:30, Pavel Machek wrote:
> Hi!
>
> I had compactflash from Apacer (256MB), and it started corrupting data
> in few months, eventually becoming useless and being given back for
> repair. They gave me another one and it is just starting to corrupt
> data.
>
> First time I repartitioned it; now I only did mke2fs, and data
> corruption can be seen by something as simple as
>
> cat /mnt/cf/mp3/* > /mnt/cf/delme; md5sum /mnt/cf/delme.
>
> [Fails 1 in 5 tries].

That is very bad... I wonder if you do something that the CF does
not like - like power off while writing (can actually destroy the
disk - read in some newsgroup)

>
> Anyone seen something similar? Are there some known-good
> compactflash-es?
>

I would recomend SanDisk

/RogerL

--
Roger Larsson
Skellefte?
Sweden

2003-02-04 00:01:25

by David Woodhouse

[permalink] [raw]
Subject: Re: Compactflash cards dying?

On Mon, 2003-02-03 at 23:56, Roger Larsson wrote:
> On Sunday 02 February 2003 23:30, Pavel Machek wrote:
> > I had compactflash from Apacer (256MB), and it started corrupting data
> > in few months, eventually becoming useless and being given back for
> > repair. They gave me another one and it is just starting to corrupt
> > data.
>
> That is very bad... I wonder if you do something that the CF does
> not like - like power off while writing (can actually destroy the
> disk - read in some newsgroup)

I am led to believe that this is normal for CompactFlash. I seem to
recall that the phrase 'bogroll technology' was used by the last person
to attempt any serious testing.

It's fine for short-term storage of stuff like digital photos, but don't
try using it for long-term storage. Think of it like a floppy disc -- if
you have any _important_ data, make sure it's backed up or copied onto
at least three of them to avoid loss.

Not that there's any _fundamental_ reason why PCMCIA-ATA should be
completely unreliable, that just seems to be the way it's done.
Reliability costs, you see.

--
dwmw2

2003-02-04 00:24:35

by Andrew McGregor

[permalink] [raw]
Subject: Re: Compactflash cards dying?



--On Tuesday, February 04, 2003 00:56:00 +0100 Roger Larsson
<[email protected]> wrote:

> On Sunday 02 February 2003 23:30, Pavel Machek wrote:
>> Hi!
>>
>> I had compactflash from Apacer (256MB), and it started corrupting data
>> in few months, eventually becoming useless and being given back for
>> repair. They gave me another one and it is just starting to corrupt
>> data.
>>
>> First time I repartitioned it; now I only did mke2fs, and data
>> corruption can be seen by something as simple as
>>
>> cat /mnt/cf/mp3/* > /mnt/cf/delme; md5sum /mnt/cf/delme.
>>
>> [Fails 1 in 5 tries].
>
> That is very bad... I wonder if you do something that the CF does
> not like - like power off while writing (can actually destroy the
> disk - read in some newsgroup)

Maybe your system is feeding it the wrong supply voltage?

>
>>
>> Anyone seen something similar? Are there some known-good
>> compactflash-es?
>>
>
> I would recomend SanDisk

Seconded, they're generally really good.

Andrew


Attachments:
(No filename) (0.99 kB)
(No filename) (189.00 B)
Download all attachments

2003-02-04 03:30:03

by H. Peter Anvin

[permalink] [raw]
Subject: Re: Compactflash cards dying?

Followup to: <[email protected]>
By author: David Woodhouse <[email protected]>
In newsgroup: linux.dev.kernel
>
> So use a pseudo-file-system which lets you store 8-bit data on such a
> device storing only 7-bit data.
>
> It's no less sensible than taking a real flash device and hacking up a
> pseudo-file-system which makes it pretend to be a block device, then
> using a 'normal' file system on top of that.
>
> It's just a shame that CF doesn't generally give you real access to the
> underlying flash and let you use a real file system designed for the
> purpose rather than its silly 'translation layer' :)
>

Well, it also let them implement the translation layer using a
different storage device, which may be more appropriate for the task,
or by playing other hardware-specific games.

-hpa
--
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: cris ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64

2003-02-04 11:14:37

by Pavel Machek

[permalink] [raw]
Subject: Re: Compactflash cards dying?

Hi!

> > Ouch... I can't imageine how even VFAT would work on something not
> > 8-bit-clean. I doubt FAT only uses 7bits...
>
> So use a pseudo-file-system which lets you store 8-bit data on such a
> device storing only 7-bit data.
>
> It's no less sensible than taking a real flash device and hacking up a
> pseudo-file-system which makes it pretend to be a block device, then
> using a 'normal' file system on top of that.
>
> It's just a shame that CF doesn't generally give you real access to the
> underlying flash and let you use a real file system designed for the
> purpose rather than its silly 'translation layer' :)

Well, if their translation layer at least *worked*, I'd be happy with
it.

Unfortunately one error per 50MB is not acceptable...

Pavel
--
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.

2003-02-04 11:21:09

by David Woodhouse

[permalink] [raw]
Subject: Re: Compactflash cards dying?

On Tue, 2003-02-04 at 11:24, Pavel Machek wrote:
> Well, if their translation layer at least *worked*, I'd be happy with
> it.

Would you? You fill up your FAT or EXT2 file system, then delete all
your files. There are lots and lots of sectors with now-unused data.

Then start filling it up again.

To accommodate your writes, the underlying translation layer is busily
garbage-collecting all those blocks which are _unused_, copying them
from one part of the flash to another to collect 'fresh' copies of data
together while reclaiming space from 'obsoleted' copies of changed
sectors.

Or you manage to find a vendor who sells reliable cards, hence decide
it's actually usable for real medium-term storage and start using EXT3
on it. You write out all your metadata (or even all your data) twice to
the device, and it hits the flash twice, because you can't tie in to the
_underlying_ journalling which it's already doing.

I wouldn't be happy.

--
dwmw2

2003-02-04 19:19:57

by Pavel Machek

[permalink] [raw]
Subject: Re: Compactflash cards dying?

Hi!

> > Well, if their translation layer at least *worked*, I'd be happy with
> > it.
>
> Would you? You fill up your FAT or EXT2 file system, then delete all
> your files. There are lots and lots of sectors with now-unused data.
>
> Then start filling it up again.
>
> To accommodate your writes, the underlying translation layer is busily
> garbage-collecting all those blocks which are _unused_, copying them
> from one part of the flash to another to collect 'fresh' copies of data
> together while reclaiming space from 'obsoleted' copies of changed
> sectors.
>
> Or you manage to find a vendor who sells reliable cards, hence decide
> it's actually usable for real medium-term storage and start using
> EXT3

Well, I've got old 20-mb PCMCIA, and that worked for me for >2
years. Now I've apacer 256MB CF, and it died within a *month*. I
returned it and the "new" one died within *week*. Ouch.

Pavel
--
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?

2003-02-04 20:52:33

by Bill Davidsen

[permalink] [raw]
Subject: Re: Compactflash cards dying?

On Mon, 3 Feb 2003, John Bradford wrote:

> [snip discussion about Compact Flash cards]

> Or is there a reason why this hasn't been done? PROMs are much
> cheaper than Compact Flash...

And zero cameras, printers, PCMCIA cards and USB adaptors for them.

--
bill davidsen <[email protected]>
CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.

2003-02-04 20:59:57

by John Bradford

[permalink] [raw]
Subject: Re: Compactflash cards dying?

> > [snip discussion about Compact Flash cards]
>
> > Or is there a reason why this hasn't been done? PROMs are much
> > cheaper than Compact Flash...
>
> And zero cameras, printers, PCMCIA cards and USB adaptors for them.

So? Maybe I just have fond memories of my Sinclair Z88 which was
exclusively solid state, using cheap, (well, they weren't so cheap 15
years ago), EPROMs, that I never lost a single bit to, and that are
still readable today.

John.

2003-02-05 13:45:29

by Pavel Machek

[permalink] [raw]
Subject: Re: Compactflash cards dying?

Hi!

> > I had compactflash from Apacer (256MB), and it started corrupting data
> > in few months, eventually becoming useless and being given back for
> > repair. They gave me another one and it is just starting to corrupt
> > data.
> >
> > First time I repartitioned it; now I only did mke2fs, and data
> > corruption can be seen by something as simple as
> >
> > cat /mnt/cf/mp3/* > /mnt/cf/delme; md5sum /mnt/cf/delme.
> >
> > [Fails 1 in 5 tries].
>
> That is very bad... I wonder if you do something that the CF does
> not like - like power off while writing (can actually destroy the
> disk - read in some newsgroup)

I don't think I did anything bad :-(. That "1 in 5 tries bad" was on
the running system, with no reboots, powerdowns, etc.

It is possible that zaurus went into powersave mode, but I've
certainly seen corruption without powersave, too.
Pavel
--
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?

2003-02-05 13:46:35

by Pavel Machek

[permalink] [raw]
Subject: Re: Compactflash cards dying?

Hi!

> > > I had compactflash from Apacer (256MB), and it started corrupting data
> > > in few months, eventually becoming useless and being given back for
> > > repair. They gave me another one and it is just starting to corrupt
> > > data.
> >
> > That is very bad... I wonder if you do something that the CF does
> > not like - like power off while writing (can actually destroy the
> > disk - read in some newsgroup)
>
> I am led to believe that this is normal for CompactFlash. I seem to
> recall that the phrase 'bogroll technology' was used by the last person
> to attempt any serious testing.
>
> It's fine for short-term storage of stuff like digital photos, but don't
> try using it for long-term storage. Think of it like a floppy disc -- if
> you have any _important_ data, make sure it's backed up or copied onto
> at least three of them to avoid loss.

Well, this seems *way* more crappier than floppies. Floppies will not
fail within five minutes if you only start using them :-(.
Pavel
--
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?