Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
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.
I'm trying to setup a chroot so it has access to my hard drives that are mounted on the base system.
My understanding is that if I use a hard link I will be able to acheive this so both the chroot and base system are able to access the mounted drives under /media.
Is it just as simple as linking the whole of the /media directory? If I link them and make changes in the chroot will it synchroise with the drive under /media? Say if I made a file 'foo.sh' inside the chroot will I be able to access this under /media on the base system and make changes etc. I am the only user of this machine.
From where to where you are trying to create the hard link? If it is between two devices it will not work as you cannot have hard links created across different devices.
I have checked the document and since I am not much into debian or any of its derivatives and haven't tried similar stuff on CentOS or Red Hat either so can't comment on the document.
But I am not sure how this document fit into your requirement? I mean if you want to mount an external HDD and then share it via Samba where did this document come from?
So I have my base system which is sharing several services on my network. It shares hard drives via SMB over the network. These drives contain media, videos and music.
However I want to setup PMS which requires using a chroot as it's not officially supported by the project. I have got it setup - however I just need to import my media to plex which is contained within the chroot. The guide says to mount shares from the base system onto the chroot directory.
My intial feeling was that I have already setup my fstab and samba as required I thought soft/hard linking the drives with the 'ln' command would be a nice shortcut?
Alright, now I get the clear picture of the setup and what exactly you are looking for. The following part you have done as per the document you mentioned earlier:
I mean if it works then for PMS you have it available eg: via /chroots/wheezy-armel/media/films and for local users it is available via /mnt/USB_HD/Films
If it doesn't work then yes soft link is the option where in you will point /chroots/wheezy-armel/media/films to /mnt/USB_HD/Films. As I said I haven't worked on this kind of setup so not sure how good PMS will work with soft links but it does worth a try.
The document describes bind-mounts, not normal mount. By using the bind option the filesystem will be available to both the host and the chroot, this actually is the nice shortcut and standard and proven way to do it. Softlinks pointing outside a chroot shouldn't work, hardlinks can't be set pointing to a directory or across filesystem boundaries, so bind-mounts are in fact the only reliable way to achieve your goals.
After your post I had look at the following http://unix.stackexchange.com/questi...from-within-it and from what I can understand with chroot in place it is not only the navigation but also pointers are affected. I mean anything pointing out of chroot will fail as it only looks for what defined within chroot.
Partially. Hard links can point outside the chroot and should work in that setup, but are useless if you want to link entire directories or link to files on a different filesystem. Well, you could write a script that recreates entire directory trees with hard links, but why would you if you just can use bind-mounts?
Thank you both, seems like I was misundestanding links.
By this reasoning then if I bind my hard drives to inside the chroot they will still be available outside of it... Interesting I will give this a go and report back. Thanks again.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.