Home LinuxUnderstanding the Linux /usr Merge

Understanding the Linux /usr Merge

By sk
Published: Updated: 1.2K views 4 mins read

Today, we will discuss about the "/usr merge", a filesystem reorganisation in Linux distributions where directories like /bin, /sbin, and /lib are relocated into their corresponding counterparts within /usr, with symbolic links created for backwards compatibility.

Why are Linux distributions doing this? Are there any real benefits of the /usr Merge? Let's find out

What is the /usr Merge, Anyway?

For a long time, important system files in the Linux filesystem were split between directories like /bin and /usr/bin, /sbin and /usr/sbin, /lib and /usr/lib, and /lib64 and /usr/lib64.

The /usr Merge is basically about putting all these files into just one set of folders under /usr. So, files from /bin go into /usr/bin, files from /sbin go into /usr/sbin, and so on.

Here is the visual representation of /usr merge:

Visual representation of the Linux /usr merge: Core directories like /bin, /sbin, /lib, and /lib64 are redirected to their /usr equivalents.
Visual Representation of the Linux Usr Merge

To make sure old programs and scripts still work, symbolic links (symlinks) are created. These symlinks (shortcuts) point from the old places, like /bin, to the new places, like /usr/bin.

This way, if a program looks for something in /bin, the shortcut sends it to /usr/bin where the file now lives.

Why Are Linux Distributions Merging /usr?

This change might seem small, but it helps in several important ways.

1. Better Compatibility

Different versions of Unix or Linux distributions sometimes put the same programs in slightly different places. The /usr Merge helps make these locations the same by having programs available in both the old and new spots thanks to the symlinks.

This means scripts written for one Linux system might just work on another without needing changes, making things more compatible.

This merge has already been completed in some systems. Fedora 17 successfully implemented this feature. Oracle Solaris also implemented the core part of the merge about 15 years ago and completed it with the introduction of Solaris 11.

2. Less Mess, More Simple

Having files spread across many top-level folders and duplicated in /usr makes things more complex than needed. The merge cleans up the file system layout, making it easier to understand where the main parts of the operating system are kept.

3. Easier for Developers

Developers often use tools that don't expect programs to be split between /bin and /usr/bin. The merge makes it simpler for them to build software for Linux.

It also helps Linux systems stay closer to how software is being built by developers everywhere.

4. New Cool Features

Putting most of the Linux operating system's parts into one main folder (/usr) allows for some neat tricks. For example, it makes it easier to:

  • Share the Linux system files between different computers over a network or with lightweight 'guest' systems running on one computer. This means less data is needed on each individual computer.
  • Take snapshots of the entire operating system easily and reliably.
  • Make the important operating system files read-only. This can make the system safer and more stable. In fact, a big reason for the merge is to make having a read-only /usr work even better than before.

Clearing Up Confusion

There were old reasons for splitting files like this, mainly related to using different hard drives with different speeds. But those reasons don't apply much anymore because of how modern systems start up.

Some people worried the merge would break things or make them less compatible, but the opposite is true. It increases compatibility and is supported even with old setups like having /usr on a separate drive.

It's also not a new idea just for one Linux system; others have been doing it or moving towards it.

Even getting this change done can be tricky! For example, the Solus Linux team shared their experience trying the merge. They faced challenges making sure all the necessary updates happened in the right order, calling it a "Chicken and Egg problem".

They had to come up with clever new ways using special 'marker files' and scripts that run when the computer starts to make sure the merge happens safely and correctly for everyone.

This shows that while the idea is simple, the process can take careful planning!

TL;DR

/Usr Merge is the unification of core system directories within the /usr file hierarchy in Linux and other Unix-like systems.

This involves merging the contents of /bin, /sbin, /lib, and /lib64 into their respective counterparts in /usr (i.e., /usr/bin, /usr/sbin, /usr/lib, and /usr/lib64), and replacing the original directories with symbolic links pointing to the new locations in /usr.

The primary motivation for the /usr merge is to improve compatibility and reduce system complexity.

Fedora has successfully implemented this feature in version 17 and even other systems like Oracle Solaris have done this kind of merge.

It's not just limited to Fedora and Solaris. Multiple other Linux distributions have been "working in a similar direction" and are "in the process to implement the /usr merge".

Conclusion

The /usr merge makes Linux filesystem hierarchy easier to understand by organizing files in a more consistent way. It helps systems work better together, simplifies development, and supports new features like better security and easier file sharing.

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More