Twitter acquired Threader! Learn more

+ Your AuthorsArchive @Foone Hardware / software necromancer, collector of Weird Stuff, maker of Death Generators. (they/them) ko-fi: Nov. 05, 2018 3 min read

Since I posted that thread about CP/M decisions from 1974 influencing Windows 10, a few people said "This is why I use Linux!"

Well, here's the problem: Linux is Unix, and Unix is older than even CP/M. There are design decisions from farther back affecting it today!

Like let's look in the root directory. There's a bunch of folders, and most of these are relatively recent additions.
But the "classic" ones are like /etc, /bin, /lib, /sbin, right?

But wait: Let's check in /usr.
And hey, /usr has a "bin", a "sbin", and a "lib".
Why are there two bins (/bin and /usr/bin), two sbins, and two libs?

So the traditional answer you get for which files go where is that /usr files are "less important" and contain stuff needed for normal functioning, but /bin, /sbin, and /lib contain files that are needed even when doing emergency maintenance.

So like, bash is in /bin and fdisk is in /sbin, but things like firefox are in /usr/bin, cause if your system is broken and you need to repair it, you definitely need bash and might need fdisk, but you're unlikely to need to go to Twitter.

But that's a retro-explanation applied later. That's not WHY there's a /usr.

To answer why we have a /usr, we have to go back to 1971, and the RK05.

See, Unix was originally developed on a PDP-7 minicomputer, starting in 1969 at Bell Labs.
They used this computer for two years.

Then in 1971 they got funding to upgrade to a PDP-11, and ported Unix to run on that. This machine was a 16-bit powerhouse with up to 56 kilobytes of ram, and cost 20,000$ in 1970. That's about 133k$ today!

And most importantly for how Linux works today: it had a lot more storage.
Bell Labs bought the PDP-11/20 with a RK11 controller (supporting up to EIGHT hard drives), and initially fitted it with two RK05 hard drives.
Each of these drives had a MASSIVE 2.5 megabytes of storage!

So originally Unix was running on the PDP-7 with one hard drive. One big partition, containing all the files.

It had directories /bin and /usr at least, and /usr was USER DIRECTORIES!

not /home (which is user directories now, if you're not a unix-er). /home came later. Originally it was /usr.

And when they upgraded to two drives on the PDP-11, they thought: hey, let's split this up logically: disk 1 is root, disk 2 is users!

so disk 1 contained /bin and other files, and disk 2 was /usr. All the users now had NEARLY INFINITE SPACE and everything was great.

Until they ran out of space on disk 1.

The OS was under active development, and all sorts of tools were being added. And they were running out of space, quickly.
RK05 hard drives were expensive, so just adding a third drive would be a pain... and /usr wasn't very full...

So they duplicated the layout of / onto disk 2: /usr/bin & /usr/lib were created. Some utilities and libraries were moved there. Which ones? Which ones would fit, mainly.

The only real limitation on what could be moved there and what couldn't is that they had to make sure not to put anything that was required for basic booting onto disk 2.
(Because if /bin/mount got moved to /usr/bin/mount, they wouldn't be able to mount disk 2)

So that pseudo-rule exists because of the chicken-and-egg problem you'd get into if important early-boot tools were on disk 2. So less important stuff ended up on disk 2, important boot stuff on disk 1.
Other than that, the only guideline for placing files was "where it'd fit"

So yeah. That decision made sometime between 1971 and 1973, to reuse /usr as a second drive of /bin & /lib (and possibly /sbin, I can't recall when that started), still echoes into modern linux.

Your brand new Ubuntu 18.10 has /bin and /usr/bin cause one specific system in 1971-1973 ran out of disk space on one of these 2.5MB fixed disk drives.

(This is the drive cartridge that goes into the RK05)

You can follow @Foone.


Tip: mention @threader on a Twitter thread with the keyword “compile” to get a link to it.

Follow Threader