What is the purpose of these directories on my EC2 Ubuntu 16.04 instance?

Solution 1:

Of the directories you have listed, exactly one is on disk and occupies disk space: /. The others are all in memory (RAM) for various reasons.

/dev, for example, contains files representing various devices available to your system, and these files are actually just representations of various in-memory kernel structures. /dev/shm for POSIX shared memory objects, which are also supposed to be in RAM.

The tmpfs filesystem is, in fact, in memory (RAM), so there's nothing to be gained in disk space from directories on which tmpfs is mounted.

You should be looking into getting more disk space. 8 GB for a database in 2017? Is this on a phone?

Solution 2:

  • tmpfs is not using disk space but uses memory. And those directories are required.

My logs files (1) and DB (2) are growing day on day and I need more space to keep them.

  1. Trim them with logrotate and/or fix the reason why they grow. Backup them up to a remote system and remove logs when older than 1 day to keep them small. Use the backup versions for analyzing any problems.

  2. Buy more space. See how large your database file is. Mark it and when the disk is 10% more used do that again and plan an upgrade to your EC2 accordingly. 8Gb is not a lot for a much website that holds something like a forum or webshop with a SQL backend.

Solution 3:

Linux needs these folders for working properly. tmpfs is the file system in your RAM. This is so fast file system and for some system processes needs process some files so fast. If you define these folders in your harddrive may be your system slowing down. Don't worry about these and you can use your computer as fast as with this configuration. If you want to learn linux folder system you can check this: http://www.thegeekstuff.com/2010/09/linux-file-system-structure/?utm_source=tuicool