Client Devices‎ > ‎Linux PC‎ > ‎

File Systems

    To begin partitioning and splitting up your hard drives you first need to know what all the file systems are, what they do, and what they contain. In linux your main/base directory is “/” or often referred to as root (not to be confused with /root). This is the ground level hierarchy of all the directories where all the other file systems are mounted, and should be given 8-10GB of space with a separate home partition. These file systems include, /bin, /boot, /dev, /etc, /home, /initrd, /lib, /lost+found, /misc, /mnt, /net, /opt, /proc, /root, /sbin, /tmp, /usr, /var. There are many many directories in a linux system however, we are just going to keep it short and simple for now and will only be covering some of these directories (the more important ones). Below are some of the linux file systems listed with a descriptive explanation on each and how large to make each. The partition sizes that i have determined are based off of a server I created running CentOS with 4GB RAM and a 160GB hard drive.(the amount of space that should be allocated to a partition will very depending on hard drive size, amount of ram, and required services of the system).


  • /boot
    • Startup files and kernel information is stored here. This is the directory that the system accesses upon being turned on in order to boot properly. The size of /boot is very crucial, kernels do not take up much space on a drive but when you start piling up kernel updates in /boot it will fill quickly and the machine will die. This means that the size of your /boot partition can determine the lifespan of your computer, if boot isn't large enough the kernel will run out of room to update. For this reason I allocated a generous 5GB to boot. This will ensure that /boot does not fill up for about 5 years.

  • /home
    • This is where all user specific data is stored. Meaning anything that the user creates or installs is stored in this directory. Such as documents created by the user. It is your own personal folder. For my server I made /home 30 GB, which is plenty of space for the service of my machine. Creating a separate partition for /home will help protect its contents. If you have /home on a separate partition or mounted from a remote computer on the network it will help shield users from data loss in the event of hardware failure. If you ever wish to install a new OS on your machine but do not want to lose the contents of your /home directory, putting /home on a separate partition allows you to reinstall an OS without erasing home. Each user has their own specific home directory and each directory's contents are going to be different varying by user(multiple users=larger partition).

  • /var

    • This directory is very very important to any system and you should DEFINITELY consider creating a separate partition for it. /var will grow rapidly in size, this is why it is best to create it as a separate partition and allocate a decent amount of storage to it. I made /var 30GB to ensure that it won’t fill up. Data, including Apache web server and FTP, are stored here. It is also used to store downloaded update packages on a temporary basis. You should be sure to allocate enough space to download pending updates and still be able to store all of your content. The var file system is divided by subdirectories containing a variety of data. Here are just a few very key directories: /var/gdm, /var/lib, /var/lock, /var/run, /var/log, /var/spool, /var/tmp. These directories are for storing specific non constant data. This data ranges from a variety of things and is different for every subdirectory. Listed underneath are all the subdirectories that are in /var:

- /var/lib:

- Dynamic data libraries and files are stored here such as the rpm/dpkg database. It also contains information about an application or the system. This information is modified while the application runs.


- var/log

- This is where log files for various applications are stored. For example every time a user logs in or out of the system a log file is stored in the /var/log file system that keeps note of that action. It also stores much more important information such as syslog (/var/log/messages) which is where all kernel and system program messages are stored. Note: this file system grows exponentially in size and should be cleaned regularly to prevent filling up the directory. You can download administrator tools to clean the directory for you on a regular basis.


- var/spool

- Directories for news,email, printer queues, and all other queued work is stored here (queued: FIFO-organized sequence of items, as data, messages, jobs, or the like, waiting for action). Each spool has its own different subdirectory such as /var/spool/news, where news spools are located.

                                   - var/tmp

- Contains some of the same contents as the /tmp file system, however it is not exactly all the same. Some files are too large for /tmp or need to exist for a much longer period of time, and are therefore placed here in /var/tmp.

                                   -/var/run

- Any information that is valid about the system, leading up to the next boot, is stored here. For example /var/run/utmp contains information about users that are currently logged into the system.




  • Swap

    • Swap is a very great feature that Linux offers. This feature is used to temporarily store data when there is not enough RAM for its current tasks. The rule of thumb for swap is always make the partition double the size of RAM on your device. My machine is equipped with 4GB of RAM and i gave my swap partition 6GB. But wait, double the size of 4 is 8...right? So why did i only assign 6GB to swap? Well, when you have any more than 2GB of RAM instead of doubling the number you just add 2. Below is an example of how to figure the amount of swap needed on a device.

- Formula to decide how much swap to create:

If RAM < 2

Swap = RAM *2

Else

Swap = RAM + 2GB

(example provided by www.centos.org)



  • /tmp
    • /tmp is used for temporary file storage, as it’s name implies. Various programs create files in this directory, and it is cleaned up of stale information (any file not used after 10 days). Various administration tools can be installed to perform a regular clean on /tmp. You can configure how often these programs check your /tmp file in your system’s scheduling table, this can be located through /etc/crontab. Since /tmp is regularly cleaned out it does not need to be very large, I gave mine 15GB and would recommend a 5GB minimum.

  • /usr
    • Applications, documents, and services that are supplied to the user are kept in this directory. For example, when Bob want’s to get online and browse the internet he goes to open his browser. The system administrator has decided that google chrome is going to be the web browser used by all of the users, so Bob opens google chrome. In this case chrome is a application being provided to the user and is stored in the /usr directory. /usr can fill pretty quickly and should be given a fair amount of space, I gave 30GB to my server.

  • /dev

    • Dev is the location of special or device files. If you were to list the contents of the /dev directory you would find devices like hard drives, printers, graphics card, optical drive and other devices.

  • /etc

    • This file system is the nerve center of your system, it contains all of the configuration files related to the system. A configuration file “is defined as a local file used to control the operation of a program; it must be static and cannot be an executable binary.” (Red Hat Linux 9 Bill Ball Hoyt Duff). One of the most important directories under /etc is sysconfig. This is where network activation scripts hardware- and software-related information.

  • /proc

    • This is a virtual filesystem that contains many system configuration parameters. The content in the /proc directory is created from memory and only exists while Linux is running. These files will either extract information from or send information to the kernel.



Brian Brennan 09/04/12 Brian.brennan499@gmail.com