Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
14
rated 0 times [  14] [ 0]  / answers: 1 / hits: 604  / 3 Years ago, sun, november 21, 2021, 2:40:37

I have a second drive that I want to be mounted at the root. The drive contains the following folders:



/home
/shared


I want those two folders to be accessible at "/". I can mount the drive at /media/disk1 but that does not solve my problem.



I tried the following command but it doesn't work:



mount /dev/sdb1 /


I have no errors but the folders do not appear on /


More From » mount

 Answers
1

What you seems you want is a "union" mount, which can't be done in Ubuntu (at least not with default tools; follow the above link you are adventurous). In general there is still no official union-mount solution in Linux (2014-04-22); there are out-of-tree filesystems like AUFS and work-more-or-less-in-progress on UnionMount. Valerie Aurora has a (slightly outdate) page about it.



What you can easily do is mounting the disk at, for example, /mnt/disk1 and then symlink the directories where you want them:



ln -s /mnt/disk1/home /home
ln -s /mnt/disk1/shared /shared


(again, you should not have an existing /home or /shared folder, confusion and/or errors would appear otherwise).



Another way to do these kind of things is a "bind mount". It's very similar to symlinking directories, but can cross "chroot" boundaries. You can find more info in this page and in this other one.



Update: the overlayfs file-system has been promoted to standard kernel for version 3.18. So now there is an official union-type solution for linux; userspace utility to simplify its use will surely follow.
For now, documentation is in the kernel tree at Documentation/filesystems/overlayfs.txt.


[#25785] Sunday, November 21, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hergy

Total Points: 64
Total Questions: 115
Total Answers: 109

Location: Saint Helena
Member since Tue, Nov 3, 2020
4 Years ago
;