Sample Header Ad - 728x90

Best way to free disk space from deleted files that are held open

39 votes
7 answers
199972 views
Hi I have many files that have been deleted but for some reason the disk space associated with the deleted files is unable to be utilized until I explicitly kill the process for the file taking the disk space $ lsof /tmp/ COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME cron 1623 root 5u REG 0,21 0 395919638 /tmp/tmpfPagTZ4 (deleted) The disk space taken up by the deleted file above causes problems such as when trying to use the tab key to autocomplete a file path I get the error bash: cannot create temp file for here-document: No space left on device But after I run kill -9 1623 the space for that PID is freed and I no longer get the error. My questions are: - why is this space not immediately freed when the file is first deleted? - what is the best way to get back the file space associated with the deleted files? and please let me know any incorrect terminology I have used or any other relevant and pertinent info regarding this situation.
Asked by BryanK (803 rep)
Jan 30, 2015, 06:56 PM
Last activity: May 22, 2023, 07:12 AM