<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="it">
	<id>http://www.emigar.com/wiki/index.php?action=history&amp;feed=atom&amp;title=File_aperti_e_cancellati</id>
	<title>File aperti e cancellati - Cronologia</title>
	<link rel="self" type="application/atom+xml" href="http://www.emigar.com/wiki/index.php?action=history&amp;feed=atom&amp;title=File_aperti_e_cancellati"/>
	<link rel="alternate" type="text/html" href="http://www.emigar.com/wiki/index.php?title=File_aperti_e_cancellati&amp;action=history"/>
	<updated>2026-05-04T16:47:59Z</updated>
	<subtitle>Cronologia della pagina su questo sito</subtitle>
	<generator>MediaWiki 1.39.0</generator>
	<entry>
		<id>http://www.emigar.com/wiki/index.php?title=File_aperti_e_cancellati&amp;diff=6082&amp;oldid=prev</id>
		<title>WikiSysop: Creata pagina con &quot;  Why is space not being freed from disk after deleting a file in Red Hat Enterprise Linux? Solution Verified - Updated February 13 2022 at 3:06 AM - English Environment  Red Hat Enterprise Linux (RHEL) Issue      Why is space not being freed from disk after deleting a file in Red Hat Enterprise Linux?     When deleting a large file or files, the file is deleted successfully but the size of the filesystem does not reflect the change.     I&#039;ve deleted some files but the a...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.emigar.com/wiki/index.php?title=File_aperti_e_cancellati&amp;diff=6082&amp;oldid=prev"/>
		<updated>2024-01-04T12:06:50Z</updated>

		<summary type="html">&lt;p&gt;Creata pagina con &amp;quot;  Why is space not being freed from disk after deleting a file in Red Hat Enterprise Linux? Solution Verified - Updated February 13 2022 at 3:06 AM - English Environment  Red Hat Enterprise Linux (RHEL) Issue      Why is space not being freed from disk after deleting a file in Red Hat Enterprise Linux?     When deleting a large file or files, the file is deleted successfully but the size of the filesystem does not reflect the change.     I&amp;#039;ve deleted some files but the a...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nuova pagina&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Why is space not being freed from disk after deleting a file in Red Hat Enterprise Linux?&lt;br /&gt;
Solution Verified - Updated February 13 2022 at 3:06 AM - English&lt;br /&gt;
Environment&lt;br /&gt;
&lt;br /&gt;
Red Hat Enterprise Linux (RHEL)&lt;br /&gt;
Issue&lt;br /&gt;
&lt;br /&gt;
    Why is space not being freed from disk after deleting a file in Red Hat Enterprise Linux?&lt;br /&gt;
    When deleting a large file or files, the file is deleted successfully but the size of the filesystem does not reflect the change.&lt;br /&gt;
    I&amp;#039;ve deleted some files but the amount of free space on the filesystem has not changed.&lt;br /&gt;
&lt;br /&gt;
    The OS was holding several very large log files open with some as large as ~30G. The file was previously deleted, but only stopping and restarting the jvm/java process released the disk space. The lsof command shows the following output before restarting the java process&lt;br /&gt;
    Raw&lt;br /&gt;
&lt;br /&gt;
    COMMAND     PID      USER   FD      TYPE    DEVICE   SIZE/OFF       NODE NAME&lt;br /&gt;
    : &lt;br /&gt;
    java      49097    awdmw   77w      REG     253,6 33955068440    1283397 /opt/jboss/jboss-eap-5/jboss-as/server/all/log/server.log (deleted)&lt;br /&gt;
&lt;br /&gt;
    When you perform a df, the storage shows 90+% utilized, however, there is not really that much written to that space.&lt;br /&gt;
