当前位置: 动力学知识库 > 问答 > 编程问答 >

python - Delete an unfinished file

问题描述:

I was writing a huge file output.txt (around 10GB) on a server thorugh a python script using the f.write(row) command but because the process was too long I decided to interrupt the program using

kill -9 pid

The problem is that this space is still used on the server when I check with the command

df -h

How can I empty the disk occupied by this buffer that was trying to write the file?

the file output.txt was empty (0 Byte) when I killed the script, but I still deleted it anyway using

rm output.txt

but the space in the disk doesn't become free, I still have 10 GB wasted..

网友答案:

If you delete a file which is opened in some processes, it's marked as deleted, but the content remains on disk, so that all processes still can read it. Once all processes close corresponding descriptors (or simply finish), the space will be reclaimed.

网友答案:

check the proccesses to see if it is still running, if yeah, just get the id and wright on the terminal:

kill proccess_id
分享给朋友:
您可能感兴趣的文章:
随机阅读: