LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 07-06-2017, 11:42 AM   #1
peter7089
Member
 
Registered: May 2016
Posts: 72

Rep: Reputation: Disabled
Mounting directories under '/' to different mount points?


I want to create two directories under '/' - 'e' and 'c'. Under 'c' i want to mount all directories except 'home, and under 'e' i want to mount 'home' directory. So, i want my root directoy to look like this:

Code:
/
/c
/e
or

Code:
/
/c/bin
/c/boot
/c/cdrom
/c/dev
......
......
/e/home
Is that possible?
 
Old 07-06-2017, 12:24 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,146

Rep: Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949
is this to mimic Windows?

and yes it can be done,

you got a figure out partitions, and mount points, and maybe even bind if you want everything mounted separately.

which is not necessarily needed, in linux it mounts / (root) which is everything on one partition. Like in Windows everything gets C drive and then we have what is called the 'tree' with all of its 'branches that have leafs'. Windows got that too.

which would look like this
Code:
C would be
sda1 / (with everything system side on it)
D or E would be this
sda2 /home (everything users stuff side)

Last edited by BW-userx; 07-06-2017 at 12:32 PM.
 
Old 07-06-2017, 02:37 PM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2134Reputation: 2134Reputation: 2134Reputation: 2134Reputation: 2134Reputation: 2134Reputation: 2134Reputation: 2134Reputation: 2134Reputation: 2134Reputation: 2134
No, you can't do that. While you could mount a drive at /c/, and move all of your /etc, /var, etc directories into it, it'll all come crashing down as soon as an application tries to access something in its normal location, since it's no longer there. You could symlink these directories back into place, so /etc is actually a symlink that points to /c/etc, for example, but you'll never be able to get an ls of / to look like what you posted. It would have /c, /e, as well as symlinks or bind mounts or something similar for all of the other directories that are supposed to be there.

I think we should back up a bit and re-visit what you're actually trying to accomplish and why. I imagine, whatever it is, that there is a much MUCH better way of going about it.

Last edited by suicidaleggroll; 07-06-2017 at 02:38 PM.
 
1 members found this post helpful.
Old 07-06-2017, 02:42 PM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,146

Rep: Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949
sorry brain fart thinking fresh install - and I might even eat cake on that one ...
 
Old 07-06-2017, 04:19 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,298

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Directories /etc and /usr are examples of directories that either need to part of the root filesystem or have arrangements to be mounted early in the boot process when the root filesystem gets mounted. In modern systems, /dev is a special type of tmpfs and only the mount point directory exists on disk. The point of moving that mount point, or other mount points like the one for cdrom, escapes me.

Yes it can be done, given enough time and effort. But other than making life difficult for yourself, just what are you trying to accomplish?
 
Old 07-06-2017, 05:41 PM   #6
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004
It would be kind of like if each homeowner decided on his own house number. Wouldn't that be chaos.
 
Old 07-07-2017, 06:47 AM   #7
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,667

Rep: Reputation: 494Reputation: 494Reputation: 494Reputation: 494Reputation: 494
Quote:
Is that possible?
Yes. Just define your mode of mounting the "/" to "/c", modify it in many ways "--remount", "--make-shared", "--make-slave", etc. and this works for any purpose, except... do not boot into the secondary mount-point of "/" (viz-- /c ) as things can go awry as warned above by suicidaleggroll, if you want to boot into it use "--bind" switch.
Code:
man mount
Hope that helps. Good luck.

m.m.
 
Old 07-07-2017, 07:17 AM   #8
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,146

Rep: Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949
ha so I was right
 
Old 07-07-2017, 07:22 AM   #9
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,843

Rep: Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472
Quote:
Originally Posted by peter7089 View Post
I want to create two directories under '/' - 'e' and 'c'. Under 'c' i want to mount all directories except 'home, and under 'e' i want to mount 'home' directory. So, i want my root directoy to look like this:

Code:
/
/c
/e
or

Code:
/
/c/bin
/c/boot
/c/cdrom
/c/dev
......
......
/e/home
Is that possible?
You can do that...

1. If you are willing to break all support updates for your system
2. If you are willing to lose the ability to boot.

It can work...
If you are doing your own distribution (good luck with getting help)

Rather than doing that, you could set up a chroot jail environment that is set up that way.

This isolates your environment from that which is supportable. When you have realized that you will have to rebuild every application to run with that environment you can easily revert to a working environment.
 
Old 07-07-2017, 07:37 AM   #10
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,055
Blog Entries: 13

Rep: Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503
I agree with the thoughts that just because a thing is possible, does not mean it is worthy.

There used to be a rotate root concept, either specific to one distribution or a general thing, but I cannot find any references. Either case this was during startup and it was necessary to remap the specific physical resource to become root, thereupon root would still be named "/".

Meanwhile I agree that you can remount and have in fact done a remount of "/" unintentionally; such as I was trying to remount /tmp, /var, and /log but mis-typed the command. The end result was no prompt and slowly repeating complaints that something was inaccessible or not found. At that point I looked at my last typed command and realized I had obliterated the path to my RFS. Thankfully things like mounts are ephemeral things and a reboot took care of it ... excepting the various things I had open and unsaved.

Which brings this back to BW-userx's question in post #2, "Why do you want to do this?"
 
Old 07-07-2017, 07:58 AM   #11
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,843

Rep: Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472
What you are thinking of is called "pivot_root".

It is used during boot to exchange the root mount from being the ramfs from the initrd to the identified real root filesystem; just before releasing the memory occupied by the ramfs.

The expectation is that the directory structure beneath that mount point will still permit the identification of init (expected to be in /sbin/init). So to change that you also have to change the initrd...

That is why my objections to this useless change exist.

The applications used during boot are expected to be in /bin, /sbin, and the configuration files to be in /etc. So that requires even more changes - and changes to the binaries to change their use of /etc at a minimum. Then you have to include in that rebuild udev (it expects things in /etc for configuration, and /dev; changing the configuration also requires rewriting all the udev rules).

Changing all of that will tend to require rebuilding the initrd in the same way.

And changing the location of init also means you have change the kernels reference to init - so you have to rebuild the kernel as well.

Then there is everything that refers to network configuration... and don't forget login.

Then there is all the programming support documentation and tools, along with changing many of the include files because they also contain some configuration references like the terminfo tables, man page references, /var,/proc,/dev,/tmp,/etc references...

At this point, you have your own distribution, incompatible with any other software too.
 
Old 07-07-2017, 08:24 AM   #12
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,055
Blog Entries: 13

Rep: Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503Reputation: 3503
Yes, thank you for the memory assist jpollard. It has been years with that one for me.

And for many of the reasons you cite is why I totally agree. Things like ls, cd, cat, more, ps, ... all that stuff, many are located in the /bin, /sbin, or other similar directories and once you rip / away, it all is not longer capable of being referenced. Hence my former experience of the machine doing the equivalent of "Uh ... Uh ..."
 
Old 07-07-2017, 09:55 AM   #13
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,146

Rep: Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949
there is a Linux distro out there that I seen on distrowatch a while back that puts just about everything into one pile (directory) so one does not have to go looking for it in separate directories.
 
  


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
udev rules for mounting usb to custom mount points Gil@LQ Linux - Software 3 10-30-2014 08:54 PM
[SOLVED] Mounting 2 identical USB drives to different mount points darkduck Linux - Newbie 6 05-12-2014 05:11 PM
[SOLVED] Inconsistent Time Stamping for Partitions or Mount Points and Directories Hi_This_is_Dev Linux - Server 3 09-06-2010 12:19 PM
[SOLVED] directories, file systems, and mount points hbackus Linux - Newbie 2 04-30-2010 02:55 PM
Mounting new HD space into existing mount points? GT_Onizuka Linux - Hardware 4 05-26-2004 05:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:28 PM.

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