LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Low Level format a Compact Flash ? (https://www.linuxquestions.org/questions/linux-hardware-18/low-level-format-a-compact-flash-227620/)

K@rl` 09-07-2004 04:55 AM

Low Level format a Compact Flash ?
 
Hi All,

My we have a Compact Flash that is damaged. The camera it was in went a bit strange and has currupted the file system.

I have tried to format it using mkfs;

mkfs -t msdos -c -v /dev/sda

It formats and says there is a problem with the blocks which we expected.

Is there anyway I can do a low level format on the thing ?

I've seen this on Google;

dd if=/dev/zero of=/dev/sda

Would that help ?

Any recommendations would be great.

Many thanks,

Karl.

rjlee 09-07-2004 05:15 AM

Using dd won't help; it will just try to write zeros over the bad blocks. A bad block on a flash chip is not a good sign; it normally means that part of the chip has become damaged (which could be caused by exposure to radiation or a manufacturing defect like a faulty seal on the chip letting a speck of dust in). It shouldn't be possible to corrupt the filesystem just by the camera acting strange; it's more likely that the filesystem corruption confused the camera.

Unless I'm wrong (which is possible), this looks to me like a manufacturing defect. If it's under warranty, I'd try and take it back.

You could run fsck.vfat on the file system to mark the bad blocks after formatting. Repartitioning with -c as you have done should also do the trick. You will lose the storage space with the bad blocks but whatever space is left should be okay.

You can't do a low-level format of a flash chip in the same way as a magnetic hard disk; there aren't any magnetic domains that can be recreated to try and work around the problem. Instead, each storage bit consists of a small electronic circuit built into the semiconductor; you may be able to do something in a clean-room using scanning tunneling microscopes, laser trimming and possibly plasma deposition through carefully-constructed masks but it would be much cheaper just to buy a new one.

Hope that helps,

—Robert J. Lee

Quis 09-07-2004 05:15 AM

you can try the DiskDump command like you have posted.
It will write down zero's to /dev/sda and is compareable to a low-level format.
this might help if your filesystem is damaged, but if you have a hardware-problem it wouldn't be fixed with DD.

Electro 09-07-2004 06:21 AM

You will have to remake the partition table. If fdisk or cfdisk gives you problems. You will have to do "dd if=/dev/zero of=/dev/sda bs=512 count=1". Then run fdisk or cfdisk again. You can format with the option to scan for badblocks.

Unfortunately, flash mediums has limited writes, so this problem will occur over time the more you write to it. FAT writes multiple times to create a file or directory. The only solid state medium that has unlimited writes and that does not erase its data when power is removed is FRAM. I wish FRAM has high storage capacity because it can be written to it unlimited times, it is almost as fast as DRAM, and it is low power (about 1/100th of an amp).

K@rl` 09-07-2004 08:05 AM

Thanks for your great replies,

My Dad has ordered a new one for £41, but I'll mess about with the card and try some of the ideas.

Once again, many thanks !


All times are GMT -5. The time now is 10:30 AM.