linux_wiki:file_system_hierarchy

This is an old revision of the document!


File System Hierarchy

General Information

Some of the most common top level directories in the Linux file system.

Sources


Top Level Directories

EL7 = Enterprise Linux 7 (Red Hat, CentOS, Scientific)

Directory Used For
/ Root directory; file system tree starts here
/bin Executable programs needed to repair system; essential during boot;
EL7 symlinks /bin → /usr/bin
/boot All files needed to boot the Linux kernel
/dev Special/device files; refer to physical device
/etc “etcetera”; configuration files local to the system
/home User local home directories
/lib and /lib64 Shared libraries used by programs in /boot,/bin, /sbin;
EL7 symlinks /lib → /usr/lib and /lib64 → /usr/lib64
/media and /mnt Mount points for removable media and temporary file systems respectively
/opt Add on or optional packages
/proc Pseudo-filesystem that provides information on running processes and the kernel
/root Home directory for the root user
/run Process/user specific info created since last boot
/sbin Similar to /bin, except for system administration not used by regular users;
EL7 symlinks /sbin → /usr/sbin
/srv Directory to use for data used by services (such as NFS, FTP, HTTP)
/sys To interface with hardware devices managed by the kernel
/tmp Temporary files that could be deleted without warning during boot
/usr Directory containing sub directories with program files, libraries, and documentation. Typically mimics the contents of /. Not required during boot.
/var Files that can change dynamically (log files, mail, and spool files)

Common Directories with Own Partition

It is common to mount the following directories onto their own partition:

Directory Reason
/ isolate the core OS away from the rest of the system
/boot isolate kernel boot images, cannot be LVM
/home isolate user data from the rest of the system; usually to allocate more storage space and preserve user data during upgrades
/tmp isolate world writeable /tmp to give more secure mount options
/var isolate other variable data that could grow from affecting the rest of the system. (yum cache, common place for applications to write to)
/var/log prevent run away log files from affecting the rest of the system

View Mounts

Different ways to see file system mounts.


The “findmnt” command shows a tree like mount structure.

[root@srv01 ~]# findmnt
TARGET                           SOURCE                                FSTYPE     OPTIONS
/                                /dev/mapper/vgroot-lvroot             xfs        rw,relatime,attr2,inode64,noquota
├─/proc                          proc                                  proc       rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc     systemd-1                             autofs     rw,relatime,fd=40,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
├─/sys                           sysfs                                 sysfs      rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/security         securityfs                            securityfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup               tmpfs                                 tmpfs      rw,nosuid,nodev,noexec,mode=755
│ │ ├─/sys/fs/cgroup/systemd     cgroup                                cgroup     rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd
│ │ ├─/sys/fs/cgroup/cpuset      cgroup                                cgroup     rw,nosuid,nodev,noexec,relatime,cpuset
│ │ ├─/sys/fs/cgroup/cpu,cpuacct cgroup                                cgroup     rw,nosuid,nodev,noexec,relatime,cpuacct,cpu
│ │ ├─/sys/fs/cgroup/memory      cgroup                                cgroup     rw,nosuid,nodev,noexec,relatime,memory
│ │ ├─/sys/fs/cgroup/devices     cgroup                                cgroup     rw,nosuid,nodev,noexec,relatime,devices
│ │ ├─/sys/fs/cgroup/freezer     cgroup                                cgroup     rw,nosuid,nodev,noexec,relatime,freezer
│ │ ├─/sys/fs/cgroup/net_cls     cgroup                                cgroup     rw,nosuid,nodev,noexec,relatime,net_cls
│ │ ├─/sys/fs/cgroup/blkio       cgroup                                cgroup     rw,nosuid,nodev,noexec,relatime,blkio
│ │ ├─/sys/fs/cgroup/perf_event  cgroup                                cgroup     rw,nosuid,nodev,noexec,relatime,perf_event
│ │ └─/sys/fs/cgroup/hugetlb     cgroup                                cgroup     rw,nosuid,nodev,noexec,relatime,hugetlb
│ ├─/sys/fs/pstore               pstore                                pstore     rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/config           configfs                              configfs   rw,relatime
│ └─/sys/kernel/debug            debugfs                               debugfs    rw,relatime
├─/dev                           devtmpfs                              devtmpfs   rw,nosuid,size=1829904k,nr_inodes=457476,mode=755
│ ├─/dev/shm                     tmpfs                                 tmpfs      rw,nosuid,nodev
│ ├─/dev/pts                     devpts                                devpts     rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
│ ├─/dev/mqueue                  mqueue                                mqueue     rw,relatime
│ └─/dev/hugepages               hugetlbfs                             hugetlbfs  rw,relatime
├─/run                           tmpfs                                 tmpfs      rw,nosuid,nodev,mode=755
├─/mnt/redusb                    /dev/mapper/vgredusb-lvredbackups     ext4       rw,relatime,data=ordered
├─/mnt/blackusb                  /dev/mapper/vgblackusb-lvblackbackups ext4       rw,relatime,data=ordered
├─/boot                          /dev/sda1                             xfs        rw,relatime,attr2,inode64,noquota
├─/tmp                           /dev/mapper/vgroot-lvtmp              xfs        rw,relatime,attr2,inode64,noquota
├─/home                          /dev/mapper/vgroot-lvhome             xfs        rw,relatime,attr2,inode64,noquota
└─/var                           /dev/mapper/vgroot-lvvar              xfs        rw,relatime,attr2,inode64,noquota

The “mount” command showing only xfs and ext4 file system types (-t xfs,ext4)

[root@srv01 ~]# mount -t xfs,ext4
/dev/mapper/vgroot-lvroot on / type xfs (rw,relatime,attr2,inode64,noquota)
/dev/mapper/vgblackusb-lvblackbackups on /mnt/blackusb type ext4 (rw,relatime,data=ordered)
/dev/mapper/vgredusb-lvredbackups on /mnt/redusb type ext4 (rw,relatime,data=ordered)
/dev/mapper/vgroot-lvtmp on /tmp type xfs (rw,relatime,attr2,inode64,noquota)
/dev/mapper/vgroot-lvhome on /home type xfs (rw,relatime,attr2,inode64,noquota)
/dev/mapper/vgroot-lvvar on /var type xfs (rw,relatime,attr2,inode64,noquota)
/dev/sda1 on /boot type xfs (rw,relatime,attr2,inode64,noquota)

“df” command with human readable (-h) and print file system type (-T):

[root@srv01 ~]# df -hT
Filesystem                            Type      Size  Used Avail Use% Mounted on
/dev/mapper/vgroot-lvroot             xfs        30G  1.9G   29G   7% /
devtmpfs                              devtmpfs  1.8G     0  1.8G   0% /dev
tmpfs                                 tmpfs     1.8G     0  1.8G   0% /dev/shm
tmpfs                                 tmpfs     1.8G  8.6M  1.8G   1% /run
tmpfs                                 tmpfs     1.8G     0  1.8G   0% /sys/fs/cgroup
/dev/mapper/vgblackusb-lvblackbackups ext4       99G   65G   29G  70% /mnt/blackusb
/dev/mapper/vgredusb-lvredbackups     ext4       99G   66G   28G  71% /mnt/redusb
/dev/mapper/vgroot-lvtmp              xfs       8.0G   33M  8.0G   1% /tmp
/dev/mapper/vgroot-lvhome             xfs       100G   65G   36G  65% /home
/dev/mapper/vgroot-lvvar              xfs       8.0G  527M  7.5G   7% /var
/dev/sda1                             xfs       247M  164M   83M  67% /boot
  • linux_wiki/file_system_hierarchy.1447819767.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)