LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Can you mount two partitions on the same mount point? (https://www.linuxquestions.org/questions/slackware-14/can-you-mount-two-partitions-on-the-same-mount-point-4175493002/)

moisespedro 01-29-2014 11:42 AM

Can you mount two partitions on the same mount point?
 
I have two different partitions on two different hard disks. Is it posible to mount both as /home at the same time?

Kustom42 01-29-2014 11:48 AM

The short answer, yes and no.


In a mount scenario only one partition can use a mount point. However, there are things in the Linux world that allow us to setup multiple partitions as a logical volume and then mount that logical volume to a mount point.


NOTE: This requires a re-partition to mark the partitions as an LVM.

http://www.howtoforge.com/linux_lvm


Let us know if you have any questions.

YellowApple 01-29-2014 01:57 PM

Yes. No idea if Slackware includes it (it ought to, considering it's included with all reasonably-modern kernels).

Kustom42 01-29-2014 02:59 PM

Quote:

Originally Posted by YellowApple (Post 5107623)
Yes. No idea if Slackware includes it (it ought to, considering it's included with all reasonably-modern kernels).

You should really explain this, this is a special type of filesystem that is not commonly used. LVM + ext3 filesystems are much more standardized.

I personally would never use unionfs but there are people out there who do. I highly encourage you to search around on this topic before you implement to make sure you know what you are getting into.

YellowApple 01-29-2014 05:44 PM

Quote:

Originally Posted by Kustom42 (Post 5107655)
You should really explain this, this is a special type of filesystem that is not commonly used. LVM + ext3 filesystems are much more standardized.

I'd argue that the concept of union mounts is very much standardized, and both UnionFS (which I linked) and aufs are already in very common use (particularly in live-CD environments).

perbh 01-29-2014 05:56 PM

Ok - I know where you are heading - but ... traditionally the answer is a resounding 'yes'! However, you will only be able to see the last one :-(

jefro 01-29-2014 08:23 PM

Not to get into a debate here.

Kustom42's first answer is really the correct answer to the question based on the word "mount" and no other inference. One might read the question as possible to exclude the "at the same time" assumption. One could mount two partitions to the same mount point at different times.

We can all agree that lvm, btrfs, zfs and other schemes like unionfs and aufs is a way to do what the OP may have had in mind.

rknichols 01-29-2014 09:02 PM

Quote:

Originally Posted by perbh (Post 5107737)
Ok - I know where you are heading - but ... traditionally the answer is a resounding 'yes'! However, you will only be able to see the last one :-(

To be totally pedantic about it, they aren't actually mounted to the same point. You can mount the first one to, for example, /mnt/tmp (presumably part of the root filesystem). When you do the second mount, /mnt/tmp is now referring to the root inode of that first-mounted filesystem, and not to a directory on the root filesystem. You can see the effect of that if you try to umount that first filesystem by specifying the device:
Code:

# mount -r /dev/sdd1 /mnt/tmp
# mount -r /dev/sdd2 /mnt/tmp
# umount /dev/sdd1
umount: cannot umount /dev/sdd1 -- /dev/sdd2 is mounted over it on the same point.


Richard Cranium 01-29-2014 09:19 PM

Quote:

Originally Posted by YellowApple (Post 5107734)
I'd argue that the concept of union mounts is very much standardized, and both UnionFS (which I linked) and aufs are already in very common use (particularly in live-CD environments).

I'd argue that you should ask the OP's intent for mounting the two partitions on the same mount point prior to offering advice on how to do it.

YellowApple 01-30-2014 12:09 PM

Quote:

Originally Posted by Richard Cranium (Post 5107808)
I'd argue that you should ask the OP's intent for mounting the two partitions on the same mount point prior to offering advice on how to do it.

OP asked for a way to mount two partitions to the same mount point at the same time. I provided links to documentation of the kernel's ability to do precisely that without needing to take "intent" into account, given that the provided use case - having one mountpoint point to multiple locations simultaneously - is precisely what said kernel functionality was designed to handle.

Quote:

Originally Posted by jefro (Post 5107784)
Not to get into a debate here.

Kustom42's first answer is really the correct answer to the question based on the word "mount" and no other inference. One might read the question as possible to exclude the "at the same time" assumption. One could mount two partitions to the same mount point at different times.

We can all agree that lvm, btrfs, zfs and other schemes like unionfs and aufs is a way to do what the OP may have had in mind.

I didn't mean to start a debate; apparently the concept of union mounts, despite having been around for at least two decades, is taboo around these parts...

Richard Cranium 01-30-2014 12:58 PM

Quote:

Originally Posted by YellowApple (Post 5108177)
OP asked for a way to mount two partitions to the same mount point at the same time. I provided links to documentation of the kernel's ability to do precisely that without needing to take "intent" into account, given that the provided use case - having one mountpoint point to multiple locations simultaneously - is precisely what said kernel functionality was designed to handle.



I didn't mean to start a debate; apparently the concept of union mounts, despite having been around for at least two decades, is taboo around these parts...

There are use cases where LVM is superior to union mounts. Since I can't read minds as well you think you can, I would have had to ask the OP to determine what solution would best support his intent.

Richard Cranium 01-30-2014 01:04 PM

Quote:

Originally Posted by moisespedro (Post 5107563)
I have two different partitions on two different hard disks. Is it posible to mount both as /home at the same time?

Since everyone else is busy showing how smart they are, I guess that I'll ask.

Why do you want to do this? Is there content on both partitions that you want to merge? Do you want to use both drives to store your stuff?

YellowApple 01-30-2014 02:40 PM

Quote:

Originally Posted by Richard Cranium (Post 5108203)
There are use cases where LVM is superior to union mounts. Since I can't read minds as well you think you can, I would have had to ask the OP to determine what solution would best support his intent.

I'm not denying that LVM has its merits, nor am I claiming to be a psychic. I merely put forward the tool specifically designed to do what OP asked for: the ability to have one mountpoint for multiple partitions.

If you're going to nag me for providing a quick and immediate answer instead of seeking additional clarification from OP, at least be consistent and do the same to Kustom42, who is equally guilty of making assumptions by your rationale.

Kustom42 02-05-2014 05:05 PM

Quote:

Originally Posted by YellowApple (Post 5108262)
I'm not denying that LVM has its merits, nor am I claiming to be a psychic. I merely put forward the tool specifically designed to do what OP asked for: the ability to have one mountpoint for multiple partitions.

If you're going to nag me for providing a quick and immediate answer instead of seeking additional clarification from OP, at least be consistent and do the same to Kustom42, who is equally guilty of making assumptions by your rationale.

I am not guilty of making assumptions, I provided an option and told you to elaborate more on what is being asked. I actually talked about what LVM was in my post and this continuance of flaming each other on the boards needs to cease right now. Everyone here is trying to show how big their e-peen is and its ricidulous we are here to help the OP focus on that.


And yes you do need to provide details in your response not just I'm smart and know what I'm doing and use this. I explained possible impilications and provided a link to a tutorial with examples.

You posted a link to a FOSS project that is used on less distros than I can count on both hands out of the box. Explain this to the OP and say here is an option, its used on these and heres its benefits. Let them figure out if its right for them or not.


Feel free to disagree with any of the above with exception of ceasing the flaming, we are violating the forum rules here and need to focus on working together to build a strong community and keep people coming back. Remember we are all here because we <3 Linux

YellowApple 02-05-2014 07:49 PM

Quote:

Originally Posted by Kustom42 (Post 5112383)
I am not guilty of making assumptions, I provided an option and told you to elaborate more on what is being asked. I actually talked about what LVM was in my post and this continuance of flaming each other on the boards needs to cease right now. Everyone here is trying to show how big their e-peen is and its ricidulous we are here to help the OP focus on that.

Pardon me? I'm not flaming, and I'm not waving an e-peen. I merely put forward a suggestion; OP can take it or leave it.

Quote:

Originally Posted by Kustom42 (Post 5112383)
And yes you do need to provide details in your response not just I'm smart and know what I'm doing and use this.

Again: pardon? I never stated anything along those lines, nor intended to imply it.

Quote:

Originally Posted by Kustom42 (Post 5112383)
I explained possible impilications and provided a link to a tutorial with examples.

You posted a link to a FOSS project that is used on less distros than I can count on both hands out of the box.

Union mounts are very common in LiveCD/DVD/USB environments, and UnionFS and aufs are the two most prevalent in-kernel implementations of the concept for Linux.

Quote:

Originally Posted by Kustom42 (Post 5112383)
Explain this to the OP and say here is an option, its used on these and heres its benefits. Let them figure out if its right for them or not.

Very well.

A union mount allows multiple filesystems to be mounted simultaneously; the end result looks like a single filesystem, with a single mountpoint. This concept is commonly used in Unix-like operating systems; Plan 9 - Bell Labs' successor to Unix - makes extensive use of such filesystem combination, and is an awesome example of union mounts done right. There are multiple methods of implementing union mounts in Linux, two of them being UnionFS and aufs.

In the case of UnionFS, then - so long as your kernel supports it - you can easily make two filesystems accessible with one mountpoint:

Code:

mount -t unionfs -o dirs=/mnt/user-partition-1:/mnt/user-partition-2 none /home
For aufs:

Code:

mount -t aufs -o br=/mnt/user-partition-1:/mnt/user-partition-2 none /home
Both of the above assume that you've already established mountpoints for your two partitions that need to be mounted as /home.

There's also unionfs-fuse if your kernel doesn't include UnionFS or aufs and you don't feel like compiling kernel modules. That tool is also quite simple:

Code:

unionfs-fuse /mnt/user-partition-1:/mnt/user-partition-2 /home
I'm not sure about the availability of any of these in Slackware, though I do know that Slax (which is based on Slackware) previously used UnionFS and now uses aufs as of version 6. Debian has both unionfs-fuse and aufs.

Quote:

Originally Posted by Kustom42 (Post 5112383)
Feel free to disagree with any of the above with exception of ceasing the flaming, we are violating the forum rules here and need to focus on working together to build a strong community and keep people coming back. Remember we are all here because we <3 Linux

Eeyup.


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