title: Amazon EC2 instance : Cannot create temp file for here document. No space left on device
body: <p>I have an EC2 instance, which keeps on running Out Of Memory killing my mongod process in turn. </p>
  
  <p>Doing df -h gives</p>
  
  <pre><code>udev            2.0G     0  2.0G   0% /dev
  tmpfs           396M   41M  355M  11% /run
  /dev/xvda1      7.8G  7.4G     0 100% /
  tmpfs           2.0G     0  2.0G   0% /dev/shm
  tmpfs           5.0M     0  5.0M   0% /run/lock
  tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
  tmpfs           396M     0  396M   0% /run/user/1000
  </code></pre>
  
  <p>so as my <code>/dev/xvda1</code> is full. I go in my '/' or root directory and do a </p>
  
  <pre><code>ls -l --block-size=M 
  total 1M
  drwxr-xr-x   2 root root 1M Nov 22 04:49 bin
  drwxr-xr-x   3 root root 1M Dec 21 13:14 boot
  drwxrw-rwx   3 root root 1M Oct 18 21:01 data
  drwxr-xr-x  16 root root 1M Oct 18 20:30 dev
  drwxr-xr-x  91 root root 1M Dec 14 01:29 etc
  drwxr-xr-x   3 root root 1M Oct 18 20:30 home
  lrwxrwxrwx   1 root root 1M Dec 21 13:14 initrd.img -&gt; boot/initrd.img-4.4.0-57-generic
  lrwxrwxrwx   1 root root 1M Dec  6 05:03 initrd.img.old -&gt; boot/initrd.img-4.4.0-53-generic
  drwxr-xr-x  21 root root 1M Sep  7 19:24 lib
  drwxr-xr-x   2 root root 1M Sep  7 19:22 lib64
  drwx------   2 root root 1M Sep  7 19:26 lost+found
  drwxr-xr-x   2 root root 1M Sep  7 19:22 media
  drwxr-xr-x   2 root root 1M Sep  7 19:22 mnt
  drwxr-xr-x   2 root root 1M Sep  7 19:22 opt
  dr-xr-xr-x 139 root root 0M Oct 18 20:29 proc
  drwx------   4 root root 1M Oct 18 21:00 root
  drwxr-xr-x  23 root root 1M Dec 25 13:55 run
  drwxr-xr-x   2 root root 1M Oct 19 06:11 sbin
  drwxr-xr-x   2 root root 1M Sep  1 17:37 snap
  drwxr-xr-x   2 root root 1M Sep  7 19:22 srv
  dr-xr-xr-x  13 root root 0M Dec 25 13:59 sys
  drwxrwxrwt  11 root root 1M Dec 25 14:17 tmp
  drwxr-xr-x  10 root root 1M Sep  7 19:22 usr
  drwxr-xr-x  14 root root 1M Oct 18 20:52 var
  lrwxrwxrwx   1 root root 1M Dec 21 13:14 vmlinuz -&gt; boot/vmlinuz-4.4.0-57-generic
  lrwxrwxrwx   1 root root 1M Dec  6 05:03 vmlinuz.old -&gt; boot/vmlinuz-4.4.0-53-generic
  </code></pre>
  
  <p>If I add up all the file size it doesn't add up to be 7.4 GB. Then what is ? and how do I fix this? So that it doesn't overflow and kill my mongod process in return.</p>
  
  <p>On some of the answer. It said restart your system. Post restarting this is the output.</p>
  
  <pre><code>udev            2.0G     0  2.0G   0% /dev
  tmpfs           396M  5.6M  390M   2% /run
  /dev/xvda1      7.8G  5.3G  2.2G  72% /
  tmpfs           2.0G     0  2.0G   0% /dev/shm
  tmpfs           5.0M     0  5.0M   0% /run/lock
  tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
  tmpfs           396M     0  396M   0% /run/user/1000
  </code></pre>
  
  <p>I still use 5.3G of space. what is causing 2 GB to be filled? How do I drill down the issue?</p>