Linux: Remove files cached on disk

 

Sometimes you have to delete files on disk to free up space, you proceed to remove it only to find that it didn’t actually free up any space. This usually means that files are being held against their will by some process, to view these files being held run

lsof -n | grep -i deleted

Sample output

mysqld 13493 mysql 4u REG 202,1 0 271066 /tmp/ibicpkpG (deleted)
mysqld 13493 mysql 5u REG 202,1 0 271289 /tmp/ibEqTjw4 (deleted)
mysqld 13493 mysql 6u REG 202,1 0 271290 /tmp/ibsiLjDs (deleted)

From here just restart the process and it should free up those files