LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 12-04-2013, 02:14 AM   #1
TJen
LQ Newbie
 
Registered: Dec 2013
Posts: 2

Rep: Reputation: Disabled
Is it possible to have multiple root directories?


Hi.

I'm a long time windows user who's trying to get into linux.

In windows, I'm used to having all the harddisks\partitions as separate root drives, meaning that the D-drive is a completely separate files system.

Is it possible to get something like that in Linux?
If I've understood thngs correctly, when you mount a new harddisk in linux ypu mount it to a new\existing directory inside the existing file-system, meaning that the harddisk shows up as just another directory alongside all the other directories in root directory.
Is it possible to instead mount it as a completely separate root directory with nothing in it or besides it?
 
Old 12-04-2013, 02:26 AM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,270
Blog Entries: 1

Rep: Reputation: 2304Reputation: 2304Reputation: 2304Reputation: 2304Reputation: 2304Reputation: 2304Reputation: 2304Reputation: 2304Reputation: 2304Reputation: 2304Reputation: 2304
If I understand you correctly, no.

Every mounted device is visible within the root filesystem.
 
Old 12-04-2013, 02:32 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389
Quote:
Originally Posted by TJen View Post
I'm a long time windows user who's trying to get into linux.

In windows, I'm used to having all the harddisks\partitions as separate root drives, meaning that the D-drive is a completely separate files system.
First of all: Windows and Linux work differently. However, some concept are the same, although they might have different names in either of the OS.

In Windows you talk about C, D Drives. Which are partitions with their own file-system (fat32, ntfs, etc)
On Linux you talk about partitions, which also have their own file-system (ext4, reiserfs, etc)

Quote:
Is it possible to get something like that in Linux?
If I've understood thngs correctly, when you mount a new harddisk in linux ypu mount it to a new\existing directory inside the existing file-system, meaning that the harddisk shows up as just another directory alongside all the other directories in root directory.
Is it possible to instead mount it as a completely separate root directory with nothing in it or besides it?
Nope, the root directory (/) is the starting point. All partitions (and external drives) are mounted under root.

Why would you want to do this?
 
Old 12-04-2013, 04:19 AM   #4
s.verma
Member
 
Registered: Oct 2013
Distribution: Debian Sid, Gentoo, Arch, Debian
Posts: 169
Blog Entries: 4

Rep: Reputation: 24
It is by design of unix and unix like filesystem that every partition, devices etc. are visible in its only one root filesystem.

In unix, since everything is considered as file, so there is no way to treat partition as different root filesystem, since partition would be considered as a file too. Hence this file will be in some folder.
 
Old 12-04-2013, 05:18 AM   #5
TJen
LQ Newbie
 
Registered: Dec 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks. I didn't really think it was possible, but I figured it was worth a shot asking at least.

The reason I want this is because I'm the the type that likes to havee the actual Os completely separated form the actual data\entertainment files on my system. The only thing I have om my C-disk is windows. All games, movies, music and similar files I have on a different hard disk. And I'm weird enoungh that I've even made a symbolic link from the common-folder in steam to my games folder to make sure that all games are installed to only one location on my system.

As an alternativ, is it possible to install the linux system to a subfolder in the root?
What I'm thinking is to maybe set it up so that the only folders\files that exist on the actual root is the mount points for the harddisks, and then installing the system to one of those mount points instead of directly to the root. Would something like that be possible?
 
Old 12-04-2013, 05:40 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389
You should let go of the Windows way of thinking.

Assuming 2 hd's, both with one partition: 1 hd (partition) will be used for the OS and the other hd (partition) for "data". This separates both data and the OS.

The data partition has to be mounted under the root partition to make it accessible under Linux/Unix.

If, for example, you want to reinstall the OS you can do so without any concern for the data partition. Once the OS is installed you mount the data partition and all will be available again.
 
Old 12-04-2013, 05:57 AM   #7
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,061

Rep: Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893
Quote:
Originally Posted by TJen View Post
The reason I want this is because I'm the the type that likes to havee the actual Os completely separated form the actual data\entertainment files on my system.
Well, that's possible, even if you are asking the wrong questions to get there...
  • (and this makes sense for other reasons) You can have your 'home' directory off on another partition from the partition(s) on which the OS resides. this separates all of your own data (your data that you have explicitly created, as well as data that you have implicitly created, such as configurations for programs and applications) from the OS and its programs and configurations. It may be too soon to talk of this, but this, amongst other things, simplifies matters when it comes to OS upgrades and re-installs.
  • In fact, more generally, you can separate almost anything off on to a separate partition. what you don't get, that you might have been expecting/wanting is a system that looks any different. That is, from a normal user point of view, directories are still in the place that you would expect them to be, and there's none of that silly 'oh yes, I moved that to the F: drive, now I've got to navigate all the way over there' stuff.

The key here (or, part of the key, anyway) is that user files are saved under /home/username/...... and that's the way that it will always appear, whether or not home is a separate partition from / . There are various other tricks you can play with this, but you should get your head around that first.
 
Old 12-04-2013, 07:06 AM   #8
r41d3n
Member
 
Registered: Mar 2013
Distribution: Debian
Posts: 42

Rep: Reputation: Disabled
You can create a chroot in a directory under /, but I don't think it is what you want.
 
Old 12-04-2013, 07:44 AM   #9
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 831

