I had a CF card scare the other day. I needed to send copies of some files on my old 128MB CF card to a friend. But my CF modem was plugged in to the CF slot on my Zaurus. So, I tapped on the "Eject card" icon in the taskbar, waited until the networking and CF card icons disappeared, and then removed my modem. Then I inserted my 128MB CF card and waited for the CF card icon to appear. And waited. And nothing happened, no icon appeared.
For my ROM 2.38 Zaurus, it is routine for all my controls and the screen to freeze up for a little while after I insert any CF or SD card, during which time the card is mounted by the system. However, in this instance, the screen and controls did not freeze up. No icon, and no frozen screen. I knew something was wrong.
Has the card gone bad? I consulted my webpage about checking card integrity. I wondered if there were any files on that card that had never been backed up anywhere as I started running diagnostic tests. Here is my log:
"cardctl status" shows I have no CF card inserted. Then I insert the card and it shows up in Socket 0 but no icon appears and no file system shows in mount:
bash-2.05# cardctl status
Socket 0:
no card
Socket 1:
no card
bash-2.05# cardctl status
Socket 0:
3.3V 16-bit PC Card
function 0: [ready]
Socket 1:
no card
bash-2.05#
Then I check to see if the file system is recognized with "mount" and there is no entry for a CF card on /dev/hda1:
bash-2.05# mount
/dev/mtdblock0 on / type cramfs (ro)
/proc on /proc type proc (rw)
/dev/ram1 on /dev type minix (rw)
/dev/mtdblock1 on /home type ext2 (rw,sync)
none on /dev/pts type devpts (rw)
/dev/mmcda1 on /usr/mnt.rom/card type vfat (rw)
bash-2.05#
But my card is recognized in the following:
bash-2.05# cardctl ident
Socket 0:
product info: " LEXAR ATA FLASH CARD ", "TWISTER", "TTE01"
manfid: 0x4e01, 0x0200
function: 4 (fixed disk)
Socket 1:
no product info available
bash-2.05#
But I am unable to "umount" it!
bash-2.05# umount /usr/mnt.rom/cf
umount: /usr/mnt.rom/cf: Invalid argument
bash-2.05# umount /mnt/cf
umount: /mnt/cf: Invalid argument
bash-2.05# umount /dev/hda
umount: /dev/hda: Invalid argument
bash-2.05# umount /dev/hda1
umount: /dev/hda1: Invalid argument
bash-2.05#
And fsck.vfat does not recognize it!
bash-2.05# fsck.vfat /dev/hda1
dosfsck 2.8, 28 Feb 2001, FAT32, LFN
open /dev/hda1:No such device or address
bash-2.05#
So, since I can't run fsck...file system not recognized, so try badblocks:
bash-2.05# badblocks /mnt/cf
badblocks: bad blocks range: 0-0
bash-2.05#
bash-2.05# badblocks /dev/hda
badblocks: No such device or address while trying to determine device size
bash-2.05#
Then I tried fdisk, and the results were not good:
bash-2.05# Programs/fdisk -l /dev/hda
bash-2.05#
bash-2.05# Programs/fdisk /dev/hda
Unable to open /dev/hda
bash-2.05#
Card indeed is still showing in cardctl:
bash-2.05# cardctl status
Socket 0:
3.3V 16-bit PC Card
function 0: [ready]
Socket 1:
no card
bash-2.05#
But dd does not recognize it either:
bash-2.05# dd if=/dev/hda count=1 bs=512 | more
dd: /dev/hda: No such device or address
bash-2.05#
So rebooted to see if that would make any difference. First I ejected my SD card as I know there are a lot of files on the CF card and I did not want to have trouble with my Z booting. Then I rebooted, closing all open applications first before tapping "Reboot" in the "System Shutdown" tab in the "Tools" menu.
And now, after rebooting with the CF card still inserted, df shows the card and the CF card icon shows in my taskbar:
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/ram1 44 25 19 57% /dev
/dev/mtdblock1 32619 32354 0 100% /home
/dev/hda1 125544 125540 4 100% /usr/mnt.rom/cf
Note the card is very full, and that may be a good part of why it would not load, I am not sure. My problem also might have been the result of accidentally removing the card without first tapping on "Card eject" a month ago. Anyhow, the "mount" command now shows a vfat file system on /dev//hda1:
bash-2.05# mount
/dev/mtdblock0 on / type cramfs (ro)
/proc on /proc type proc (rw)
/dev/ram1 on /dev type minix (rw)
/dev/mtdblock1 on /home type ext2 (rw,sync)
none on /dev/pts type devpts (rw)
/dev/hda1 on /usr/mnt.rom/cf type vfat (rw)
/dev/mmcda1 on /usr/mnt.rom/card type ext2 (rw)
bash-2.05#
I reinserted my SD card before running the above "mount" command. Then I did some work with some files on my CF card, erasing a few, and then got back to testing the card. And, now "umount" works just fine, enabling me to run fdisk and fsck.vfat:
bash-2.05# umount
bash-2.05# programs/fdisk -l /dev/hda
Disk /dev/hda: 8 heads, 32 sectors, 984 cylinders
Units = cylinders of 256 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 983 125808 6 FAT16
bash-2.05#
bash-2.05# fsck.vfat /dev/hda1
dosfsck 2.8, 28 Feb 2001, FAT32, LFN
Reclaimed 1 unused cluster (2048 bytes).
Leaving file system unchanged.
/dev/hda1: 2609 files, 62576/62772 clusters
bash-2.05#
fsck.vfat on my Collie was inconclusive, not telling me whether the file system was "clean". So, then I ran fsck.vfat with arguments:
bash-2.05# fsck.vfat -f -a -t -v /dev/hda1
dosfsck 2.8 (28 Feb 2001)
dosfsck 2.8, 28 Feb 2001, FAT32, LFN
Boot sector contents:
System ID "MSWIN4.1"
Media byte 0xf8 (hard disk)
512 bytes per logical sector
2048 bytes per cluster
1 reserved sector
First FAT starts at byte 512 (sector 1)
2 FATs, 16 bit entries
125952 bytes per FAT (= 246 sectors)
Root directory starts at byte 252416 (sector 493)
512 root directory entries
Data area starts at byte 268800 (sector 525)
62772 data clusters (128557056 bytes)
32 sectors/track, 8 heads
32 hidden sectors
251616 sectors total
Checking for bad clusters.
Reclaiming unconnected clusters.
Reclaimed 1 unused cluster (2048 bytes) in 1 chain.
Performing changes.
/dev/hda1: 2610 files, 62577/62772 clusters
bash-2.05#
Ran it immediately again to see if it really made the changes it claimed to make, and the output was different:
bash-2.05# fsck.vfat -f -a -t -v /dev/hda1
dosfsck 2.8 (28 Feb 2001)
dosfsck 2.8, 28 Feb 2001, FAT32, LFN
Boot sector contents:
System ID "MSWIN4.1"
Media byte 0xf8 (hard disk)
512 bytes per logical sector
2048 bytes per cluster
1 reserved sector
First FAT starts at byte 512 (sector 1)
2 FATs, 16 bit entries
125952 bytes per FAT (= 246 sectors)
Root directory starts at byte 252416 (sector 493)
512 root directory entries
Data area starts at byte 268800 (sector 525)
62772 data clusters (128557056 bytes)
32 sectors/track, 8 heads
32 hidden sectors
251616 sectors total
Checking for bad clusters.
Reclaiming unconnected clusters.
/dev/hda1: 2610 files, 62577/62772 clusters
bash-2.05#
So, I know I need to erase some more files from the card. But my card is fine, and maybe the reason it wasn't recognized when I tried to insert it was that cluster that fsck fixed. So, I'll try ejecting and mounting it again.
bash-2.05# cardctl eject
bash-2.05#
Icon disappeared. Good. Now take card out and re-insert it. And, it worked! The icon appears without having to reboot!
Success! My card is good...but I never would have known if I didn't try rebooting before running the commands again.