Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Linux Tutorials: root file systems in linux

The root filesystem should generally be small, since it contains very critical files and a small, infrequently modified filesystem has a better chance of not getting corrupted. A corrupted root filesystem will generally mean that the system becomes unbootable except with special measures (e.g., from a floppy), so you don’t want to risk it.

The root directory generally doesn’t contain any files, except perhaps on older systems where the standard boot image for the system, usually called /vmlinuz was kept there. (Most distributions have moved those files the the /boot directory. Otherwise, all files are kept in subdirectories under the root filesystem:

The following list provides information about the contents of some of the subdirectories of the / (root) file system.

ItemDescription
/etcContains configuration files that vary for each machine. Examples include:/etc/hosts/etc/passwdThe /etc directory contains the files generally used in system administration. Most of the commands that previously resided in the /etc directory now reside in the /usr/sbin directory. However, for compatibility, the /usr/sbin directory contains symbolic links to the locations of some executable files. Examples include:/etc/chown is a symbolic link to /usr/bin/chown./etc/exportvg is a symbolic link to /usr/sbin/exportvg.
/binSymbolic link to the /usr/bin directory. In prior UNIX file systems, the /bin directory contained user commands that now reside in the /usr/bin directory.
/sbinContains files needed to boot the machine and mount the /usr file system. Most of the commands used during booting come from the boot image’s RAM disk file system; therefore, very few commands reside in the /sbin directory.
/devContains device nodes for special files for local devices. The /dev directory contains special files for tape drives, printers, disk partitions, and terminals.
/tmpServes as a mount point for a file system that contains system-generated temporary files. The /tmp file system is an empty directory.
/varServes as a mount point for files that vary on each machine. The /var file system is configured as a file system since the files it contains tend to grow. See /var file system for more information.
/uSymbolic link to the /home directory.
/usrContains files that do not change and can be shared by machines such as executables and ASCII documentation.Standalone machines mount the root of a separate local file system over the /usr directory. Diskless machines and machines with limited disk resources mount a directory from a remote server over the /usr file system. See /usr file system for more information about the file tree mounted over the /usr directory.
/homeServes as a mount point for a file system containing user home directories. The /home file system contains per-user files and directories.In a standalone machine, the /home directory is contained in a separate file system whose root is mounted over the /home directory root file system. In a network, a server might contain user files that are accessible from several machines. In this case, the server copy of the /home directory is remotely mounted onto a local /home file system.
/exportContains the directories and files on a server that are for remote clients.See /export directory for more information about the file tree that resides under the /export directory.
/libSymbolic link to the /usr/lib directory. See /usr file system for more information.
/tftpbootContains boot images and boot information for diskless clients.

/bin

Commands needed during bootup that might be used by normal users (probably after bootup).

/sbin

Like /bin, but the commands are not intended for normal users, although they may use them if necessary and allowed. /sbin is not usually in the default path of normal users, but will be in root’s default path.

/etc

Configuration files specific to the machine.

/root

The home directory for user root. This is usually not accessible to other users on the system

/lib

Shared libraries needed by the programs on the root filesystem.

/lib/modules

Loadable kernel modules, especially those that are needed to boot the system when recovering from disasters (e.g., network and filesystem drivers).

/dev

Device files. These are special files that help the user interface with the various devices on the system.

/tmp

Temporary files. As the name suggests, programs running often store temporary files in here.

/boot

Files used by the bootstrap loader, e.g., LILO or GRUB. Kernel images are often kept here instead of in the root directory. If there are many kernel images, the directory can easily grow rather big, and it might be better to keep it in a separate filesystem. Another reason would be to make sure the kernel images are within the first 1024 cylinders of an IDE disk. This 1024 cylinder limit is no longer true in most cases. With modern BIOSes and later versions of LILO (the LInux LOader) the 1024 cylinder limit can be passed with logical block addressing (LBA). See the lilo manual page for more details.

/mnt

Mount point for temporary mounts by the system administrator. Programs aren’t supposed to mount on /mnt automatically. /mnt might be divided into subdirectories (e.g., /mnt/dosa might be the floppy drive using an MS-DOS filesystem, and /mnt/exta might be the same with an ext2 filesystem).

/proc, /usr, /var, /home

Mount points for the other filesystems. Although /proc does not reside on any disk in reality it is still mentioned here. See the section about /proc later in the chapter.

The following table provides a very brief list of the standard, well-known, and defined top-level Linux directories and their purposes.

DirectoryDescription
/ (root filesystem)The root filesystem is the top-level directory of the filesystem. It must contain all of the files required to boot the Linux system before other filesystems are mounted. It must include all of the required executables and libraries required to boot the remaining filesystems. After the system is booted, all other filesystems are mounted on standard, well-defined mount points as subdirectories of the root filesystem.
/binThe /bin directory contains user executable files.
/bootContains the static bootloader and kernel executable and configuration files required to boot a Linux computer.
/devThis directory contains the device files for every hardware device attached to the system. These are not device drivers, rather they are files that represent each device on the computer and facilitate access to those devices.
/etcContains the local system configuration files for the host computer.
/homeHome directory storage for user files. Each user has a subdirectory in /home.
/libContains shared library files that are required to boot the system.
/mediaA place to mount external removable media devices such as USB thumb drives that may be connected to the host.
/mntA temporary mountpoint for regular filesystems (as in not removable media) that can be used while the administrator is repairing or working on a filesystem.
/optOptional files such as vendor supplied application programs should be located here.
/rootThis is not the root (/) filesystem. It is the home directory for the root user.
/sbinSystem binary files. These are executables used for system administration.
/tmpTemporary directory. Used by the operating system and many programs to store temporary files. Users may also store files here temporarily. Note that files stored here may be deleted at any time without prior notice.
/usrThese are shareable, read-only files, including executable binaries and libraries, man files, and other types of documentation.
/varVariable data files are stored here. This can include things like log files, MySQL, and other database files, web server data files, email inboxes, and much more.
Rajesh Kumar
Follow me
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x