&lt;br /&gt;
Resolution&lt;br /&gt;
&lt;br /&gt;
Graceful shutdown of relevant process&lt;br /&gt;
&lt;br /&gt;
First, obtain a list of deleted files which are still held open by applications:&lt;br /&gt;
Raw&lt;br /&gt;
&lt;br /&gt;
$ lsof | egrep &amp;quot;deleted|COMMAND&amp;quot;&lt;br /&gt;
COMMAND       PID    TID TASKCMD     USER   FD  TYPE  DEVICE    SIZE/OFF      NODE NAME&lt;br /&gt;
ora         25575   8194 oracle    oracle   33   REG   65,65  4294983680  31014933 /oradata/DATAPRE/file.dbf (deleted)&lt;br /&gt;
&lt;br /&gt;
Note: check either the filesystem path within NAME field or the device number under DEVICE to match the filesystem of interest.&lt;br /&gt;
&lt;br /&gt;
The lsof output shows the process with pid 25575 has kept file /oradata/DATAPRE/file.dbf open with file descriptor (fd) number 33.&lt;br /&gt;
&lt;br /&gt;
After a file has been identified, free the file used space by shutting down the affected process. If a graceful shutdown does not work, then issue the kill command to forcefully stop it by referencing the PID.&lt;br /&gt;
&lt;br /&gt;
Truncate File Size&lt;br /&gt;
&lt;br /&gt;
Alternatively, it is possible to force the system to de-allocate the space consumed by an in-use file by forcing the system to truncate the file via the proc file system. This is an advanced technique and should only be carried out when the administrator is certain that this will cause no adverse effects to running processes. Applications may not be designed to deal elegantly with this situation and may produce inconsistent or undefined behavior when files that are in use are abruptly truncated in this manner.&lt;br /&gt;
Raw&lt;br /&gt;
&lt;br /&gt;
$ echo &amp;gt; /proc/pid/fd/fd_number&lt;br /&gt;
&lt;br /&gt;
For example, from the lsof output above:&lt;br /&gt;
Raw&lt;br /&gt;
&lt;br /&gt;
$ file /proc/25575/fd/33&lt;br /&gt;
/proc/25575/fd/33: broken symbolic link to `/oradata/DATAPRE/file.dbf (deleted)&amp;#039;&lt;br /&gt;
$ echo &amp;gt; /proc/25575/fd/33&lt;br /&gt;
&lt;br /&gt;
The same reason will cause different disk usage from du command and df command, please refer to Why does df show bigger disk usage than du?&lt;br /&gt;
&lt;br /&gt;
To identify the used file size (in blocks), use the command below:&lt;br /&gt;
Raw&lt;br /&gt;
&lt;br /&gt;
# lsof -Fn -Fs |grep -B1 -i deleted | grep ^s  | cut -c 2- | awk &amp;#039;{s+=$1} END {print s}&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Root Cause&lt;br /&gt;
&lt;br /&gt;
On Linux or Unix systems, deleting a file via rm or through a file manager application will unlink the file from the file system&amp;#039;s directory structure; however, if the file is still open (in use by a running process) it will still be accessible to this process and will continue to occupy space on disk. Therefore such processes may need to be restarted before that file&amp;#039;s space will be cleared up on the filesystem.&lt;br /&gt;
Diagnostic Steps&lt;br /&gt;
&lt;br /&gt;
Log Reaper will allow you to visualize and quickly narrow down the lsof data to exactly the subset you want to see&lt;br /&gt;
&lt;br /&gt;
    Product(s) Red Hat Enterprise Linux &lt;br /&gt;
&lt;br /&gt;
    Component lsof &lt;br /&gt;
&lt;br /&gt;
    Category Learn more &lt;br /&gt;
&lt;br /&gt;
    Tags file_systems kernel rhel &lt;br /&gt;
&lt;br /&gt;
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.&lt;br /&gt;
7 Comments &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
https://access.redhat.com/solutions/2316&lt;br /&gt;
&lt;br /&gt;
[[Categoria:Linux]]&lt;br /&gt;
[[Categoria:Opensource]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
</feed>