Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm mounting a FAT32 drive on my NAS (which has a USB port), and hitting a strange issue when I use the ls command on the drive root:

ls: cannot access ???²é?u.g: Input/output error
ls: cannot access ?f$?â?.k: Input/output errorPuTTY
ls: cannot access ?21ï??é.ìk?: Input/output error
ls: cannot access ºq`{??ùê.?zï: Input/output error
ls: cannot access +?l`æ~2?.]9: Input/output error
ls: cannot access ??j.é: Input/output error
ls: cannot access ëégö²?è.?« Input/output error
?.¢??: Input/output error
ls: cannot access ??d?¬«ëc.?½f: Input/output error
ls: cannot access ?r??%f.o??: Input/output error
ls: cannot access b}?çb¼=u.?c·: Input/output error
}??..÷p½: Input/output error
ls: cannot access u?;e?j?.

I'm not sure why "PuTTy" is thrown in there on the second line. It is the client I'm using to access the NAS, and I'm running the latest version, but I don't understand what it has to do with the ls command. It goes on like this for a while and then starts listing files that aren't really there along with the files that are:

�?=?^Oaa�.h?=
?*ab^G^S??.?^[?
a?cw??^?*.=?$
�??a�h��.?�?
??a�?^_j!.?i?
�?a?m??^U.a^G^?
apps
??^Q??a?y.�?z

I'm running Debian/Lenny (now), but I had the same problem before I switched to Debian on my NAS. I'm not sure which distro I was running before, I think it was a custom build.

When I plug the drive in, sdc and sdc1 appear in the /dev directory. I'm unable to mount sdc, but can successfully mount sdc1. These are the command I've tried using to mount:

mount /dev/sdc1 /USB
mount -t vfat /dev/sdc1 /USB
mount -o umask=0 -t vfat /dev/sdc1 /USB

# Additional
mount -t vfat -o codepage=850 /dev/sdc1 /USB
mount -t msdos -o codepage=850 /dev/sdc1 /USB
mount -t vfat -o codepage=869 /dev/sdc1 /USB
mount -t vfat -o codepage=850,iocharset=iso8859-7 /dev/sdc1 /USB
# ... and combinations of codepage 850, 869, 437 (the common ones)
# ... and combinations of utf8, iso8859-7, iso8859-1
# ... and additional flags such as umask=0, rw

If I check the logs after the ls command, this is the result:

$ dmesg | tail
FAT: Filesystem panic (dev sdc1)
    invalid access to FAT (entry 0x8c31db6e)
FAT: Filesystem panic (dev sdc1)
    invalid access to FAT (entry 0xee786bb9)
FAT: Filesystem panic (dev sdc1)
    invalid access to FAT (entry 0x2f16a272)
FAT: Filesystem panic (dev sdc1)
    invalid access to FAT (entry 0xa8ee938e)
FAT: Filesystem panic (dev sdc1)
    invalid access to FAT (entry 0x6df5a84f)

I'll be honest, my Linux knowledge isn't that great — it's limited mostly to basic administrative tasks. Of course, if I plug the drive into Windows (7) it works fine.

One final note perhaps worth mentioning is that I remember having to use a special tool to format the drive because it was too large for Windows to format it.

EDIT

On closer inspection of the drive, all files appear to be present - so where is linux getting all this garbage from? There are only several files and folders in the root directory on Windows. Could it be data that has not been properly disposed of?

EDIT 2

The same problem in Ubuntu on my Laptop PC. Both ls and the file explorer show these strange file listings.

share|improve this question
1  
Figured out that PuTTy from the second line is due to the answerback from ^E setting. –  Andy E Apr 1 '11 at 10:54
    
What happens if you try it on a different linux machine? Same results? –  Faheem Mitha Apr 1 '11 at 16:30
2  
There is something on the filesystem that appears to the Linux driver to be directory entries, but that is clearly not. Either your filesystem is slightly hosed but in a way that the Windows driver tolerates, or the Linux driver is buggy. –  Gilles Apr 1 '11 at 20:43
    
I had this happen too, unmounting the drive was a bit strange, then plugged it into windows and saw this filename madness. unable to delete on windows and linux. was working/mounting fine previously. –  CrackerJack9 Aug 30 '11 at 22:22
add comment

3 Answers

That looks like a codepage issue. Look in the man page for mount - in the fat sections, there is a codepage= setting you can use.

Also look at the iocharset= setting. (And search the web for both.)

share|improve this answer
    
Thanks, I tried various combinations of these and checked the codepage on my Windows machine (850) with no luck. I've also checked the man pages but not found anything else that helped. –  Andy E Apr 1 '11 at 13:25
    
please update your question with the exact commands you tried and what their result was. –  Mat Apr 1 '11 at 13:30
    
I've updated with as much extra information as I could, the result was exactly the same for each command, except when I set msdos as the filesystem short filenames were displayed (as expected). –  Andy E Apr 1 '11 at 13:42
    
I have mounted my drive the same way I always have (linux and windows). seems to be with corruption, not character set. the files are very large, 1.8 GB where a java class file (50k tops) used to be –  CrackerJack9 Aug 30 '11 at 22:23
add comment

My guess is either the filesystem is corrupted or may be the data is encrypted/compressed.

share|improve this answer
add comment

On a Windows machine, run chkdsk /f /r - this worked for me. You can probably run fsck as root if you don't have access to a Windows machine. I lost all directories which contained the strange files.

share|improve this answer
    
That didn't work for me, in the end the only thing I could do was backup, format and restore. –  Andy E Sep 1 '11 at 9:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.