{"componentChunkName":"component---src-templates-post-template-js","path":"/aws-disk-space-issue","webpackCompilationHash":"9f9b08718447f3d4e396","result":{"data":{"markdownRemark":{"id":"970bfc60-e81a-5e5f-ac1e-1f4ab7ef86e6","html":"<p>More often than not (sadly) I struggle with the next error message at my amazon aws instances:<br>\n<code class=\"language-text\">unable to create &#39;/something/something.tmp&#39;: No space left on device</code></p>\n<p>So, disk space issue… probably big log files that needs to be wiped or something like that? not always that easy.</p>\n<h2 id=\"how-to-diagnose-the-issue\"><a href=\"#how-to-diagnose-the-issue\" aria-label=\"how to diagnose the issue permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>How to diagnose the issue</h2>\n<p>When I ran <code class=\"language-text\">df -H</code> the output says that I still have some space left, so what is it?</p>\n<p>Well, is possible that is the inodes allocation. Run <code class=\"language-text\">df -i</code> to check them out.\nIf you find that you are at 100% or close to it, you need to get rid of them.</p>\n<h2 id=\"how-to-locate-the-files-to-remove\"><a href=\"#how-to-locate-the-files-to-remove\" aria-label=\"how to locate the files to remove permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>How to locate the files to remove</h2>\n<p>Where are they at? You can try to run this script (that doesnt needs to create a tmp file for it, since we dont have space left for that)</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">cd /\nsudo find . -xdev -type f | cut -d &quot;/&quot; -f 2 | sort | uniq -c | sort -n</code></pre></div>\n<h2 id=\"common-cause-linux-headers-inodes\"><a href=\"#common-cause-linux-headers-inodes\" aria-label=\"common cause linux headers inodes permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Common cause: linux-headers inodes</h2>\n<p>But, you can save some time if you first try for the most common source of this issue… <strong>old linux-headers</strong> </p>\n<p>They are located at /usr/src/ folder, just run a <code class=\"language-text\">ll</code> and delete some to recover some inodes space (you wont be able to purge them using apt-get if you are at 100% disk usage). <strong>Don’t delete them all</strong> they are used by linux, just get rid of some old versions that may be lingering there.</p>\n<p>So, for example, run:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">sudo rm -rf  linux-headers-4.4.0-130/</code></pre></div>\n<p>Then you can try to purge some of them using <code class=\"language-text\">sudo apg-get -f autoremove</code> (and then manually remove old ones that weren’t removed that way)</p>\n<h2 id=\"tldr\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TLDR;</h2>\n<p>Check if the issue are the inodes by running <code class=\"language-text\">df -i</code></p>\n<p>If its at 100% or close to it, try removing old linux-headers to recover some space. Don’t go crazy on this step, try removing only 1 of the oldest images and then run <code class=\"language-text\">sudo apt-get -f autoremove</code></p>\n<p>They are located at <code class=\"language-text\">/usr/src/</code> folder (you can remove them with <code class=\"language-text\">rm -rf</code>)</p>","fields":{"slug":"aws-disk-space-issue","tagSlugs":["/tag/disk-space/","/tag/aws/","/tag/ec-2/","/tag/linux-headers/","/tag/inodes/"]},"frontmatter":{"date":"2020-08-20T20:52:08.576Z","description":"A common issue that I faced on small AWS instances, and a quick easy fix for it (aka: inodes 100%)","tags":["disk space","aws","ec2","linux headers","inodes"],"title":"Solving disk space issues at EC2 AWS Linux instances","socialImage":null}}},"pageContext":{"isCreatedByStatefulCreatePages":false,"slug":"aws-disk-space-issue"}}}