LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 09-07-2004, 04:55 AM   #1
K@rl`
Member
 
Registered: Feb 2004
Posts: 70

Rep: Reputation: 15
Question 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.
 
Old 09-07-2004, 05:15 AM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,990

Rep: Reputation: 67
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
 
Old 09-07-2004, 05:15 AM   #3
Quis
Member
 
Registered: May 2001
Location: Germany, Süd-Baden
Distribution: Gentoo
Posts: 139

Rep: Reputation: 15
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.
 
Old 09-07-2004, 06:21 AM   #4
Electro
Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
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).
 
Old 09-07-2004, 08:05 AM   #5
K@rl`
Member
 
Registered: Feb 2004
Posts: 70

Original Poster
Rep: Reputation: 15
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 !
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Low-level format under Linux with an AHA-1522 rcase5 Linux - Hardware 2 04-12-2005 02:33 PM
Format Compact flash surff Linux - Hardware 1 09-13-2004 07:41 AM
How do I low-level format a SCSI drive on Aurora Sparc Linux v1.0? JustinCase Linux - Hardware 3 03-02-2004 11:22 PM
Windows partition has bad sectors. Will 'dd' work in place of low level format? gkneller Linux - Software 5 02-26-2004 11:35 PM
Perform low level format of a floppy disk in C juby Programming 4 01-09-2003 07:47 PM


All times are GMT -5. The time now is 05:36 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration