Open ncw opened 1 year ago
An rclone user reported that the free/used/total sizes were half what they should be in the smb backend: https://github.com/rclone/rclone/issues/6733
I have verified this against this docker image https://hub.docker.com/r/dperson/samba and also that if you mount that disk from Windows it gets the free/used/total sizes correct.
Putting in a bit of debugging I see the Statfs block is returned as
stat{ TotalAllocationUnits: 959122528, CallerAvailableAllocationUnits: 407504932, ActualAvailableAllocationUnits: 407504932, SectorsPerAllocationUnit: 2, BytesPerSector: 512, }
Wheras the BlockSize is calculated like this
BlockSize
https://github.com/hirochachacha/go-smb2/blob/c8e61c7a5fa7bcd1143359f071f9425a9f4dda3f/client.go#L1438-L1440
I suspect it should be calculated like this instead - this would make the sizes come out correctly.
func (fi *fileFsFullSizeInformation) BlockSize() uint64 { return uint64(fi.BytesPerSector) * uint64(fi.SectorsPerAllocationUnit) }
However I have no knowledge of the SMB protocol so that might be completely wrong.
If you think that is good then I can make a PR with that in.
An rclone user reported that the free/used/total sizes were half what they should be in the smb backend: https://github.com/rclone/rclone/issues/6733
I have verified this against this docker image https://hub.docker.com/r/dperson/samba and also that if you mount that disk from Windows it gets the free/used/total sizes correct.
Putting in a bit of debugging I see the Statfs block is returned as
Wheras the
BlockSize
is calculated like thishttps://github.com/hirochachacha/go-smb2/blob/c8e61c7a5fa7bcd1143359f071f9425a9f4dda3f/client.go#L1438-L1440
I suspect it should be calculated like this instead - this would make the sizes come out correctly.
However I have no knowledge of the SMB protocol so that might be completely wrong.
If you think that is good then I can make a PR with that in.