6

Running a command called df -h on my EC2 instance results in the following

Filesystem      Size  Used Avail Use% Mounted on
udev            2.0G     0  2.0G   0% /dev
tmpfs           396M   41M  355M  11% /run
/dev/xvda1      7.8G  4.6G  2.8G  63% /
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

I have limited space on my root / drive and these guys /dev/shm /sys/fs/cgroup and /dev are sitting with 2GB of free memory. /run/user/1000 also has 396 MB of free space.

I would like to know the purpose of these file systems and are they absolutely necessary. If no, can I reclaim that space by any chance and add it to my root directory. My logs files and DB are growing day on day and I need more space to keep them.

3 Answers 3

5

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?

4
  • 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.

1
  • Well, I do have MongoDB Powered Database and Node-powered backend. will definitely do the above
    – Saras Arya
    Apr 9, 2017 at 14:31
2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .