This was a question I saw on the linux4noobs sub-reddit on Reddit.com and i thought the question and answer would be of interest to Berkeley LUG.
Q: I am reading about disk partitioning and realized I don’t understand something I thought was very simple. This guide I am reading goes into detail about how /boot and /home should be on “separate partitions”. I know when I’ve installed linux multiple times I’ve had to “partition” the hard disk with a primary and a swap, and the ex4 filesystem gets written within that primary partition. Doesn’t the entire file system, including /boot and /home, reside on the primary partition I’ve formatted as ext4? Are these really separate partitions, or are they just different folders under / (root)?
Everything I know is a lie
A: The directory structure is kind of an abstraction.
It is a tree that lives under “root” or “/” and branches from there as sub directories.
Except, not quite. Partitions are kinda pinned (Mounted) to a branch node (mountpoint) of this tree. Then the sub directories from there are read out of the filesystem of the partition.
It all has to start with something mounted at / But from there on different partitions can be mounted at different points in the root filesystem.
So an example:
I have a partition sdb1 This is the partition supposed to be /home.
So inside we have directories for users, /tom, /dick, and /harry And each have the usual subdirectories like /Desktop, /Documents, /Videos etc
So we have sda1 mounted at / and it has everything in it. It has /home and had a user sally, so we find the directory /home/sally in there.
Ok now we mount sdb1 on /home. What happens?
The file tree starts at / which is sda1 and follows around insde sda1 until you hit /home where we jump over to sdb1 because it is mounted there (it is pinned to that branch)
So we get /home/tom and /home/dick and /home/harry because /tom /dick /harry are in the root directory of sdb1
And /home/sally is not there because it is in sda1 and after we get to /home (the mountpoint of sdb1) the tree traverses sdb1 instead.
The example was to show what happens, but normally you set things all up in the beginning and you don’t have sally go missing.
And creating and deleting would happen in the partition that is mounted there. So if Sally comes up and “hey I need an account!!!” creating /home/sally would make the directory /sally in sdb1.
Why?
Well It is kind of nice having all files in the same structure instead of the C: D: X: Y: Z: as in windows.
The whole /boot /home on separate partitions thing. (I may get jumped on for this — some people are very passionate on this topic) The idea is to have the greatest likelyhood of a workable computer when things go wrong. Like you do something stupid and mess up, Then you still have something working enough you can get in and fix it. Or that your personal files are on another partition and so protected.
Nowadays, The Ubuntu way is common: one big partition mounted on /
And If things go wrong you just boot a linux live and fix there
We meet on the second and fourth Sundays of each month in Berkeley near the Downtown Berkeley BART station. We hope you join us at Bobby G’s Pizzeria.