OESF Portables Forum

Everything Else => Desktop Operating Systems Issues => Zaurus General Forums => Archived Forums => Linux Issues => Topic started by: orthogonal on May 04, 2004, 03:09:42 am

Title: Cross-linked vfat file system on SD card!
Post by: orthogonal on May 04, 2004, 03:09:42 am
In making a recording, I managed to completely fill up my SD card. This apparently caused a cross-linking of directories on the SD card.

Specifically, the top level directory on the SD card (mounted as /mnt/card) contains directories Documents/ and opt/.

Documents/images/png-sketch recursively \"contains\" the top level directory, but the file system thinks that png-sketch is a real directory, not a symlimk.

Attempting an rm -rf /mnt/card/Documents/images/png-sketch results in an infinite loop as rm recurses over Documents/images/png-sketch.

Attempting to reformat the card with mkfs.vfat (or mkfs.msdos or mkdosfs) -- nkfs.vfat /dev/mmcda1 errors out with
\"mkfs.fat: /dev/mmcda1: contains a mounted file system.\", whether or not the sd card is mounted.

How can I fix or reformat the sd card\'s file system?

Second, what file system will give me the most space for large (mp3) files?

Thanks.
Title: Cross-linked vfat file system on SD card!
Post by: tumnus on May 04, 2004, 04:29:26 am
You can\'t get symlinks on a FAT filesystem. It doesn\'t support it. Either the FAT table is corrupted or your card is ext2 formatted.

If your card is ext2 formatted, this should work: \'rm /mnt/card/Documents/images/png-sketch\' ?

To reformat your card, you need to unmount it first. There is a howto here: http://www.zaurususergroup.com/modules.php...0And%20CF%20FAQ (http://www.zaurususergroup.com/modules.php?op=modload&name=phpWiki&file=index&pagename=SD%20And%20CF%20FAQ)
Title: Cross-linked vfat file system on SD card!
Post by: orthogonal on May 04, 2004, 09:25:06 am
Tumnus, thanks for your prompt response.

I know I can\'t do symlinks on a FAT fs; I mentioned this just to forestall advice about it probably being a symlink.

I have attempted to run mkfs after unmounting the card; however, even with the card unmounted, I get the error given above: \"\"mkfs.fat: /dev/mmcda1: contains a mounted file system.\"

The only thing I can think of is a low level driver that would allow me to mark the png-sketch directory as deleted, but since I don\'t have a card-reader, my access to the card is exclusively via the Zaurus, and thus I\'m limited to the utilities on the Zaurus. Any advice would be appreciated.
Title: Cross-linked vfat file system on SD card!
Post by: tumnus on May 04, 2004, 09:32:11 am
You must not have unmounted the card correctly. Make sure you are using the exact commands given in the howto I pointed out above.
Title: Cross-linked vfat file system on SD card!
Post by: orthogonal on May 04, 2004, 09:51:16 am
If only that were so. This is a verbatim copy of my ssh session:

# umount /dev/mmcda1
# mkfs.msdos /dev/mmcda1
mkfs.msdos 2.8 (28 Feb 2001)
mkfs.msdos: /dev/mmcda1 contains a mounted file system.

After these command, mount gives this:
# mount
/dev/root on / type jffs2 (ro)
/proc on /proc type proc (rw)
/dev/ram1 on /dev type minix (rw)
/dev/mtdblock3 on /home type jffs2 (rw,noatime)
none on /dev/shm type tmpfs (rw)
none on /dev/pts type devpts (rw)
//Diffy2/music on /home/system/var/mnt/smb/m type smbfs (rw,file_mode=0755,dir_mode=0755)
//Diffy2/linuxdata on /home/system/var/mnt/smb/l type smbfs (rw,file_mode=0755,dir_mode=07
//Diffy2/docs on /home/system/var/mnt/smb/i type smbfs (rw,file_mode=0755,dir_mode=0755)


My only guess is that mkfs sees the cross-linked directory as a mounted file system. Here\'s a listing of /mnt/card

# mount /dev/mmcda1 /mnt/card
# cd /mnt/card/
# ls -l
drwxr-xr-x    4 root     root        16384 May  3 08:54 Documents
drwxr-xr-x    3 root     root        16384 Apr 11 17:45 opt
# cd Documents/
# ls -l
drwxr-xr-x    2 root     root        16384 May  3 08:54 Install_Files
drwxr-xr-x    3 root     root        16384 Jan 13 23:26 image
# cd Install_Files/
# ls -l
# cd ../image/
# ls -l
drwxr-xr-x    0 root     root            0 May  4  2004 png-sketch
# cd png-sketch/
# ls -l
drwxr-xr-x    4 root     root        16384 May  3 08:54 Documents
drwxr-xr-x    3 root     root        16384 Apr 11 17:45 opt
# pwd
/mnt/card/Documents/image/png-sketch
# cd Documents/
# ls -l
drwxr-xr-x    2 root     root        16384 May  3 08:54 Install_Files
drwxr-xr-x    3 root     root        16384 Jan 13 23:26 image
# cd image/
# ls -l
drwxr-xr-x    0 root     root            0 May  4  2004 png-sketch
# cd png-sketch/
# ls -l
drwxr-xr-x    4 root     root        16384 May  3 08:54 Documents
drwxr-xr-x    3 root     root        16384 Apr 11 17:45 opt
# pwd
/mnt/card/Documents/image/png-sketch/Documents/image/png-sketch
Title: Cross-linked vfat file system on SD card!
Post by: orthogonal on May 04, 2004, 12:35:33 pm
Okay, I got this fixed.

I\'m leaving these notes in hop that this will help someone else with a similar problem.

Previously, I\'d attempted to drop the cross-linked directory with
fsck -l /Documents /dev/mmcda1

This didn\'t work.

Using the DOS short name (DOCUME~1) did work.

I found the short name with
fsck.vfat -l /dev/mmcda1

Using that, fsck asked me if I wanted to delete the LFN (long file name, presumably); but answering \"yes\" to this failed to produce changes until I used the -w \"write immediately\" flag -- which also required the -a or -r flags. -a \"fix automatically\" didn\'t work, but -r \"interactively repair\" did.

By the time I\'d gotten to this point, I\'d managed to delete the long file name, but not the short file name for /Documents, and to turn that directory into a \"recovered\" file, so the transcript of the final fsck is:

# fsck.msdos -r -w -v -d /fsck0001.rec /dev/mmcda1
dosfsck 2.8 (28 Feb 2001)
dosfsck 2.8, 28 Feb 2001, FAT32, LFN
Boot sector contents:
System ID \"MSDOS5.0\"
Media byte 0xf8 (hard disk)
       512 bytes per logical sector
     16384 bytes per cluster
         1 reserved sector
First FAT starts at byte 512 (sector 1)
         2 FATs, 16 bit entries
     61952 bytes per FAT (= 121 sectors)
Root directory starts at byte 124416 (sector 243)
       512 root directory entries
Data area starts at byte 140800 (sector 275)
     30948 data clusters (507052032 bytes)
63 sectors/track, 16 heads
       237 hidden sectors
    990627 sectors total
Dropping FSCK0001.REC
Wrong checksum for long file name \"Documents\".
  (Short name FSCK0000.REC may have changed without updating the long name)
1: Delete LFN
2: Leave it as it is.
3: Fix checksum (attaches to short name FSCK0000.REC)
? 1
Checking for unused clusters.
Reclaimed 1 unused cluster (16384 bytes).
Perform changes ? (y/n) y
/dev/mmcda1: 2 files, 2/30948 clusters