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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-06-2017, 11:42 AM
|
#1
|
Member
Registered: May 2016
Distribution: MX Linux
Posts: 254
Rep: 
|
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:
or
Code:
/
/c/bin
/c/boot
/c/cdrom
/c/dev
......
......
/e/home
Is that possible?
|
|
|
07-06-2017, 12:24 PM
|
#2
|
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342
|
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.
|
|
|
07-06-2017, 02:37 PM
|
#3
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
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.
|
07-06-2017, 02:42 PM
|
#4
|
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342
|
sorry brain fart thinking fresh install - and I might even eat cake on that one ...
|
|
|
07-06-2017, 04:19 PM
|
#5
|
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,812
|
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?
|
|
|
07-06-2017, 05:41 PM
|
#6
|
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
|
It would be kind of like if each homeowner decided on his own house number. Wouldn't that be chaos.
|
|
|
07-07-2017, 06:47 AM
|
#7
|
Senior Member
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669
|
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.
Hope that helps. Good luck.
m.m.
|
|
|
07-07-2017, 07:17 AM
|
#8
|
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342
|
ha so I was right 
|
|
|
07-07-2017, 07:22 AM
|
#9
|
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,908
|
Quote:
Originally Posted by peter7089
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:
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.
|
|
|
07-07-2017, 07:37 AM
|
#10
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,940
|
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?"
|
|
|
07-07-2017, 07:58 AM
|
#11
|
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,908
|
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.
|
|
|
07-07-2017, 08:24 AM
|
#12
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,940
|
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 ..."
|
|
|
07-07-2017, 09:55 AM
|
#13
|
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342
|
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.
|
|
|
All times are GMT -5. The time now is 06:25 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|