rclone / rclone/rclone

Corruption with crypt backend when storing files on an SD Card (exFAT)

Open
#7,629 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug Remote: Crypt
Dominant language
Go
Stars
59.8k
Forks
5.4k
Avg merge
2d 14h
Merged PRs (30d)
48

Description

Hello

I am experimenting with using rclone crypt to securely store files on an external medium such as an SD card or USB flash drive, rather than using something like VeraCrypt.

I understand rclone is generally meant for cloud or remote storage providers and this works as intended just fine on the local disk.. with no issues.. however I have been experiencing intermittent but generally consistent "corruption" of the data that got written.. I can verify this by then unmounting, clearing vfs cache or switching to another machine and seeing decryption errors for files. I do not notice any errors at write time.

IO error: failed to authenticate decrypted block - bad password?

I don't experience this if I format the SD card as NTFS.

I have run h2testw on, and tested this with at least two different brand SD cards and adapters. My best guess is potentially an issue with using exFAT on the target?
There is no file corruption with the same reader+sd card if I do not use rclone (copy files as normal), and several H2testw runs on the card results no error reading back.

I also ensure that the files written by rclone are completely flushed to disk and use the Safely Eject Tool in Windows to ensure that this is not the cause.

I have also tried to perform the writes using rclone copy rather than mount and still experience the same corruption.
I have tried both Linux & Windows as the host and 1.65.2 & 1.65.1.
I have tested both the cards with h2testw and both return no errors.
If the remote is set to a local disk folder I experience no issues.

[local_crypt_ext]
type = crypt
remote = I:/Enc
password = <snip>
password2 = <snip>
filename_encryption = off
directory_name_encryption = false

where I:/ is an SD card formatted with exFAT.

Mounting with:

rclone mount local_crypt_ext:/ \\local\ext --vfs-cache-mode writes -v

I have also tried without the vfs-cache-mode flag and experience the same issue.

rclone v1.65.2
- os/version: Microsoft Windows 11 Education 22H2 (64 bit)
- os/kernel: 10.0.22621.3007 (x86_64)
- os/type: windows
- os/arch: amd64
- go/version: go1.21.6
- go/linking: static
- go/tags: cmount

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the corruption with rclone crypt against an exFAT SD card, using the provided rclone mount and copy commands and comparing with NTFS or a local disk. Trace the crypt write and local-backend paths involved in authentication failures; done means identifying and fixing the exFAT-specific corruption and verifying decrypted files after unmounting and remounting.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
operating-systems, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.