Forums

Free diskspace from script?

How can the amount of free diskspace be retrieved via a script?

Background: Amount of free diskspace is visible in the PA web dashboard, but when "df -h . " is executed in a console, different figures are given...

Unfortunately we don't have a way to do that right now; df -h will just give you the information about the volume that your disk space is a portion of, and the API we use to populate the numbers on the "Files" tab isn't something you can call directly. It's something we should probably add to the API, though -- I've added that to our to-do list.

Indeed, that would be interesting. Today there's no way to automatically find out if disk cleanup is required.

Yes, that's true. I suppose you could put your quota into the code as a constant and then use du, but that would be fragile if you changed your account to get more or less disk.

Found this thread while looking for same thing: is there an accurate solution today? (use of du seems to not be accurate, as it doesn't report same value than the value provided by my dashboard)

the best is probably still du. For du, did you also check /tmp etc?

Nope...

I've only checked my /home directory ^^

If I add result from /tmp dir, that make sense... I maybe join you if I encounter disk space problem to know what files could be safely deleted from /tmp when I will ran out of disk space (but that's not at all actually the case ;)) because I dont understand what is stored in it (I've 40M in my /home dir, and 27M in my /tmp dir, wich seems a big proportion, but I will see how /tmp grow while /home grow :P)

(Sorry for response delay : I've not seen notification for your post)

no worries! hope your upgrade gave you more space to work with!