<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Control WebPanel Wiki &#187; Disk Usage Check</title>
	<atom:link href="http://wiki.centos-webpanel.com/tag/disk-usage-check/feed" rel="self" type="application/rss+xml" />
	<link>http://wiki.centos-webpanel.com</link>
	<description>CentOS WebPanel Wiki</description>
	<lastBuildDate>Wed, 12 Feb 2025 20:38:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>Disk Usage Check</title>
		<link>http://wiki.centos-webpanel.com/disk-usage-check</link>
		<comments>http://wiki.centos-webpanel.com/disk-usage-check#comments</comments>
		<pubDate>Fri, 28 Jan 2022 08:19:08 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Disk Usage Check]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=1709</guid>
		<description><![CDATA[If you have a full disk space usage on your server in most cases this is caused by backups or logs but it can be also many other things. We recommend running all these commands from the ssh console because on a big disk this can be very slow. List partitions and usage df -h [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>If you have a full disk space usage on your server in most cases this is caused by backups or logs but it can be also many other things.<br />
We recommend running all these commands from the ssh console because on a big disk this can be very slow.</p>
<p><strong>List partitions and usage</strong></p>
<pre>df -h</pre>
<p><strong>Check Disk Usage per User</strong></p>
<pre>repquota -a -s</pre>
<p>Show only accounts with usage in Gbytes</p>
<pre>repquota -a -s | grep G</pre>
<p><strong>Check Disk Usage per Partition ignoring links</strong><br />
* You can replace /home with the parition or folder you want to check<br />
Let's check /home partition</p>
<pre>du -hx --max-depth 1 /home</pre>
<p>Show only folders with usage in Gbytes</p>
<pre>du -hx --max-depth 1 /home | grep G</pre>
<p>Check /var partition</p>
<pre>du -hx --max-depth 1 /var</pre>
<p>Show only folders with usage in Gbytes</p>
<pre>du -hx --max-depth 1 /var | grep G</pre>
<p>Check Mail folder /var/vmail</p>
<pre>du -hx --max-depth 1 /var/vmail</pre>
<p>Show only folders with usage in Gbytes</p>
<pre>du -hx --max-depth 1 /var/vmail | grep G</pre>
<p>Check MySQL folder /var/lib/mysql</p>
<pre>du -hx --max-depth 1 /var/lib/mysql</pre>
<p>Show only folders with usage in Gbytes</p>
<pre>du -hx --max-depth 1 /var/lib/mysql | grep G</pre>
<p>Check Backups</p>
<pre>du -hx --max-depth 1 /backup</pre>
<p>Show only folders with usage in Gbytes</p>
<pre>du -hx --max-depth 1 /backup | grep G</pre>
<p>Show only daily backup folder with usage in Gbytes</p>
<pre>du -hx --max-depth 1 /backup/daily | grep G</pre>
<p>Now when you know how to check the partitions and folders here are some useful commands to check files in the folder sorted by size:</p>
<pre>ls -lahS /folder/location</pre>
<p>Example for MySQL folder /var/lib/mysql/</p>
<pre>ls -lahS /var/lib/mysql/</pre>
<p>Some useful scripts we already have are checking the most frequent folders:<br />
/var/log/<br />
/usr/local/apache/logs/<br />
/usr/local/apache/domlogs/<br />
/usr/local/cwpsrv/logs/<br />
/tmp<br />
/root<br />
/var/lib/mysql/</p>
<pre>/scripts/disk_check</pre>
<p><strong>Delete Files</strong><br />
Now when you know how to check, the question is how can you delete or empty files.<br />
Note that you shouldn't delete files other than logs or backups as all others can crash your server.</p>
<p>Log files are in use by the programs so in case you want to clean big active log files you can't just delete them as they will remain invisible until you restart the service.<br />
The solution is to empty the file, example:</p>
<pre>:> /usr/local/apache/logs/access_log</pre>
<p>However all other logs files you can simply delete, examples</p>
<pre>rm -f  filename</pre>
<p>An example case when you have active log files and logrotated which are not active and are renamed with -DATE</p>
<p>Delete single log file NOT currently in use by service</p>
<pre>rm -f /var/log/maillog-20211108</pre>
<p>Delete all maillog files NOT currently in use by service</p>
<pre>rm -f /var/log/maillog-*</pre>
<p>Empty active log file which is in use by the service</p>
<pre>:> /var/log/maillog</pre>
<p><em>* If you are not sure it's better to grab a support service and have the experienced sysadmin to check this for you.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://wiki.centos-webpanel.com/disk-usage-check/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
