Skip to content

Instantly share code, notes, and snippets.

@mvisonneau
Created November 10, 2014 14:19
Show Gist options
  • Save mvisonneau/a2e738ea6523303c5322 to your computer and use it in GitHub Desktop.
Save mvisonneau/a2e738ea6523303c5322 to your computer and use it in GitHub Desktop.
Free space from locked files without restarting process
root@hostname:/var/log# df -h | grep lv_var
/dev/rootvg/lv_var 992M 943M 0 100% /var
root@hostname:~# pidof mysqld
17431
root@hostname:~# lsof -p 17431 | grep deleted
mysqld 17431 mysql 1w REG 252,5 1 32994 /var/log/mysql/error.log.1 (deleted)
mysqld 17431 mysql 2w REG 252,5 1 32994 /var/log/mysql/error.log.1 (deleted)
mysqld 17431 mysql 4w REG 252,5 1 32987 /var/log/mysql/mysql-slow.log.1 (deleted)
root@hostname:~# cd /proc/17431/fd
root@hostname:/proc/17431/fd# echo '' > 1
root@hostname:/proc/17431/fd# echo '' > 2
root@hostname:/proc/17431/fd# echo '' > 4
root@hostname:/proc/17431/fd# df -h | grep lv_var
/dev/rootvg/lv_var 992M 200M 742M 22% /var
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment