4

This systemd wiki page about the /usr merge, under Myth #6, states that /bin has traditionally been a symlink to /usr/bin on System V UNIX.

What is the motivation for this? For backwards compatibility it makes sense, but I don't understand why it was like this in the early days. (Or, am I misunderstanding? Did early UNIX versions distinguish between /bin and /usr/bin, and System V changed that by merging them?)

8

The short answers are, yes, it was done for compatibility (lots of programs referenced /bin/sh and /bin/ed), and in the early days /bin and /usr/bin contained totally disjoint sets of files. /bin was on the root filesystem, a small disk that the computer's boot firmware had to be able to access, and held the more critical and often-used files. /usr/bin was on /usr, typically an entirely separate, larger disk. /usr, at first, also contained users' home directories. As /usr grew, we would periodically replace its drive with something larger. The system could run with no /usr mounted, even if wasn't all that useful.

/usr's disk (or disk partition) was mounted after the Unix kernel had been booted and the system was partway through the user-mode boot process (/etc/rc), so programs like sh and mount and fsck had to be in the root filesystem, generally in /bin and /etc. Sun had even rearranged / and /usr so that a shared copy of /usr could be mounted read-only across a network. /usr/tmp became a symlink to /var/tmp. /var was either on the root filesystem or, preferably, on another partition.

I believe it was Sun that decided, at one point, that it wasn't worth heroically trying to have a system be able to come up if its /usr was trashed. Most users either had / and /usr on the same physical disk - so if it died, both filesystems were toast - or had /usr mounted read-only from a server. So some critical programs used for system boot and maintenance were compiled statically and put in /sbin, but most of the programs in /bin were moved to /usr/bin and /bin became a symlink to /usr/bin.

System V prior to R4 didn't even have symlinks. Sun and AT&T worked to combine SunOS and SVR3, and that became SVR4 (and Solaris 2). It had /bin as a symlink to /usr/bin.

So when that web site says "On SysV Unix /bin traditionally has been a symlink to /usr/bin", they really should have said "On System V Release 4 and followons, ...".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.