Rep: Reputation: 200Reputation: 200Reputation: 200
You can practically achieve what you need (separation of system on one drive and data on the other) since you can mount a physical drive anywhere in the single file system. Thats what the mount command is for. To quote from one manual, (http://linux.die.net/man/8/mount)
Quote:
All files accessible in a Unix system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the filesystem found on some device to the big file tree. ....
So you could have system files on one drive say /dev/sda1 and all user data on /dev/sda2 - say by 'mount /dev/sda2 /home' and having all users' home directories under /home - which is /home on the unified file system.

OK

Last edited by AnanthaP; 12-08-2013 at 05:17 AM.
 
Old 12-04-2013, 10:22 AM   #10
Soadyheid
Senior Member
 
Registered: Aug 2010
Location: Near Edinburgh, Scotland
Distribution: Cinnamon Mint 17.3 and 18 at present.
Posts: 1,244

Rep: Reputation: 266Reputation: 266Reputation: 266
Quote:
The only thing I have om my C-disk is windows. All games, movies, music and similar files I have on a different hard disk
So that's C: contains OS, E: (or whatever) contains data? Is that what you're saying?

In Linux land that's equivalent to "/" on /dev/sda, "/home" on /dev/sdb. That's two separate disks with one partition per disk. All your user data and config files are kept in the "/home" partition, i.e. the second disk.

As an asides... If you partitioned your first disk, (C: known as /dev/sda), the partitions would be /dev/sda1, /dev/sda2, etc, etc, dependant on the number of partitions.
This can still be usefull in a single disk system in that if the data partition gets borked; head crash or whatever, you could still mount the second partition with a live CD Distro and rescue your data! (I'm asuming two partitions in this instance, / and /home.)

Back at the two disk senario...

You set up these partitions when you Install your distribution naming "/" as the mount point for /dev/sda1 and "/home" as the mount point for /dev/sdb1.
Note: /dev/sdb would be the whole disk, /dev/sdb1 would also be the whole disk if it was defined as a single partition. Does your head hurt yet?

If you decide to change your Distro in the future, you can do an install where the new OS is installed on /dev/sda1 and you name /dev/sdb1 as /home for your data again.
WARNING! Before letting the install format BOTH disks, uncheck the format option for the /home partition so it's left untouched and your data will be available to your new distrubution.

Caveats:
1. You should back up your /home partition before installing your new distro.
2. Your home partition also holds invisible "." config file for the applications you use, they may not quite fit the new distributions versions so be aware you could get some weird stuff happen. I've used this install method a few times and so far, so good!

That's my

Play Bonny!


Last edited by Soadyheid; 12-04-2013 at 10:26 AM.
 
Old 12-04-2013, 10:30 AM   #11
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian
Posts: 2,165

Rep: Reputation: 334Reputation: 334Reputation: 334Reputation: 334
Quote:
Originally Posted by TJen View Post
In windows, I'm used to having all the harddisks\partitions as separate root drives, meaning that the D-drive is a completely separate files system.
Actually, in Windows your "root" is more like "My Computer". And your "C:" and "D:" drives are just branches under that root.
 
Old 12-11-2013, 01:47 AM   #12
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 831

Rep: Reputation: 200Reputation: 200Reputation: 200
Quote:
Actually, in Windows your "root" is more like "My Computer". And your "C:" and "D:" drives are just branches under that root.
Not quite similar. In windows all application programs eventually refer to a path on a specific drive. On a *x distro, reference is only to the software handle - which is of course linked to the specific drive at "mount" time only. This makes it easier to maintain and manage.

OK
 
Old 12-11-2013, 02:18 AM   #13
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,206

Rep: Reputation: 197Reputation: 197
Cool

Quote:
Originally Posted by astrogeek View Post
If I understand you correctly, no.

Every mounted device is visible within the root filesystem.
Totally agree with astrogeek, since you are a Windows user.

It's also not possible in Windows to have multiple Windows directory that is active at all times.

"/" root directory on Linux is same as C:\Windows directory.

Short answer "Not possible".
 
Old 12-11-2013, 02:38 AM   #14
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 664

Rep: Reputation: 81
So you already had the answer "no". this is quite a similar concept of:
"you can have multiple people using your Pen but you own it and no one can't at the same time. whenever you want you can take it back from others and write what you want too." The same with root (it is the starting point "/" and the default owner to everything under), you cant have multiple root at the same time on any *nix OS atleast.
 
Old 12-11-2013, 10:54 AM   #15
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 4,440

Rep: Reputation: 1382Reputation: 1382Reputation: 1382Reputation: 1382Reputation: 1382Reputation: 1382Reputation: 1382Reputation: 1382Reputation: 1382Reputation: 1382
One extra point. In Windows, each program gets its own folder with everything in it, as far as I know (I've never actually used it). In Linux, the configuration data for a program is not stored with the program: it's in your home directory. That way, two people can share a computer and have it work differently, and the owner can install a new OS and keep the existing configuration. Also, all programs using the same dynamically linked library will share the same copy that lives in a separate place. That separation of components is then extended, so that a program's binary is in one place, it's documentation in another, and so forth. The filing system is very different to Windows and it's been evolving since before Windows was created. You just have to accept it.
 
  


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
[SOLVED] Mount directories to multiple /home directories? the ber Linux - Newbie 5 08-15-2013 06:14 AM
Bash Question(for loop): How to Zip multiple files under multiple directories Znrall Linux - General 2 08-01-2012 01:52 PM
Bash quesion - scp on multiple hosts to multiple directories in each one mierea.ciprian Programming 2 06-22-2012 12:27 PM
Change text in multiple files in multiple directories vivo2341 Linux - General 5 11-27-2006 08:16 PM
Searching multiple directories and sub directories for a file jeep99899 Linux - Newbie 2 10-13-2005 12:23 PM


All times are GMT -5. The time now is 03:19 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