16

Recently I encountered a lack of diskspace problem on a SFTP server and I realised I have no idea how to check how much is left or even the total amount.

Does anyone know how to do this through an application like FileZilla or perhaps there is a command that can be used for this purpose?

Note that the server is hosted at a third party and I was hoping there was a way to answer this question without going through them.

Update:

I tried connecting via shell using both putty and cygwin ssh. Putty silently failed while cygwin gave me the following error message:

$ ssh [user]@[host] -i "[priv.key]"
Last login: Wed Aug 17 12:54:46 2011 from 195.204.103.176
Could not chdir to home directory /local00/ftproot/[user]: No such file or directory
/usr/local/sbin/scponlyc: No such file or directory
Connection to [host] closed.

Any ideas?

0

3 Answers 3

19

The scponly shell may allow the quota command (if enabled). But it seems that you have the scponly configured to support the SFTP only, with a shell access disallowed.

The SFTP protocol allows checking disk space (contrary to what other answers say).

Extracting from the SFTP - check free space available question of stackoverflow.com:

SFTP protocol version 6 lets one check available space (SSH_FXP_EXTENDED request name space-available). Most SSH/SFTP servers (notably OpenSSH, as the one the most widespread) support SFTP version 3 only though.

OpenSSH on the other hand supports [email protected] proprietary extension.

The OpenSSH extension is supported by some SFTP clients.

  • Obviously by the OpenSSH sftp client via the df command:

    df [-hi] [path]
    Display usage information for the filesystem holding the current directory (or path if specified). If the -h flag is specified, the capacity information will be displayed using "human-readable" suffixes. The -i flag requests display of inode information in addition to capacity information. This command is only supported on servers that implement the ''[email protected]'' extension.

    sftp> df -h
        Size     Used    Avail   (root)    %Capacity
       591GB    358GB    203GB    233GB          60%
    
2
  • 2
    Unfortunately not all servers support that: sftp> df Server does not support [email protected] extension Sep 27, 2018 at 6:31
  • @ThomasLauria It's a proprietary extension of OpenSSH. While some other servers may opt to support it as well, not all do. Sep 27, 2018 at 6:35
1
ssh <host> df -h

Will give you all of the necessary information, in the absence of things like disk quotas. If you don't have shell access (or some way of running commands, such as via PHP exec), then you can't check disk space, but then again, if you don't have shell, how can it be your responsibility to administer the server and manage disk space?

1
  • Well, it's not strictly my responsibility, but I've written some exporting/importing scripts regarding the SFTP server and I'm notified of the errors triggered. Ultimately we would like to adjust/rewrite the cleanup process but now I just want some more information
    – kjetilh
    Aug 17, 2011 at 10:30
-1

With the SFTP command set there is no possibility to get the available size or the space used.

If you are able to SSH to the server (same host, user, password) you could issue a df -h to see the space available. Or a du -h in the folder to see the used space of the folder.

1
  • It's not true that SFTP does not allow getting disk usage. See my other answer. Dec 27, 2013 at 12:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .