Disk usage showing wrong even after removing log files

Some times you may have noticed that the actual disk space is not showing correctly even after removing large log files having size of GB. The problem is some process may be still holding that file. So you can see actual size only after restarting the service or restarting the machine. So the best solution to avoid this is to truncate the log files rather than simply deleting. You can follow the below methods for reducing the file size :

Suppose your log file name is theg.log

1.  cat /dev/null > theg.log

2.   > theg.log

*(Starting with space)

3. truncate -s 0 theg.txt

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s