2.3. File System Layout

Red Hat Enterprise Linux 7 introduces two major changes to the layout of the file system.
  • The /bin, /sbin, /lib and /lib64 directories are now under the /usr directory.
  • The /tmp directory can now be used as a temporary file storage system (tmpfs).
  • The /run directory is now used as a temporary file storage system (tmpfs). Applications can now use /run the same way they use the /var/run directory.

2.3.1. New layout for root file system

Traditionally, only the minimum necessary content was included in the /bin and /lib directories to avoid slowing down the boot process. Some of the utilities needed to be at the root (/) level in order to mount the /usr partition. This created a situation where other utilities spread their content over multiple levels of directories, for example, in both /bin and /usr/bin.
Red Hat Enterprise Linux 7 moves the /bin, /sbin, /lib and /lib64 directories into /usr. Because the /usr file system can now be mounted by initramfs rather than by utilities in root level directories, there is no longer a need to split package contents between the two different directory levels. This allows for a much smaller root file system, enabling systems that can more efficiently share disk space, and systems that are easier to maintain, more flexible, and more secure.
To lessen the impact of this change, the previous /bin directory is now a symbolic link to /usr/bin, /sbin to /usr/sbin, and so on.

2.3.1.1. Preparing your file system for upgrade

Warning

Note, that if /usr is on a separate partition, the in-place upgrade is not possible. If you decide to move the /usr from the separate partition, be aware that this is at your own risk.
If /var is on a separate partition, you must manually convert /var/run and /var/lock to symbolic links:
# mv -f /var/run /var/run.runmove~
# ln -sfn /run /var/run
# mv -f /var/lock /var/lock.lockmove~
# ln -sfn /run/lock /var/lock

Important

You must make sure you address all preupgrade-assistant results regarding partitioning scheme.
When your preparations are complete, see the Red Hat Enterprise Linux 7 Installation Guide for additional details on performing the upgrade process.

2.3.1.2. Verifying a successful upgrade

After performing the upgrade process, it is important to verify that the upgrade worked as expected.
  1. Check that the following symbolic links exist:
    • /bin is a symbolic link to /usr/bin
    • /sbin is a symbolic link to /usr/sbin
    • /lib is a symbolic link to /usr/lib
    • /lib64 is a symbolic link to /usr/lib64
    • /var/run is a symbolic link to /run
    • /var/lock is a symbolic link to /run/lock
    If the directories listed are symbolic links, as expected, two more checks are required.
  2. Check the output of the following find command:
    # find /usr/{lib,lib64,bin,sbin} -name '.usrmove'
    Files or directories displayed in response to this command could not be copied to /usr because a file or directory with the same name was already present in /usr. You will need to manually resolve these naming conflicts.
  3. Check the following directories for files that you want to keep:
    • /var/run.runmove~
    • /var/lock.lockmove~
If any of the directories listed are not symbolic links, you will need to follow the recovery process outlined in Section 2.3.1.3, “Recovering from a failed upgrade”.

2.3.1.3. Recovering from a failed upgrade

The upgrade process may fail for a number of reasons. Check the output of the following commands to see what went wrong:
# dmesg
# journalctl -ab --full
If no errors are visible, check that:
  • / is writable
  • /usr is writable
  • /usr mounted correctly
  • / has sufficient space
  • /usr has sufficient space
  • /var is mounted in the rhelup tool
Contact Red Hat Support if you need further assistance.

2.3.2. Changes to the /tmp directory

Red Hat Enterprise Linux 7 offers the ability to use /tmp as a mount point for a temporary file storage system (tmpfs).
When enabled, this temporary storage appears as a mounted file system, but stores its content in volatile memory instead of on a persistent storage device. No files in /tmp are stored on the hard drive except when memory is low, in which case swap space is used. This means that the contents of /tmp are not persisted across a reboot.
To enable this feature, execute the following command:
# systemctl enable tmp.mount
To disable this feature, execute the following command:
# systemctl disable tmp.mount
Red Hat recommends the following uses for the various types of temporary storage space in Red Hat Enterprise Linux 7.
  • Privileged processes, such as daemons, should use /run/processname to store temporary data.
  • Processes that store a large amount of data, or require temporary data to persist across reboots, should use /var/tmp.
  • All other processes should use /tmp to store temporary data.

2.3.3. Changes to the /run directory

Important

Preupgrade Assistant did not yet check for the effects of this change in the initial release of Red Hat Enterprise Linux 7.0. This issue was corrected in RHBA-2014:1627, available here: https://rhn.redhat.com/errata/RHBA-2014-1627.html.
Previous versions of Red Hat Enterprise Linux allowed some programs to store runtime data in the /dev directory during early boot, prior to the /var directory being mounted. Consensus between major Linux distributions is that /run should be used instead, as the /dev directory should be used only for device nodes.
Therefore, in Red Hat Enterprise Linux 7, the /run directory is a temporary file storage system (tmpfs) that bind mounts the /var/run directory. Likewise, the /run/lock directory now bind mounts the /var/lock directory. Files stored in /run and /run/lock are no longer persistent and do not survive a reboot. This means that applications must recreate their own files and directories on startup, rather than doing this once at installation time. An /etc/app_name directory would be ideal for this.
For details on how to recreate files and directories at startup, see the tmpfiles.d man page: man tmpfiles.d. For example configuration, see the configuration files in /etc/tmpfiles.d.