# File delete issue



## Mayhem30 (Aug 10, 2011)

After a really busy morning, one of my apache error log files was 9.5GB. It was a silly mistake in php coding on my part.

I went ahead and deleted the file (disk was full), but when I do :
[CMD=""]df -h[/CMD] it still shows this :


```
Filesystem            Size    Used   Avail Capacity  Mounted on
/dev/mirror/gm0s1a    1.9G    240M    1.5G    13%    /
devfs                 1.0K    1.0K      0B   100%    /dev
/dev/mirror/gm0s1e    1.9G     58K    1.8G     0%    /tmp
/dev/mirror/gm0s1f    210G    3.1G    190G     2%    /usr
/dev/mirror/gm0s1d    9.7G    9.7G   -770M   108%    /var
```

/var is still 100% full. How do I free this space up?


----------



## graudeejs (Aug 10, 2011)

Do you have ufs snapshots?, you need to delete them (at least some, latest)


----------



## Mayhem30 (Aug 10, 2011)

I'm not sure to be honest, someone else setup gmirror for me.

If I did, where would they generally be located in?


----------



## phoenix (Aug 10, 2011)

You'll also need to restart Apache.  If it's still running, then it has the file handle still open, so the filesystem will not release the space used by the "deleted" file.

And, if it's a syslog-managed log file, then you need to restart syslogd as well.


----------



## graudeejs (Aug 10, 2011)

for ufs slanpshot look in root of partition, I think there was .ufs folder, not sure.
All I remember is that it was hidden directory (that is starts with dot, you need *ls -a* to see it) and that it was in root of partition. In your case /var/

But first do what phoenix said.


----------



## Mayhem30 (Aug 10, 2011)

Restarting apache solved the problem.

Thank you for all the quick responses.


----------



## fonz (Aug 10, 2011)

killasmurf86 said:
			
		

> for ufs slanpshot look in root of partition, I think there was .ufs folder, not sure.
> All I remember is that it was hidden directory (that is starts with dot, you need *ls -a* to see it) and that it was in root of partition.


/root/of/partition/*.snap*

Fonz


----------



## graudeejs (Aug 10, 2011)

fonz said:
			
		

> /root/of/partition/*.snap*
> 
> Fonz



Right, haven't been using UFS for Long time


----------



## DutchDaemon (Aug 10, 2011)

Anyhoo: this always happens when removing log files that are actively being written to. Instead of removing them and having to restart the daemon that has the file handle open, you can just copy /dev/null to it, or echo an empty string to it. Then it will be of size zero, and no daemon will have to be restarted. The space will be returned to the system, and all file ownerships and permissions will remain intact.


----------

