Solved [Solved] cp -a changes msdosfs files to lower case?

I have two mounted msdosfs file systems and am trying to copy everything from one to another by using the cp command:

Code:
 # ll /mnt/fdos
total 110
-rwxr-xr-x  1 root  wheel  64919 2008-03-25 23:33:20 command.com
-rwxr-xr-x  1 root  wheel  45267 2008-03-25 23:33:10 kernel.sys
Code:
# ll /mnt/bios/
total 186
drwxr-xr-x  1 root  wheel   2048 2012-11-22 08:48:54 $RECYCLE.BIN
-rwxr-xr-x  1 root  wheel     58 2013-02-05 10:05:06 AUTOEXEC.BAT
-rwxr-xr-x  1 root  wheel  54654 1993-12-30 23:00:00 COMMAND.COM
-rwxr-xr-x  1 root  wheel    123 2009-04-15 13:39:16 CONFIG.SYS
drwxr-xr-x  1 root  wheel   2048 2013-02-14 17:45:02 FLASH
-rwxr-xr-x  1 root  wheel  14160 1994-11-18 11:00:00 HIMEM.SYS
-r-xr-xr-x  1 root  wheel  40758 1993-12-30 23:00:00 IBMBIO.COM
-r-xr-xr-x  1 root  wheel  37174 1993-12-30 23:00:00 IBMDOS.COM
-rwxr-xr-x  1 root  wheel  12663 1999-04-23 22:22:00 RAMDRIVE.SYS
drwxr-xr-x  1 root  wheel   6144 2008-04-04 15:16:06 Recycled
Code:
# cp -a -n /mnt/bios/ /mnt/fdos/
Code:
# ll /mnt/fdos/
total 238
drwxr-xr-x  1 root  wheel   2048 2014-03-20 14:18:00 $recycle.bin
-rwxr-xr-x  1 root  wheel     58 2013-02-05 10:05:06 autoexec.bat
-rwxr-xr-x  1 root  wheel  64919 2008-03-25 23:33:20 command.com
-rwxr-xr-x  1 root  wheel    123 2009-04-15 13:39:16 config.sys
drwxr-xr-x  1 root  wheel   2048 2014-03-20 14:18:02 flash
-rwxr-xr-x  1 root  wheel  14160 1994-11-18 11:00:00 himem.sys
-r-xr-xr-x  1 root  wheel  40758 1993-12-30 23:00:00 ibmbio.com
-r-xr-xr-x  1 root  wheel  37174 1993-12-30 23:00:00 ibmdos.com
-rwxr-xr-x  1 root  wheel  45267 2008-03-25 23:33:10 kernel.sys
-rwxr-xr-x  1 root  wheel  12663 1999-04-23 22:22:00 ramdrive.sys
drwxr-xr-x  1 root  wheel   2048 2014-03-20 14:18:00 recycled
At this point, I'm not interested in changing the resulting lower case copies to upper case--I'd rather delete everything and start over, doing it correctly from the beginning. Why did the filenames get changed to lower case? And what other options would be recommended? Tar? emulators/mtools? Putting this stuff in emulators/qemu and using DOS copy commands?
 
Re: cp -a changes msdosfs files to lower case?

mount_msdosfs(8) appears to try to do the right thing based on what files it sees:

Code:
     -s      Force behaviour to ignore and not generate Win'95 long filenames.

     -l      Force listing and generation of Win'95 long filenames and sepa-
             rate creation/modification/access dates.

             If neither -s nor -l are given, mount_msdosfs searches the root
             directory of the file system to be mounted for any existing
             Win'95 long filenames.  If no such entries are found, but short
             DOS filenames are found, -s is the default.  Otherwise -l is
             assumed.

So maybe adding -l will force it to use long filenames which will have the correct case.
 
Re: cp -a changes msdosfs files to lower case?

OK, I explored those options. Turns out that there was a long filename that was causing the -l option to be activated. I remounted with the -s option and, to my surprise, all the files were in lowercase. So the fault was not with the cpcommand--it's just that it was truncating and copying the short filenames.

Now I've tried mounting the copied results again but this time with the -l option, and uppercase has returned! I'm not actually following through with upgrading my BIOS, but the DOS-bootable USB flash drive I've made appears as if it would work for that purpose. Mission accomplished.
 
Back
Top