-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"No space left" errors on Btrfs #395
Comments
Hi! There should be no limit to either individual files or the whole gocryptfs filesystem. I wonder if we have a problem with Btrfs. Could you check |
Here's the records that I saw appearing in the log:
|
Thanks, this is interesting:
This means that btrfs told gocryptfs that there is no space left. Copying this file outside gocryptfs works? |
Yes, I tried different files too. Copied them to the same drive, in the gocryptfs container folder. Everything works, just not inside the gocryptfs mount point. Just FYI, the fstab line:
The space left on the drive: Space left on the gocryptfs mount point: |
I see you are using a compression option with btrfs.
Are the plaintext files highly compressible?
The ciphertext files definitely are not, and that could explain you get a
"no space left" when copying them to the gocryptfs mount, but not outside
that mount.
|
I cannot give a proper answer to that question because I don't know. But what I can tell you are the estimated compression results for the zo folder:
It's not that much. Even for the whole drive it has very limited effect, because the compression setting I use is a soft setting that doesn't for compression, and most data is already compressed (videos, pictures) I doubt it's that option though (although I'm no expert), because the btrfs compression algorithm just checks a chunk of data in the beginning of the file and then decides whether compression is interesting or not. As you can see in the stats above, it's mostly ignored. I just tested with multiple files that are each a few hundred MB in size but total to +1.1GB. That works. So the issue is limited to single files of +1.1GB in size |
Can you try mounting gocryptfs with Also, what is your kernel version ( |
That solves it yes, although it copies a part of the data, freezes for a short time and then copies the rest, instead of it being one fluent process.
|
Good. Looks like Btrfs still has problems with preallocation. Fun fact: the reason that |
Does that mean it's a BTRFS bug? If so, I should report it then. Thanks for the help! |
At the moment it looks like a btrfs bug, yes. However, before reporting it: I will try to reproduce it with a small test program outside gocryptfs. I'll get to it next week, hopefully. It's still possible that gocryptfs is doing something stupid, or could do things differently to avoid the problem. |
Good idea. Because it reminds me about torrent applications that can also preallocate the space before downloading the file (which I've also used before) and I never had any troubles likes that with BTRFS file systems. Perhaps that could be a good source for you check how they do it? |
I created a 10GB file, formatted it as btrfs and mounted like this via fstab:
Mounted a gocryptfs there, and copied a few 2GB files, but did not see any errors. My kernel: Could you try as well with a fresh btrfs filesystem? |
I tried again on a different BTRFS drive. I created a gocrypt container there and copied a file of 6.5GB inside it. It worked until 5.3GB and then the same error popped up. Secondly I copied the original zo map to a different BTRFS drive (third one, unrelated to first and second), made sure -noprealloc wasn't set, copied the same 6.5GB file to it and transfer was successful. fstab of second and third drives:
This is my /tmp (not sure if it's related to this): |
I could now reproduce this by writing more data. I got the error when btrfs got 79% full:
|
Directly on btrfs I managed to fill it to 100%. Note that I use /dev/urandom here, because the zeros from /dev/zero will compress to nothing.
|
I have written a reproducer for the one half of the problem ( https://github.com/rfjakob/fallocate_write ). I have posted to the linux-btrfs mailing list: fallocate does not prevent ENOSPC on write |
So the post to linux-btrfs sparked an interesting discussion, my conclusion is that fallocate has many problems on btrfs, and we should automatically set -noprealloc when we detect btrfs. |
I read the discussion too, it's interesting even though I don't understand much of the technical chitchat in the end. So the permanent solution is that mount option? Doesn't it have any negative impact? Or is the "negative" impact limited to not being able to check if there's enough free space left in advance before copying? |
Yes, exactly. And this does not work on btrfs anyway, as we can still get out of space errors on write. |
Alright then. Thanks for all the effort and help! |
Preallocation on Btrfs is broken ( #395 , https://lore.kernel.org/linux-btrfs/CAPv9Zmk46As_P9Gyf_icET53xRda63h7iC1meES9xbdDEt9qow@mail.gmail.com/ ) and slow ( #63 ).
Pushed commit 1305527 , we now automatically set -noprealloc when Btrfs is detected. |
HI
I checked everywhere to find out if there's a file size limit for gocryptfs containers, but didn't find any such detail. But still, I can't move a 4GB file to my container. It even stops at 1.1GB before throwing an error mentioning that there is not sufficient space. The drive has 80 GB of free space left though
Filesystem: BTRFS
Gocryptfs version: 1.7
The text was updated successfully, but these errors were encountered: