Skip to content
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

Wrong Container-Size #375

Closed
warmup72 opened this issue Mar 12, 2019 · 7 comments
Closed

Wrong Container-Size #375

warmup72 opened this issue Mar 12, 2019 · 7 comments
Labels
macOS Apple macOS ("darwin") specific issue

Comments

@warmup72
Copy link

I´m using gocryptfs v1.6.1 on osx 10.14.3

After setting up and mounting a new Container the "finder Information" Reports 55TB free disk Memory.
This seems to be wrong, because my SSD unforunally has only 256GB :-)

@rfjakob
Copy link
Owner

rfjakob commented Mar 17, 2019

Hi! Thanks for the report. Looks like reverse mode has the same problem: #274

Can you post the output of df -k ? Are we wrong by a factor of 256 ?

rfjakob added a commit that referenced this issue Mar 17, 2019
This should help debugging

#375 and
#274 ,

as MacOS does not have "stat -f".
@rfjakob
Copy link
Owner

rfjakob commented Mar 17, 2019

Update: can you run statfs.darwin.tar.gz against a mounted gocryptfs, and against the underlying filesystem? For me, on Linux, it looks like this. "Blocks" and "Bsize" are identical for both, and df reports the right size:

$ ./statfs /tmp/gocryptfs.mnt
{
	"Type": 1702057286,
	"Bsize": 4096,
	"Blocks": 1002783,
	"Bfree": 1002751,
	"Bavail": 1002751,
	"Files": 1002783,
	"Ffree": 1002704,
	"Fsid": {
		"X__val": [
			0,
			0
		]
	},
	"Namelen": 255,
	"Frsize": 4096,
	"Flags": 4134,
	"Spare": [
		0,
		0,
		0,
		0
	]
}

$ ./statfs /tmp
{
	"Type": 16914836,
	"Bsize": 4096,
	"Blocks": 1002783,
	"Bfree": 1002751,
	"Bavail": 1002751,
	"Files": 1002783,
	"Ffree": 1002704,
	"Fsid": {
		"X__val": [
			0,
			0
		]
	},
	"Namelen": 255,
	"Frsize": 4096,
	"Flags": 38,
	"Spare": [
		0,
		0,
		0,
		0
	]
}

@rfjakob rfjakob added the macOS Apple macOS ("darwin") specific issue label Mar 17, 2019
@warmup72
Copy link
Author

warmup72 commented Mar 17, 2019

Hi, thanks for Your answer. My output looks a little differenz:
Crypt-Path

{
	"Bsize": 4096,
	"Iosize": 1048576,
	"Blocks": 61228134,
	"Bfree": 11793725,
	"Bavail": 10836789,
	"Files": 9223372036854775807,
	"Ffree": 9223372036853495114,
	"Fsid": {
		"Val": [
			16777220,
			25
		]
	},
	"Owner": 0,
	"Type": 25,
	"Flags": 75550720,
	"Fssubtype": 1,
	"Fstypename": [
		97,
		112,
		102,
		115,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0
	],

Mount-Path:

{
	"Bsize": 1048576,
	"Iosize": 1048576,
	"Blocks": 61228134,
	"Bfree": 11793720,
	"Bavail": 10836784,
	"Files": 9223372036854775807,
	"Ffree": 9223372036853495114,
	"Fsid": {
		"Val": [
			905969729,
			30
		]
	},
	"Owner": 501,
	"Type": 30,
	"Flags": 26,
	"Fssubtype": 0,
	"Fstypename": [
		111,
		115,
		120,
		102,
		117,
		115,
		101,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0
	],

rfjakob added a commit to rfjakob/go-fuse that referenced this issue Mar 17, 2019
We usually were off by a factor of 256.
Fixes rfjakob/gocryptfs#375
@rfjakob
Copy link
Owner

rfjakob commented Mar 17, 2019

Perfect, thanks! I think I have that fixed, can you try
gocryptfs.statfs-darwin.tar.gz ?

@warmup72
Copy link
Author

Yes that´s it!
Perfect! The viewed size is now correct!

hanwen pushed a commit to hanwen/go-fuse that referenced this issue Mar 19, 2019
We usually were off by a factor of 256.
Fixes rfjakob/gocryptfs#375
rfjakob added a commit that referenced this issue Mar 20, 2019
We want this go-fuse commit
hanwen/go-fuse@161a164
as it fixes
#274 and
#375
@rfjakob
Copy link
Owner

rfjakob commented Mar 20, 2019

Fixed via hanwen/go-fuse@161a164 , thanks!

@rfjakob rfjakob closed this as completed Mar 20, 2019
@jollino
Copy link

jollino commented Jul 8, 2024

Hi, apologies for resurrecting this old thread but I'm having a related issue on macOS 14.5 (Darwin 23.5.0).

I created a directory on my boot SSD, encrypted and mounted it. The "main" disk is shown as having 154 GB free in the Finder, while the encrypted volume claims to have 130 GB.

df shows the following (skipping lines about external, unrelated disks)

Filesystem                             Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk3s1s1                        460Gi   9.6Gi   121Gi     8%    404k  1.3G    0%   /
devfs                                 247Ki   247Ki     0Bi   100%     855     0  100%   /dev
/dev/disk3s6                          460Gi   6.0Gi   121Gi     5%       6  1.3G    0%   /System/Volumes/VM
/dev/disk3s2                          460Gi   5.7Gi   121Gi     5%    1.1k  1.3G    0%   /System/Volumes/Preboot
/dev/disk3s4                          460Gi    18Mi   121Gi     1%      56  1.3G    0%   /System/Volumes/Update
/dev/disk1s2                          500Mi   6.0Mi   481Mi     2%       1  4.9M    0%   /System/Volumes/xarts
/dev/disk1s1                          500Mi   6.2Mi   481Mi     2%      32  4.9M    0%   /System/Volumes/iSCPreboot
/dev/disk1s3                          500Mi   1.6Mi   481Mi     1%      58  4.9M    0%   /System/Volumes/Hardware
/dev/disk3s5                          460Gi   317Gi   121Gi    73%    2.8M  1.3G    0%   /System/Volumes/Data
map auto_home                           0Bi     0Bi     0Bi   100%       0     0     -   /System/Volumes/Data/home
/tmp/_/orig                           460Gi   339Gi   121Gi    74%    2.8M  1.3G    0%   /private/tmp/_/crypt

I just recompiled gocryptfs from the current git repository to ensure that I was using the latest version of everything (gocryptfs v2.4.0-33-gf06f27e; go-fuse v2.5.0; 2024-07-08 go1.22.5 darwin/arm64).

These are the results of runnning statfs on both directories, both empty:
statfs_apfs.txt
statfs_fusefs.txt

I'm afraid I am not really familiar with fuse or proficient enough with Go to even consider figuring it out myself, but I'll be more than happy to run any other tests. :)

EDIT: I also tried creating one on my NAS, and it's even odder. The Finder reports 4.23 TB free on the network volume (via SMB), but the mounted filesystem reports 529.3.

Again the relevant df, slightly redacted:

Filesystem                             Size    Used   Avail Capacity iused ifree %iused  Mounted on
//username@host._smb._tcp.local/home   21Ti    18Ti   3.9Ti    83%     19G  4.1G   82%   /Volumes/home
/Volumes/home/username/directory      2.7Ti   2.2Ti   493Gi    83%     19G  4.1G   82%   /private/tmp/mount

And the statfs results:
statfs_nas_fusefs.txt
statfs_nas_smb.txt

Note that in this case the encrypted folder contains about 370 GB / 344 GiB of data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macOS Apple macOS ("darwin") specific issue
Projects
None yet
Development

No branches or pull requests

3 participants