Both sides previous revision
Previous revision
Next revision
|
Previous revision
Next revision
Both sides next revision
|
linux_wiki:file_system_hierarchy [2015/11/17 22:53] billdozor [Top Level Directories] |
linux_wiki:file_system_hierarchy [2015/11/17 23:09] billdozor |
^ Directory ^ Used For ^ | ^ Directory ^ Used For ^ |
| / | Root directory; file system tree starts here | | | / | Root directory; file system tree starts here | |
| /bin | Executable programs needed to repair system; essential during boot; EL7 symlinks /bin -> /usr/bin | | | /bin | Executable programs needed to repair system; essential during boot; \\ EL7 symlinks /bin -> /usr/bin | |
| /boot | All files needed to boot the Linux kernel | | | /boot | All files needed to boot the Linux kernel | |
| /dev | Special/device files; refer to physical device | | | /dev | Special/device files; refer to physical device | |
| /etc | "etcetera"; configuration files local to the system | | | /etc | "etcetera"; configuration files local to the system | |
| /home | User local home directories | | | /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 | | | /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 | | | /media and /mnt | Mount points for removable media and temporary file systems respectively | |
| /opt | Add on or optional packages | | | /opt | Add on or optional packages | |
| /root | Home directory for the root user | | | /root | Home directory for the root user | |
| /run | Process/user specific info created since last boot | | | /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 | | | /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) | | | /srv | Directory to use for data used by services (such as NFS, FTP, HTTP) | |
| /sys | To interface with hardware devices managed by the kernel | | | /sys | To interface with hardware devices managed by the kernel | |
====== Common Directories with Own Partition ====== | ====== Common Directories with Own Partition ====== |
| |
It is common to separate the following directories onto their own mount point/partition: | It is common to mount the following directories onto their own partition: |
| |
* / => isolate the core OS away from the rest of the system. | ^ Directory ^ Reason ^ |
* /boot => isolate kernel boot images, cannot be LVM. | | / | isolate the core OS away from the rest of the system | |
* /home => in order to isolate user data from the rest of the system. | | /boot | isolate kernel boot images, cannot be LVM | |
* /tmp => isolate world writeable /tmp to give more secure mount options. | | /home | isolate user data from the rest of the system; usually to allocate more storage space and preserve user data during upgrades | |
* /var => isolate other variable data that could grow from affecting the rest of the system. (yum cache, common place for applications to write to) | | /tmp | isolate world writeable /tmp to give more secure mount options | |
* /var/log => prevent run away log files from affecting the rest of the system. | | /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. |
| |
| ---- |
| |
| ===== Find Mounts ===== |
| |
| The "findmnt" command shows a tree like mount structure. |
| |
| <code bash> |
| [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 |
| </code> |
| |
| ---- |
| |
| ===== Mount ===== |
| |
| The "mount" command showing only xfs and ext4 file system types (-t xfs,ext4) |
| |
| <code bash> |
| [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) |
| </code> |
| |
| ---- |
| |
| ===== df ===== |
| |
| "df" command with human readable (-h) and print file system type (-T): |
| <code bash> |
| [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 |
| </code> |