The file has been deleted, but the space is not released

Created: Sep 16, 2019 00:51:04Latest reply: Sep 16, 2019 00:58:20 96 2 1 0
  Rewarded Hi-coins: 0 (problem resolved)

Hello, I was working on the file deletion on the storage system and found that after the file was deleted, the storage space was not released. Please help me figure it out so that I can handle this problem more easily when I have this problem again.

thank you!

  • x
  • convention:

Featured Answers
songminwang
Admin Created Sep 16, 2019 00:58:20 Helpful(2) Helpful(2)

Hello, under normal circumstances, there is no case that the space is not released after the deletion, but when the file process is locked, or the process has been writing data to this file, the space will not be released after the file is deleted.
In Linux, a file is stored in the file system in two parts: the data part and the pointer part. The pointer is located in the meta-data of the file system. After the data is deleted, the pointer is cleared from the meta-data. The data portion is stored on the disk. After the pointer corresponding to the data is cleared from the meta-data, the space occupied by the file data can be overwritten and the new content can be written.
After the deletion of the file, the space has not been released. It should be because the process is locked. The pointer part of the file is not cleared from the meta-data. Because the pointer is not deleted, the system kernel considers that the file has not been deleted. Therefore, the query space is not released by the df command.
# lsof can get a list of deleted files still occupied by the application.
# lsof |grep delete
Solution:
(1) Close or restart the process
(2) The best way is
#echo  "">/tmp/access_log
  • x
  • convention:

Hiphop
Hiphop Created Sep 17, 2019 00:22:18
Thank you,  
All Answers
songminwang
songminwang Admin Created Sep 16, 2019 00:58:20 Helpful(2) Helpful(2)

Hello, under normal circumstances, there is no case that the space is not released after the deletion, but when the file process is locked, or the process has been writing data to this file, the space will not be released after the file is deleted.
In Linux, a file is stored in the file system in two parts: the data part and the pointer part. The pointer is located in the meta-data of the file system. After the data is deleted, the pointer is cleared from the meta-data. The data portion is stored on the disk. After the pointer corresponding to the data is cleared from the meta-data, the space occupied by the file data can be overwritten and the new content can be written.
After the deletion of the file, the space has not been released. It should be because the process is locked. The pointer part of the file is not cleared from the meta-data. Because the pointer is not deleted, the system kernel considers that the file has not been deleted. Therefore, the query space is not released by the df command.
# lsof can get a list of deleted files still occupied by the application.
# lsof |grep delete
Solution:
(1) Close or restart the process
(2) The best way is
#echo  "">/tmp/access_log
  • x
  • convention:

Hiphop
Hiphop Created Sep 17, 2019 00:22:18
Thank you,  

Reply

Reply
You need to log in to reply to the post Login | Register

Notice Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " Privacy."
If the attachment button is not available, update the Adobe Flash Player to the latest version!
Login and enjoy all the member benefits

Login and enjoy all the member benefits

Login