How to remove the deleted files without rebooting the server.
Staled files are truncated using following way.
# Find which deleted files are hold the disk # Here we have found /var/lib/mysql/tiber-slow.log file is already deleted but process file descripter hold the 53GB of disk space.
[root@tiber ~]# /usr/sbin/lsof +L1| grep deleted
httpd 1215 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
mysqld_sa 5126 root 0u CHR 136,8 0 10 /dev/pts/8 (deleted)
mysqld_sa 5126 root 1u CHR 136,8 0 10 /dev/pts/8 (deleted)
mysqld_sa 5126 root 2u CHR 136,8 0 10 /dev/pts/8 (deleted)
mysqld 5463 mysql 5u REG 253,0 0 0 3375113 /tmp/ibmUkzSE (deleted)
mysqld 5463 mysql 6u REG 253,0 0 0 3375114 /tmp/ibO0Vrz1 (deleted)
mysqld 5463 mysql 7u REG 253,0 0 0 3375115 /tmp/ibsBhlgo (deleted)
mysqld 5463 mysql 8u REG 253,0 0 0 3375117 /tmp/ibdc6pyL (deleted)
mysqld 5463 mysql 11w REG 253,0 56948585548 0 7569934 /var/lib/mysql/tiber-slow.log (deleted)
mysqld 5463 mysql 12u REG 253,0 0 0 3375118 /tmp/ibbgJXs9 (deleted)
httpd 5675 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 5678 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 10448 root 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 11372 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 15774 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 15992 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 17758 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 18725 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 19277 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
bash 24852 junedm 0u CHR 136,11 0 13 /dev/pts/11 (deleted)
bash 24852 junedm 1u CHR 136,11 0 13 /dev/pts/11 (deleted)
bash 24852 junedm 2u CHR 136,11 0 13 /dev/pts/11 (deleted)
bash 24852 junedm 255u CHR 136,11 0 13 /dev/pts/11 (deleted)
ntpd 28185 ntp 3w REG 253,0 235 0 10223627 /var/cfengine/outputs/cf_tiber_glam_com__1317021178_Mon_Sep_26_00_12_58_2011_ab92cca0 (deleted)
httpd 29537 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
# find the the process fd which are not linked
[root@tiber ~]# find -L /proc/5463/fd -type f -links 0 | xargs ls -l
l-wx------ 1 root root 64 Aug 3 19:55 /proc/5463/fd/11 -> /var/lib/mysql/tiber-slow.log (deleted)
lrwx------ 1 root root 64 Aug 3 19:55 /proc/5463/fd/12 -> /tmp/ibbgJXs9 (deleted)
lrwx------ 1 root root 64 Aug 3 19:55 /proc/5463/fd/5 -> /tmp/ibmUkzSE (deleted)
lrwx------ 1 root root 64 Aug 3 19:55 /proc/5463/fd/6 -> /tmp/ibO0Vrz1 (deleted)
lrwx------ 1 root root 64 Aug 3 19:55 /proc/5463/fd/7 -> /tmp/ibsBhlgo (deleted)
lrwx------ 1 root root 64 Aug 3 19:55 /proc/5463/fd/8 -> /tmp/ibdc6pyL (deleted)
#To truncate the process fd of '/var/lib/mysql/tiber-slow.log', have ran the following command.
[root@tiber ~]# perl -e 'truncate("/proc/5463/fd/11", 0);'
#where '5463 is mysql process id and 11 is the fd for /var/lib/mysql/tiber-slow.log'
After complete the truncate, open file listed zero size of deleted files.
[root@tiber ~]# lsof | grep -i deleted
httpd 1215 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
mysqld_sa 5126 root 0u CHR 136,8 10 /dev/pts/8 (deleted)
mysqld_sa 5126 root 1u CHR 136,8 10 /dev/pts/8 (deleted)
mysqld_sa 5126 root 2u CHR 136,8 10 /dev/pts/8 (deleted)
mysqld 5463 mysql 5u REG 253,0 0 3375113 /tmp/ibmUkzSE (deleted)
mysqld 5463 mysql 6u REG 253,0 0 3375114 /tmp/ibO0Vrz1 (deleted)
mysqld 5463 mysql 7u REG 253,0 0 3375115 /tmp/ibsBhlgo (deleted)
mysqld 5463 mysql 8u REG 253,0 0 3375117 /tmp/ibdc6pyL (deleted)
mysqld 5463 mysql 11w REG 253,0 0 7569934 /var/lib/mysql/tiber-slow.log (deleted)
mysqld 5463 mysql 12u REG 253,0 0 3375118 /tmp/ibbgJXs9 (deleted)
httpd 5675 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 5678 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 10448 root 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 11372 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 15774 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 15992 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 17758 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 18725 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 19277 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
bash 24852 junedm 0u CHR 136,11 13 /dev/pts/11 (deleted)
bash 24852 junedm 1u CHR 136,11 13 /dev/pts/11 (deleted)
bash 24852 junedm 2u CHR 136,11 13 /dev/pts/11 (deleted)
bash 24852 junedm 255u CHR 136,11 13 /dev/pts/11 (deleted)
ntpd 28185 ntp 3w REG 253,0 235 10223627 /var/cfengine/outputs/cf_tiber_glam_com__1317021178_Mon_Sep_26_00_12_58_2011_ab92cca0 (deleted)
httpd 29537 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
Staled files are truncated using following way.
# Find which deleted files are hold the disk # Here we have found /var/lib/mysql/tiber-slow.log file is already deleted but process file descripter hold the 53GB of disk space.
[root@tiber ~]# /usr/sbin/lsof +L1| grep deleted
httpd 1215 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
mysqld_sa 5126 root 0u CHR 136,8 0 10 /dev/pts/8 (deleted)
mysqld_sa 5126 root 1u CHR 136,8 0 10 /dev/pts/8 (deleted)
mysqld_sa 5126 root 2u CHR 136,8 0 10 /dev/pts/8 (deleted)
mysqld 5463 mysql 5u REG 253,0 0 0 3375113 /tmp/ibmUkzSE (deleted)
mysqld 5463 mysql 6u REG 253,0 0 0 3375114 /tmp/ibO0Vrz1 (deleted)
mysqld 5463 mysql 7u REG 253,0 0 0 3375115 /tmp/ibsBhlgo (deleted)
mysqld 5463 mysql 8u REG 253,0 0 0 3375117 /tmp/ibdc6pyL (deleted)
mysqld 5463 mysql 11w REG 253,0 56948585548 0 7569934 /var/lib/mysql/tiber-slow.log (deleted)
mysqld 5463 mysql 12u REG 253,0 0 0 3375118 /tmp/ibbgJXs9 (deleted)
httpd 5675 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 5678 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 10448 root 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 11372 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 15774 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 15992 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 17758 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 18725 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
httpd 19277 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
bash 24852 junedm 0u CHR 136,11 0 13 /dev/pts/11 (deleted)
bash 24852 junedm 1u CHR 136,11 0 13 /dev/pts/11 (deleted)
bash 24852 junedm 2u CHR 136,11 0 13 /dev/pts/11 (deleted)
bash 24852 junedm 255u CHR 136,11 0 13 /dev/pts/11 (deleted)
ntpd 28185 ntp 3w REG 253,0 235 0 10223627 /var/cfengine/outputs/cf_tiber_glam_com__1317021178_Mon_Sep_26_00_12_58_2011_ab92cca0 (deleted)
httpd 29537 junedm 35w REG 253,0 0 0 3375109 /tmp/rewrite.log (deleted)
# find the the process fd which are not linked
[root@tiber ~]# find -L /proc/5463/fd -type f -links 0 | xargs ls -l
l-wx------ 1 root root 64 Aug 3 19:55 /proc/5463/fd/11 -> /var/lib/mysql/tiber-slow.log (deleted)
lrwx------ 1 root root 64 Aug 3 19:55 /proc/5463/fd/12 -> /tmp/ibbgJXs9 (deleted)
lrwx------ 1 root root 64 Aug 3 19:55 /proc/5463/fd/5 -> /tmp/ibmUkzSE (deleted)
lrwx------ 1 root root 64 Aug 3 19:55 /proc/5463/fd/6 -> /tmp/ibO0Vrz1 (deleted)
lrwx------ 1 root root 64 Aug 3 19:55 /proc/5463/fd/7 -> /tmp/ibsBhlgo (deleted)
lrwx------ 1 root root 64 Aug 3 19:55 /proc/5463/fd/8 -> /tmp/ibdc6pyL (deleted)
#To truncate the process fd of '/var/lib/mysql/tiber-slow.log', have ran the following command.
[root@tiber ~]# perl -e 'truncate("/proc/5463/fd/11", 0);'
#where '5463 is mysql process id and 11 is the fd for /var/lib/mysql/tiber-slow.log'
After complete the truncate, open file listed zero size of deleted files.
[root@tiber ~]# lsof | grep -i deleted
httpd 1215 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
mysqld_sa 5126 root 0u CHR 136,8 10 /dev/pts/8 (deleted)
mysqld_sa 5126 root 1u CHR 136,8 10 /dev/pts/8 (deleted)
mysqld_sa 5126 root 2u CHR 136,8 10 /dev/pts/8 (deleted)
mysqld 5463 mysql 5u REG 253,0 0 3375113 /tmp/ibmUkzSE (deleted)
mysqld 5463 mysql 6u REG 253,0 0 3375114 /tmp/ibO0Vrz1 (deleted)
mysqld 5463 mysql 7u REG 253,0 0 3375115 /tmp/ibsBhlgo (deleted)
mysqld 5463 mysql 8u REG 253,0 0 3375117 /tmp/ibdc6pyL (deleted)
mysqld 5463 mysql 11w REG 253,0 0 7569934 /var/lib/mysql/tiber-slow.log (deleted)
mysqld 5463 mysql 12u REG 253,0 0 3375118 /tmp/ibbgJXs9 (deleted)
httpd 5675 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 5678 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 10448 root 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 11372 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 15774 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 15992 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 17758 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 18725 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
httpd 19277 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
bash 24852 junedm 0u CHR 136,11 13 /dev/pts/11 (deleted)
bash 24852 junedm 1u CHR 136,11 13 /dev/pts/11 (deleted)
bash 24852 junedm 2u CHR 136,11 13 /dev/pts/11 (deleted)
bash 24852 junedm 255u CHR 136,11 13 /dev/pts/11 (deleted)
ntpd 28185 ntp 3w REG 253,0 235 10223627 /var/cfengine/outputs/cf_tiber_glam_com__1317021178_Mon_Sep_26_00_12_58_2011_ab92cca0 (deleted)
httpd 29537 junedm 35w REG 253,0 0 3375109 /tmp/rewrite.log (deleted)
No comments:
Post a Comment