Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux? |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-26-2018, 05:13 PM
|
#1
|
Member
Registered: Feb 2002
Location: NZ
Distribution: Kubuntu, Mint
Posts: 411
Rep:
|
mount directory using uuid in fstab
Is it possible to mount a directory using a uuid in fstab something like:
Code:
UUID=29537a49-632f-4774-8bbc-b68cd5181d74/opt /home/john/opt none bind
|
|
|
11-26-2018, 06:52 PM
|
#2
|
Senior Member
Registered: Sep 2017
Distribution: FreeBSD
Posts: 2,252
|
UUID, yes, but I have never used it with a directory appended. Normally this would be used so you don't have to reference the drive device designation directly, in case you move it. For example:
Code:
UUID=41c22818-fbad-4da6-8196-c816df0b7aa8 /disk2p2 ext3 defaults,errors=remount-ro 0 1
|
|
|
11-26-2018, 07:06 PM
|
#3
|
Moderator
Registered: Aug 2002
Posts: 26,922
|
No, you need 2 fstab lines. One to mount the file system to /opt and the second as a bind mount to remount /opt to /home/john/opt. As an example using your UUID but may not be exactly as your original fstab
Code:
UUID=29537a49-632f-4774-8bbc-b68cd5181d74 /opt ext4 defaults 0 0
/opt /home/john/opt none bind 0 0
Note that the filesystem mount options maintained by kernel will remain the same as those on the original mount point.
|
|
|
11-26-2018, 07:06 PM
|
#4
|
Member
Registered: Feb 2002
Location: NZ
Distribution: Kubuntu, Mint
Posts: 411
Original Poster
Rep:
|
Thanks, but that mounts the (whole) partition on /disk2p2. I'm looking for a way to mount one particular directory on that partition. Using uuid is independent of drive cabling.
|
|
|
11-26-2018, 07:07 PM
|
#5
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,445
|
Why didn't you just try it ?. You might learn something.
|
|
|
11-26-2018, 07:14 PM
|
#6
|
Moderator
Registered: Aug 2002
Posts: 26,922
|
You can not mount a directory within a filesystem without mounting the filesystem itself.
|
|
1 members found this post helpful.
|
11-26-2018, 08:07 PM
|
#7
|
Member
Registered: Feb 2002
Location: NZ
Distribution: Kubuntu, Mint
Posts: 411
Original Poster
Rep:
|
Thank you michaelk.
My reply was intended to sevendogsbsd . I had not seen your message at that stage.
I have now tried your suggestion (in fstab). It mounted the whole drive in /opt.
My original question may have been miss-leading in that I was presuming it may be a one stage process. /home/john/opt was a test location; if that worked I intended the destination be /opt
I have several OS and decided to have one /opt directory common to all (with frequently updates apps like Firefox, etc)
If I cannot mount only the directory, ie need to mount the drive first, then I may as well use a symlink to "mount" the required directory(?).
|
|
|
All times are GMT -5. The time now is 11:14 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|