cryfs icon indicating copy to clipboard operation
cryfs copied to clipboard

cryfs on top of rclone will destroy your data

Open nathanshearer opened this issue 4 years ago • 3 comments

I wanted to look at cryfs as a way to encrypt data stored in an rclone mount. I almost immediately had unrecoverable data corruption.

I created 4 random files, 10MB each on a 4MB block cryfs filesystem, on top of an rclone mount. The rclone mount is configured to allow random offset reads and writes with transparent caching enabled. The cryfs layer reports "Exception thrown: Error reading from file" and has some missing features that I think should be added:

  • Which file cannot be read?
  • Can the filesystem be cleaned by deleting problematic objects? Is there a cryfsck tool for this?
  • The cryfs system needs tunable retry code. The internet is guaranteed to mangle your data, assume that, verify operations, and retry if needed.

My very small test filesystem is corrupted beyond repair, and I just don't have time to try this experiment again.

Thank you for the great work though. I am looking forward to a future version with some improved error messages and more stability :)

nathanshearer avatar Jul 06 '21 15:07 nathanshearer

Thanks for reporting. The error reporting improvements you're mentioning would definitely help, I agree.

The known issues in cryfs 0.10 that can corrupt file systems are:

  • killing the cryfs process while it is writing, e.g. through a power loss
  • the underlying file system runs out of disk space while cryfs is writing
  • the same file system is mounted on and accessed from multiple devices at the same time Those are also mentioned in the README.

Do any of those apply to your situation or do you think you ran into an unknown issue? Also, which version of cryfs were you using? can you try version 0.11-rc1? It's not fully released yet but has some stability improvements.

smessmer avatar Jul 07 '21 05:07 smessmer

Suppose I use cryfs on top of a network filesystem (e.g., an rclone mount or an sshfs mount [see. #342]). I want to know whether I will lost data if my computer loses Internet connection while writing data?

mingcenwei avatar Oct 03 '21 13:10 mingcenwei

If I remember it correctly, rclone unmount the drive immediately when you lose internet connection. Therefore, it may be the same situation as the file system runs out of space I think. Rclone sync may be more suitable than rclone mount.

Small-Ku avatar Jan 02 '22 10:01 Small-Ku