0

I have a DAP (like an mp3 player) and I am trying to sync up the contents of one of the folders on my pc to the DAP. This does work almost as intended, but something weird is happening to the filenames. I am syncing with rsync, however it also happens using a simple cp 'DR Pigekor - I østen stiger solen op.mp3' /mounted/device.

On the other device it shows up as 'DR Pigekor - I østen stiger solen op.mp3'. I have also checked on my other pc that runs manjaro, and it shows the same weird title, or something very similar, so it is not just the DAP. All files look completely fine on my nixOS machine that I copied them from, both on the mounted drive and the original location. It should also be noted that copying files from the manjaro machine to the DAP works fine.

My system locale should be en_US.UTF-8, on both machines, by the way.

How do I preserve the filenames while copying?

2
  • Can you tell what kind of file-system is used on the device? I assume it might be FAT32 which does not really handle UTF-8 filenames. You would need to specify the "codepage" (encoding) when mounting.
    – Hermann
    Dec 1, 2020 at 20:22
  • It should be ext2, I ran fsck -N /dev/mmcblk0p1 to check, and it outputted this: [/run/current-system/sw/bin/fsck.ext2 (1) -- /dev/mmcblk0p1] fsck.ext2 /dev/mmcblk0p1 Dec 1, 2020 at 21:17

1 Answer 1

0

I was wrong about the file format. I ran this command # fsck -N /dev/mmcblk0p1 to check the format, and it outputted this:

[/run/current-system/sw/bin/fsck.ext2 (1) -- /dev/mmcblk0p1] fsck.ext2 /dev/mmcblk0p1

Later I found out that this wasn't true, and that the actual filesystem was vfat as Hermann had suggested. Mounting with this command fixed the issue:

# mount -t vfat /dev/mmcblk0p1 /path/to/mnt -o shortname=mixed -o utf8

The “shortname=mixed” keeps the case preserved, as otherwise vfat will convert any filename that’s 8 characters or less to lower case (default behavior is “shortname=lowercase”) and cause problems for rsync. UTF8 is what Windows uses when mounting filesystems, so we specify that to ensure that we’re mounting it the same way (default is to mount iso-8859-1, even though the underlying vfat filesystem will store filenames in UTF8 format).

I found the command on this site: https://www.clug.org/rsync-to-fat32-drives/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .