LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 09-24-2014, 12:02 PM   #1
DamnitBoy
LQ Newbie
 
Registered: Sep 2014
Posts: 4

Rep: Reputation: Disabled
Mounting & Partitioning Inquiry


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!
 
Old 09-24-2014, 12:12 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,454

Rep: Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052Reputation: 2052
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 12:13 PM.
 
1 members found this post helpful.
Old 09-24-2014, 12:15 PM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,688

Rep: Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259
No.

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.

Last edited by jpollard; 09-24-2014 at 12:17 PM.
 
1 members found this post helpful.
Old 09-24-2014, 12:17 PM   #4
DamnitBoy
LQ Newbie
 
Registered: Sep 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks so much SuicidalEggroll! This perfectly explains it!
 
Old 09-24-2014, 12:20 PM   #5
DamnitBoy
LQ Newbie
 
Registered: Sep 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks jpollard!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inquiry:Problem on mounting CDROM hadimotamedi Linux - Newbie 1 09-13-2009 05:57 AM
Partitioning and mounting using commandline johnnybhoy67 Linux - General 1 10-14-2005 07:39 AM
Partitioning and mounting Tinku *BSD 5 09-11-2005 11:01 AM
Need help partitioning and mounting my second hd Acid-Face Linux - Newbie 2 10-18-2004 03:08 PM
Multiple LUN support & need scsi inquiry command... mvega Linux - Newbie 2 09-23-2003 05:48 PM


All times are GMT -5. The time now is 08:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration