Re: Problems with Ext2fs on a CF card.



On 20 May 2007 06:59:55 -0700 Mic <michaelzwrk@xxxxxxxxx> wrote:

| I use a Compact Flash card (SanDisk) to hold an ext2 Linux File System
| on an embedded system, running 2.6 Linux.
| The CF is connected in true IDE mode.
| I have numerous problems running a File System from the CF: mkfs does
| not work on partitions, fsck reports errors after booting from the CF
| etc. and the FS gets corrupted over time.
| Below is the procedure I follow to put the FS on the CF.
| Please advise if you recognize any faults in the procedure or have any
| idea what else I can check - any help is most welcome.
|
| Here is what I do:
| ------------------------
| Boot over NFS
| mkfs.ext2 /dev/hda
| mount -t ext2 /dev/hda /mnt/hda/
| cd /mnt/hda
| tar -xvjf /my_file_system.tar.bz2
| Boot over CF.
|
| Notes and Problems I see:
| ------------------------
| 1. cannot mkfs partition
| if I use fdisk to create partitions (i.e. hda1, hda2), mkfs fails.

This issue should be addressed. CF looks like IDE, so this should
appear to the userspace as a device name for an IDE device. The
kernel shouldn't even see a difference other than soem manufacturer
ID info and a small size.


| That's why I run it straight on /dev/hda.

Which should also work.


| fdisk:
| Disk /dev/hda: 512 MB, 512483328 bytes
| 16 heads, 63 sectors/track, 993 cylinders
| Units = cylinders of 1008 * 512 = 516096 bytes
|
| Device Boot Start End Blocks Id System
| /dev/hda1 1 497 250456+ 83 Linux
| /dev/hda2 498 993 249984 83 Linux
|
| mkfs.ext2 /dev/hda1
| mke2fs 1.38 (30-Jun-2005)
| mkfs.ext2: No such file or directory while trying to determine
| filesystem size

Have you rebooted since fdisk stored the partition table? There is an
ioctl() to update the kernel's idea of what partitions are present,
but there are times when that can fail.


| 2. fsck complains right after untar
| fsck -t ext2 /dev/hda
| fsck 1.38 (30-Jun-2005)
| e2fsck 1.38 (30-Jun-2005)
| /dev/hda was not cleanly unmounted, check forced.

Something else must be writing on there.

|
| 3. After booting from CF, and rebooting over NFS to run fsck:
| 3. After reboot from CF, another reset:
| fsck -t ext2 /dev/hda
| fsck 1.38 (30-Jun-2005)
| e2fsck 1.38 (30-Jun-2005)
| /dev/hda was not cleanly unmounted, check forced.
| Pass 1: Checking inodes, blocks, and sizes
| Inode 85069, i_blocks is 16, should be 2. Fix<y>? yes
| Free blocks count wrong for group #23 (768, counted=769).
| Fix<y>? yes...
|
|
| Thanks for your help,

Try wiping the whole CF clean to zero, then partition it with fdisk, save
the partition table, verify it is saved with "fdisk -l /dev/hda", and
reboot (with NFS, still) again. Now verify again with "fdisk -l /dev/hda"
and with "dmesg | grep hda". At this point "mkfs.ext2 /dev/hda1" should
work. Or maybe try "mke2fs /dev/hda1". If they fail still, add the -F
option (and be careful you are really typing right). Verify that your
node is created correctly, too:

root@varuna:/root 1# ls -ld /dev/hda
brw-rw---- 1 root disk 3, 0 2002-06-09 14:27 /dev/hda
root@varuna:/root 2#

If you don't see 3 and 0 in there, something is wrong with the node.

--
|---------------------------------------/----------------------------------|
| Phil Howard KA9WGN (ka9wgn.ham.org) / Do not send to the address below |
| first name lower case at ipal.net / spamtrap-2007-05-21-1953@xxxxxxxx |
|------------------------------------/-------------------------------------|
.



Relevant Pages

  • Re: Writing File System Driver & Creating Virtual Disk Drive in Windows XP [Question by a Novice
    ... strange partition it should be safe, but having a backup of it would be a ... virtual disk, but this is quite dodgy - if you make a mistake here (and ... He needs a file system. ... ***How to show partitions in windows explorer? ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Problems with fsck
    ... >> We are observing the exact same strange behavior on all our boxes. ... There is nowhere in the fsck manual any mention that running fsck -n on ... dangerous to run fsck without -n on a mounted file system, ... the two other partitions, but not on the root partition. ...
    (comp.os.linux.setup)
  • Re: Some Contents Unreadable" error.Is my Hard drive corrupted?
    ... On Sun, 2005-02-20 at 23:21, Rajev Mhasawade wrote: ... > partition) it first calculates used space and then this comment below ... Sounds like you are forcing an fsck on a mounted file system. ...
    (Fedora)
  • (no subject)
    ... FAT32 XP partition is OK and I can boot XP, ... Cannot find file system superblock ... /dev/ad0s2e: CAN'T CHECK FILE SYSTEM. ... GEOM: new disk ad0 ...
    (freebsd-current)
  • fsck: CANNOT SEEK BLK: -1 (after changing the mainboard)
    ... FAT32 XP partition is OK and I can boot XP, ... Cannot find file system superblock ... /dev/ad0s2e: CAN'T CHECK FILE SYSTEM. ... GEOM: new disk ad0 ...
    (freebsd-current)