I have a 142MiB log file named
c3600_router_log.txt under
/tmp directory which is used by a process with PID 12369(
Dynamips):
Code:
root@potato:/tmp# lsof | grep c3600_router_log.txt
dynamips 12369 root 15w REG 8,8 199015029 76 /tmp/c3600_router_log.txt
root@potato:/tmp#
I would like to delete the content of this log file. If I do "> c3600_router_log.txt", then file is not truncated:
Code:
root@potato:/tmp# date "+%T"; ls -lh c3600_router_log.txt
02:42:22
-rw-r--r-- 1 root root 190M 27. veebr 02:42 c3600_router_log.txt
root@potato:/tmp# date "+%T"; > c3600_router_log.txt
02:42:24
root@potato:/tmp# date "+%T"; ls -lh c3600_router_log.txt
02:42:25
-rw-r--r-- 1 root root 190M 27. veebr 02:42 c3600_router_log.txt
root@potato:/tmp#
Just to be very sure that file is not rewritten to disk, I ran
iotop -b -d 0.5 -p 12369 during flushing the content of
/tmp/c3600_router_log.txt, but there was nearly no I/O usage.
How to explain this behavior? Are there situations where one is not able to flush the content of the file which in use by a process?