Created
December 19, 2016 07:40
-
-
Save xnoder/14af58a8f9461cd835195b190437c014 to your computer and use it in GitHub Desktop.
Zap a deleted file handle holding into disk space
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# These commands will help you find and truncate a deleted file handle that is holding onto disk space. Why do my servers | |
# always fuck with me during the holidays? | |
# Run this to find files that have one link, which should equal a (deleted) file | |
$ lsof -nP +L1 | |
# Now, search through /proc to find these deleted files | |
$ find /proc/*/fd -ls | grep '(deleted)' | |
/proc/5225/fd/3 -> /var/log/ceph/ceph-mon.st1.log.1\ (deleted) | |
# Truncate the file. Win free disk space. Woohoo! | |
$ : > "/proc/$pid/fd/$fd" | |
$ df -h | |
# go get a warm beverage you linux wrangling superstar. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment