Skip to content

Is it possible to mount 2 disks into one directory?

Hi, so basically I have 1 partition (sdb4) coming from sdb that is mounted to /home where all my data is suppose to be stored. I realized I was running out of storage so I decided to use my sda which is my extra disk, as my storage. So I mounted sda1 to /home and transferred all of my data to it. I was afraid that something might break if I don't remove the entry of sdb4 in /etc/fstab. So right now my sdb4 is unmounted. I'm just curious if it's actually possible to mount partitions on the same mount point from 2 different disks.

1 points24 comments
Open on Reddit
About this post
Posted
Archived
Score
1 · 100% up
Kind
Text
ID
1bc8acy

Author

2
posts
6
comments
0
media
View profile

24 comments

No, but you could mount one to a subdirectory within the other

11 points

You can mount multiple things to the same mount point simultaneously. It just makes tracking down what the heck is happening difficult.

3 points

I see, I didn't know you could do that too.

2 points

Did you install arch? Because typically you mount a partition at /mnt and another at /mnt/boot

11 points

This isn't quite true, you can with an overlay mount. Then you'll have a lower directory, that contains what was in there, and an upper directory where any changes will be stored.

Also technically you can make one regular mount and then mount another device on the same place but it will just hide everything from the first mount; I mention it only for pedantry's sake.

1 points

LVM is the solution to this problem.

9 points

First time I've heard of LVM, I'll try to look into that as well. Thanks a lot!

3 points

It's a good idea to set even a single-drive system up with it. That way you avoid the problem you see people repeatedly post about when they realise they didn't allocate enough space to their system partition and now want to know if they can safely resize their partitions 1: after creating the ESP and deciding whether you want a separate /boot partition, set the entire rest of the drive up for LVM, allocate just enough for each of the different things you need (/ and /home, for instance) and simply allocate extra storage from the pool to each as necessary - need an extra 100GB for /home, add it from the 400GB (if not more) at your disposal ... then, later, when you find you need an extra 20GB for the system itself, you just add it, instead of having to back up your data elsewhere, resize your partitions, cross your fingers, reboot and pray it a) worked and b) you won't have to do it all again, when you find (a few months later) that you still didn't allocate enough to the system.

___

1 The answer is always a qualified 'yes', because you can always lose data when changing the partition boundaries - it's never a 100% risk-free operation.

3 points

Seconded. If you're drives are setup as LVM physical volumes, you can just add a new drive to the logical group and expand into it.

1 points

Not without something exotic like UnionFS.

The better strategy is simply to have your /home directory mounted on the extra disk. There's no stipulation that /home has to be the same disk as root.

For example on my system, /home does exist on my root drive, but folders like /home/Documents, /home/Pictures, etc, all link to my /mnt/Extended/Nextcloud folder, which is on a separate disk. That disk gets synced with my homeserver, so I can do data-only backup-and-wipes on a semi-regular basis.

4 points

Oh that's interesting, I'll look up UnionFS. Thanks for answering! I didn't know it was actually better to have /home directory mounted on the extra disk, at first I thought I should've just gotten a single disk with bigger storage as an alternative. Rather than mounting it to another one.

2 points

Yeah of course.

There's not really a better or worse way to do things like this, it just depends on where you want your data and how your drives are structured. If you've got a fast, small drive and a large, slow drive, mounting /home elsewhere can save a lot of space, if you generate a lot of user files.

I personally find my /home directory doesn't get that big; the vast majority of my storage these days is games. So I have my steam directory cordoned off on a separate disk.

2 points

UnionFS is deprecated - the kernel native alternative is OverlayFS.

But, as I said, LVM is a more suitable solution - as much as anything else, union filesystems leave all but the topmost later unwritable, so you won't gain any space, nor will you be able to save files to any other locations within the union (it gets complicated to maintain, if not outright messy, if you need to modify or delete anything below the topmost layer).

2 points

Others have provided some good advice. I was thinking this would be a good candidate for the newer bcachefs.

2 points

You can mount one thing over another thing so if fstab mounts /dev/sda1 to /home and then mounts /dev/sdb1 to /home, you will effectively have /dev/sdb1 mounted at /home. Things get tricky if you mount one thing at /mnt open some files and then mount something else there. Unless you know what you are doing you should avoid mounting things on top of each other.

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.