I'm using Ubuntu 18.04 LTS, and I'm doing something weird on my system.
In crontab -e
, I have a line like this:
@reboot sleep 11 && sshpass -p '123456' ssh -D *:7070 socksclient@localhost
so that an ssh client program runs automatically on system startup, acting as a SOCK5 server at port 7070.
But something bad happens. My root partition is slowly running out of space, and I can see this leakage with df
, about 100 bytes per second.
After some investigation, lsof | grep deleted
reveals that it is ssh
or sshpass
grabbing [ a file handle to a deleted file-system path(/tmp/#16 in the attached image)] and append content to it continuously, so it is sneakingly hogging my disk space.
BTW: If I run sshpass -p '123456' ssh -D *:7070 socksclient@localhost
manually from Linux console, those (delete)
entries will not appear.
Those leaked disk space can not be revealed with du
, and, they can be freed only by killing the ssh or sshpass process.
So my question is: I want my ssh client to run with system startup, but eliminate disk space leakage. How to achieve that?
I'll be appreciative if someone can tell:
- What's the current size of a
deleted
file? - how can I know what content(text) is being appended to the /tmp/#16 file? Maybe some program similar to the Process Monitor on Windows?
hope this help.
Get the PID and FD of process holding that 'deleted' file/fd and use stat/cat/peekfd etc. It has to be still running cause file even in deleted state is here (under active process).