Like many people, I have a variety of FAT (VFAT, msdos, msdosfs) formatted media that occasionally gets attached to my FreeBSD server. In my case, the examples are SD cards from cameras and video recorders, and USB sticks that people have used on their laptop. And I do many things with those volumes: Backup or archive files from USB sticks, automatically scrape pictures from the camera and organize them into web pages, or convert the format of videos.
There are two cosmetic issues I have not solved yet.
The first one is file names coming from the media. On one hand, I'd like the default for short and single-case file names to be lower case, since img_1234.jpg looks better on a Unix machine than IMG_1234.JPG. Therefore, I like to mount these volumes with the shortnames option (or equivalently mount_msdosfs -s). For 8.3 names, that works great, but it does terribly things to long Win95 file names, which get completely garbled.
On the other hand, those long names exist, for example if a user creates what they consider a "sensible" file name (such as 20130206 Memo to Fred regarding shipping procedures.doc), which gets completely garbled. If I enable the longnames option or -l, those work great (and the mixed case the creator specified is even preserved), but then files with short names become all upper case. And I really don't like IMG_1234.JPG.
Is there any way to teach the msdos file system to do something better? For example: convert all file names to lowercase, whether short or long (there can't be any conflicts, since FAT file names are caseblind, so there is no way to have both Memo.doc and memo.doc in the same directory)? Or maybe a hybrid mode, where names that fit into 8.3 don't use the Win95 version, but long names do?
Could I accomplish this by creating a special code page in a file, and use the -W option to mount_msdosfs(8)? Or does a code page with all lowercase already exist?
Second question: As we know, files on Unix systems have their times stored in UT. But files on DOS/FAT file systems have them stored in local time. Which means that after mounting, all the times are wrong by 7 or 8 hours, depending on daylight savings time. This is not a big deal, except for pictures and videos coming from cameras, where file mtimes may have meaning (for example, to quickly find out whether this is the morning semifinal or the afternoon final of my son's rugby team, or when I find that my kid's birthday party seem to have taken place at 4AM, a little disturbing for middle school students). Obviously, there is no way to tell mount(8) (or the file system): "shift all times into this time zone", or "shift by this constant offset". Or is there?
There are two cosmetic issues I have not solved yet.
The first one is file names coming from the media. On one hand, I'd like the default for short and single-case file names to be lower case, since img_1234.jpg looks better on a Unix machine than IMG_1234.JPG. Therefore, I like to mount these volumes with the shortnames option (or equivalently mount_msdosfs -s). For 8.3 names, that works great, but it does terribly things to long Win95 file names, which get completely garbled.
On the other hand, those long names exist, for example if a user creates what they consider a "sensible" file name (such as 20130206 Memo to Fred regarding shipping procedures.doc), which gets completely garbled. If I enable the longnames option or -l, those work great (and the mixed case the creator specified is even preserved), but then files with short names become all upper case. And I really don't like IMG_1234.JPG.
Is there any way to teach the msdos file system to do something better? For example: convert all file names to lowercase, whether short or long (there can't be any conflicts, since FAT file names are caseblind, so there is no way to have both Memo.doc and memo.doc in the same directory)? Or maybe a hybrid mode, where names that fit into 8.3 don't use the Win95 version, but long names do?
Could I accomplish this by creating a special code page in a file, and use the -W option to mount_msdosfs(8)? Or does a code page with all lowercase already exist?
Second question: As we know, files on Unix systems have their times stored in UT. But files on DOS/FAT file systems have them stored in local time. Which means that after mounting, all the times are wrong by 7 or 8 hours, depending on daylight savings time. This is not a big deal, except for pictures and videos coming from cameras, where file mtimes may have meaning (for example, to quickly find out whether this is the morning semifinal or the afternoon final of my son's rugby team, or when I find that my kid's birthday party seem to have taken place at 4AM, a little disturbing for middle school students). Obviously, there is no way to tell mount(8) (or the file system): "shift all times into this time zone", or "shift by this constant offset". Or is there?