Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I've just started getting my feet wet with Linux and I've run across one question I haven't been able to find the answer to. I'm sure it's an easy answer, but I've had trouble posing the question on search utilities to find the right answer. So, here it goes...
If I have one physical disk for my Linux machine, and I create two partitions on it, and mount them to / and /home, wouldn't the partition that is mounted to / also contain the files that are in /home even though /home is mounted on a different partition? I'm assuming this because / is the base directory that includes /home, so I figured anything under / would show up on that partition. The only thing I can think of that would make this a no, is that if the system sees anything mounted to a directory that's already part of / (in this case /home), then it would use the partition that's mounted to /home instead of the one that's mounted to /.
Sorry if I haven't expressed this question in a coherent manner, and thanks in advance for your help!
Everything placed in /home or its subdirectories will go on the /home partition
Everything placed outside of /home will go on the / partition
/, and its partition, does have a "home" directory, but theoretically it will be empty as it's just being used as a mount point. If it's not empty, then any files/dirs inside will be "covered up" by your second partition as soon as you mount it in /home.
You can think of it like this. Any time you create a file or directory somewhere on the filesystem, the system will step up through parent directories until it hits a mount point, and that's the drive it goes on.
Last edited by suicidaleggroll; 09-24-2014 at 01:13 PM.
The mountpoint is "/home", and that redirects file requests to the partition identified by that name.
Within the kernel, a generic description of what happens is:
1. root gets mounted.
2. The directory /home gets loaded into cache. Initially the directory points to data structures on the disk partition and filesystem of the root. The cache holds the information in two parts - to top half maintains the link to the parent directory. The lower half contains the pointers to the associated partition and directory inode...
3. When the mount of the second partition is done, the lower half of the mount point is replaced with the information from partition, and the file inode for the root directory of the filesystem on the partition. The original contents are still in memory, but are not used anymore.
When a file operation occurs, the kernel starts scanning from the root directory by looking at the lower half of the mount (where it finds the reference to the home directory). When it reaches the home directory it looks at its lower half, which now points to a different partition, and potentially a different kind of filesystem. The link to the root directory of that lower half is then used (as it has replaced the original references) to continue the search.
Note: this is severely abbreviated, but is a reasonable model for what really happens.