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? |
If I understand you correctly, no.
Every mounted device is visible within the root filesystem. |
Quote:
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:
Why would you want to do this? |
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. |
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? |
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. |
Quote:
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. |
You can create a chroot in a directory under /, but I don't think it is what you want.
|
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:
OK |
Quote:
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! :D That's my :twocents: Play Bonny! :hattip: |
Quote:
|
Quote:
OK |
Quote:
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". |
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. |
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.
|
All times are GMT -5. The time now is 10:36 PM. |