Bug 276876 - [fusefs] sysutils/fusefs-exfat FUSE protocol violation (direct_io) and illegal UTF-8 sequence
Summary: [fusefs] sysutils/fusefs-exfat FUSE protocol violation (direct_io) and illega...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Oleksii Samorukov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-07 21:45 UTC by jakub_lach
Modified: 2024-02-08 13:27 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (samm)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jakub_lach 2024-02-07 21:45:14 UTC
I have installed sysutils/exfat-utils and sysutils/fusefs-exfat, attempting to backup MBR fat32 (/mnt/) card to larger one (exFAT GPT /media/ to future proof it).

I have used following procedure -

# sudo gpart destroy -F /dev/da0
# sudo gpart create -s gpt /dev/da0
# sudo gpart add -t ms-basic-data -b 1m -a 1m da0
# sudo mkexfatfs /dev/da0p1

# kldload fusefs
# sudo mount.exfat /dev/da0p1 /media/
# sudo mount_msdosfs /dev/da1s1 /mnt/

# sudo cp -r -p /mnt/ /media

After approximately 30GB and 1h, the following message appeared -

Feb  7 18:50:54 Thinkpad kernel: WARNING: FUSE protocol violation for server mounted at /media: cache incoherent!  To prevent data corruption, disable the data cache by mounting with -o direct_io, or as directed otherwise by your FUSE server's documentation.  This warning will not be repeated.

I presume it may be mitigated by -

# sudo mount.exfat -o direct_io /dev/da0p1 /media/

That was first letdown though, as the default "should work". 

Another thing that surprised me was that writing to /media/ was allowed without sudo. It appears it is a generic property with fuse, as it was the case also with NTFS (using mkntfs -vf).

Unfortunately, about 3/4 in the following appeared -

Feb  7 20:14:17 Thinkpad mount.exfat[43704]: illegal UTF-8 sequence
Feb  7 20:14:17 Thinkpad syslogd: last message repeated 1 times
Feb  7 20:16:10 Thinkpad syslogd: last message repeated 6 times
Feb  7 20:17:46 Thinkpad syslogd: last message repeated 18 times

This I find the most strange, as the files which were copied resided at /mnt/ where fat32 MBR was mounted. cp printed the problematic files, which sure enough contained some ΓΌ or similar. But somehow fat32 didn't have problem with them?

After the cp exited, I've ran the following at /mnt/ at /media/ -

# find . -type f | sort > ~/list

It appeared the files with problematic names were missing. Moreover, the overall size of /mnt/ and /media/ (reported by du) is different (not so sure if this is a matter of corruption or just missing files). 

The second error would explain the difference (but is quite unexplainable as /mnt/ was fat32), but the first one, speaking of corruption - is the most worrying. 

Overall I'm not confident that exFAT can be confidently used for backup. I have previously successfully tested the same procedure for fat32 GPT backup (same hardware)
Comment 1 jakub_lach 2024-02-08 00:19:18 UTC
FWIW, copying fat32 MBR to exFAT GPT was markedly slower on the same hardware comparing to fat32 MBR to fat32 GPT (about x1.5 or more?). Read appeared to be pegged to the (slower) value of writing.
Comment 2 jakub_lach 2024-02-08 13:27:54 UTC
I've read about caching errors with FUSE due to libublio, FWIW -

$ pkg info -r libublio
libublio-20070103_3:
        exfat-utils-1.4.0
        fusefs-exfat-1.4.0
        fusefs-ntfs-2022.10.3_1