0 votes
by (2.0k points)

I used Rebex SFTP Client (6.0.8181) to connect to the SFTP server of Mac (mini).
Mac's SFTP Server is the Mac's default SFTP server.

When I call GetFileSystemInfo and see the capacity, it comes out too much.
When I look at the log using LogWriter

2022-08-05 15:13:18.859 VERBOSE RaiSFtp(2)[9] SSH: Sending packet SSH_MSG_CHANNEL_DATA (46 bytes).
 0000 |5E-00-00-00-00-00-00-00 25-00-00-00-21-C8-00-00| ^.......%...!...
 0010 |00-0C-00-00-00-13-73-74 61-74-76-66-73-40-6F-70| ......statvfs@op
 0020 |65-6E-73-73-68-2E-63-6F 6D-00-00-00-01-2F | enssh.com..../
2022-08-05 15:13:18.859 INFO RaiSFtp(2)[9] Command: SSH_FXP_EXTENDED (12, 'statvfs@openssh.com', '/')
2022-08-05 15:13:18.860 VERBOSE RaiSFtp(2)[25] SSH: Received packet SSH_MSG_CHANNEL_DATA (106 bytes).
 0000 |5E-00-00-00-00-00-00-00 61-00-00-00-5D-C9-00-00| ^.......a...]...
 0010 |00-0C-00-00-00-00-00-10 00-00-00-00-00-00-00-00| .............
 0020 |10-00-00-00-00-00-03-91 18-70-00-00-00-00-02-7B| .........p.....{
 0030 |AE-B1-00-00-00-00-02-7B AE-B1-00-00-00-00-63-5C| .......{......c\
 0040 |1C-46-00-00-00-00-63-53 4B-A8-00-00-00-00-63-53| .F....cSK.....cS
 0050 |4B-A8-00-00-00-00-01-00 00-13-00-00-00-00-00-00| K...............
 0060 |00-01-00-00-00-00-00-00 00-FF | .............
2022-08-05 15:13:18.860 INFO RaiSFtp(2)[9] Response: SSH_FXP_EXTENDED_REPLY (12, 1048576, 4096, 59840624, 41660081, 41660081, 1666980934, 1666403240, 1666403240, 16777235, 1, 255)

It comes out like this.
Rebex seems to treat TotalSpace as 59840624 * 1048576.
However, 59840624 * 4096 is the actual capacity.

Most Linux and NAS's SFTP is no problem because file system block size: 4096, fundamental fs block size:4096, but Mac seems to be a problem because it sends 1048576, 4096.

Rebex's SftpFileSystemInfo structure does not have a fundamental fs block size value.

And, I'm struggling a lot to show the total system capacity.
However, due to the characteristics of the Linux system, it is very difficult to properly show the actual total capacity.
You can get the capacity of a specific folder, but it is difficult to show the total system capacity.
Do you have any advice regarding this?

Thank you.

BooKyung Oh.
OpenBoxLab Inc.

Applies to: Rebex SFTP

1 Answer

0 votes
by (148k points)
edited by
 
Best answer

Update: This has been resolved in Rebex SFTP R6.6.


Thanks for reporting this issue!

On Linux, both file system block size and fundamental FS block size are 4096, while on Mac the file system block size is 1048576, and it's this value we use for the calculation. Sadly, OpenSSH folks never explained in their statvfs extension specification what these fields actually mean. And the relevant underlying API also makes it seem that file system block size is the field suitable for free space calculations.

We are not aware of any SFTP extension that would make it possible to enumerate mount points in Linux (a prerequisite for calculating the total free space). But it looks like it might be possible to get that list by reading the contents of "/proc/mounts" file. But in practice, it will be a challenge to distinguish relevant mountspoints from others - contemporary Linux instances often feature all kinds of virtual mount points for which disk space numbers are somewhat meaningless.

But the 'total disk space' or 'total free space' concept does not seem very useful in general. Different mountpoints might have quite different characteristics - one could be an very fast SSD, another a large but slow hard drive, next a very large yet read-only network drive, then an USB flash drive... In most scenarios, displaying a list of devices with their mountpoints and space information seems more useful.

by (2.0k points)
Thank you for your answer.
I wanted to show the total and free capacity quickly and simply, but it doesn't seem that easy.
We saw the decision to give up showing this information.
I wish you always in good health.
by (148k points)
Thank you for your wishes! We will fix the size issue with Mac in GetFileSystemInfo in the next release anyway, thanks for bringing the issue to our attention.
by (148k points)
This has been fixed in Rebex SFTP R6.6.
...