LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-02-2016, 02:37 PM   #1
mtn12857
LQ Newbie
 
Registered: Feb 2016
Posts: 3

Rep: Reputation: Disabled
path changes after using Bind in fstab


I am dual booting win10 and either Opensuse or Ubuntu if I can solve this problem. I have an NTFS partition labeled "K" where I keep all my docs and such. In linux I am attempting to bind my /home/michael/Documents to K Documents folder with this command

/run/media/michael/K/Documents /home/michael/Documents none bind
or

/run/media/michael/K/Documents /home/michael/Documents ntfs-3g rbind,user,umask=0775,defaults 0 0

This works great until I reboot and find the Linux has created "K1" and That is where all my files are. When I re edit fstab to reflect this, linux simply creates "K2" and so on....

Can someone help? Thanks
 
Old 02-02-2016, 05:02 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
How to use bind mounts in linux
 
Old 02-02-2016, 06:58 PM   #3
mtn12857
LQ Newbie
 
Registered: Feb 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
I found nothing in your reply answering my question. When I BIND /media/michael/K/Documents to home/michael/Documents in fstab it works great. Upon reboot linux has created a /media/michael/K1 where my Documents now reside. /media/michael/K is empty. Re-editing fstab to reflect the change from /media/michael/K to /media/michael/K1 works great until reboot when there is now a /media/michael/K2 where my Documents are. This process repeats over and over. I have tried the following as my fstab entries with the same results

/media/michael/K/Documents /home/michael/Documents none bind
or
/media/michael/K/Documents /home/michael/Documents none bind 0 0
or
/media/michael/K/Documents /home/michael/Documents ntfs-3g rbind,user,umask=0775,defaults 0 0

How can I prevent this problem?

Thanks
 
Old 02-02-2016, 07:56 PM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by mtn12857 View Post
I found nothing in your reply answering my question. When I BIND /media/michael/K/Documents to home/michael/Documents in fstab it works great. Upon reboot linux has created a /media/michael/K1 where my Documents now reside. /media/michael/K is empty. Re-editing fstab to reflect the change from /media/michael/K to /media/michael/K1 works great until reboot when there is now a /media/michael/K2 where my Documents are. This process repeats over and over. I have tried the following as my fstab entries with the same results

/media/michael/K/Documents /home/michael/Documents none bind
or
/media/michael/K/Documents /home/michael/Documents none bind 0 0
or
/media/michael/K/Documents /home/michael/Documents ntfs-3g rbind,user,umask=0775,defaults 0 0

How can I prevent this problem?

Thanks
I didn't write that paper -- just shared it with you.
 
Old 02-02-2016, 08:03 PM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
the way this reads is

Code:
mv /var/log /opt/var_log
the orginal is moved to somewhere else and name changed to var_log

Code:
mkdir /var/log
then another directory is created where it use to be using the same name
Code:
mount -o bind /opt/var_log /var/log
the orginal is bound to the new empty directory.
Code:
# /etc/fstab
/opt/var_log              /var/log                 none    bind    0 0
in fstab the orginal with a new name is first, and the new empty dir with old name is second, then bound to it.

I have no idea what is what on yours...

but that is the logic of it. I did not create this system, don't even use that.

just trying to help

Last edited by BW-userx; 02-02-2016 at 08:06 PM.
 
Old 02-02-2016, 08:24 PM   #6
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
OK FINE -- you talked me into it, now let me see if I can figure this out for you on the fly ...

/run/media/michael/K/Documents /home/michael/Documents ntfs-3g rbind,user,umask=0775,defaults 0 0

I don't have the exact same set up as you but, I just created a directory then mounted a directory into it between two seperate HDD's using bind, rebooted and no problems. it is the mount points that are relevant, not the hard drives.

therefore your format is messed up, it is something else that is messing up your formated statment in fstab.

This is my fstab... (in part)


Code:
/dev/sdb1       /media/data  ext4 defaults 0 0

/media/data/Dropbox /home/userx/testMount none bind 0 0
this is yours..
Quote:
/run/media/michael/K/Documents /home/michael/Documents ntfs-3g rbind,user,umask=0775,defaults 0 0
your other mount is ntfs, no need for umask permissons its ntfs. Linux does not recognize permission settings on ntfs format. Linux does not use them, try doing it like this instead.

First mount your whole partition first in fstab, then off of that mount, do like I did.

First go command line commando and type this:

blkid first to get your /dev/sdxx, now open fstab then add it. mounting it to whatever point you chooise to. Not your Documents Dir. that's next, Preferably mount it off of a directory on /

Either:
/media
/tmp
or what ever you create. then create a subDir within it.in case you ever want to use it to mount something else. it will already be there, Then add it to your Fstab.

Code:
/dev/sdxx "/the/mount/ point you created" ntfs-3g defaluts 0 0
when you have your entire hdd mount entry in fstab, and saved.Then issue this command
Code:
sudo mount -a
. Then open up a filemanager or command line to find it. Get the Absloute path off your mount point like I did. Now add that to your fstab, mounting it to your home/Docs directory.

example:
Code:
/media/data/michael/K/Documents /home/michael/Documents	ntfs-3g bind 0 0
Now hit your up arrow and issue sudo mount -a again. then check it, then reboot, and re--check it ..

if that does not work then put that "none" back in there and remove the ntfs-3g and see if it works. if not then add the ntfs-3g again. I think that the none will surfice, as it is already mounted as ntfs-3g in the prior mount statment, all you're doing is making a relitive connection between the two mount points. like using a soft link.

It look like you are letting the system mount your ntfs, by your path statment. when your system does this it changes the id's to it everytime you reboot. that's why you're getting a new/different one each time because it seems to be defaulting to creating a new mount/dir/structrue to over come the mount you put in fstab. as it is not completely valid, because the windows part has not been offically mounted in run yet.

doing it this way it is hard copied into the system, taking full charge of the situation. it will stay that way.

see if that works.

and do not forget to

sudo chmod 755 -R /media/data # or what ever mount point you picked to use.

the directory that you created in root has to have permissions changed to 755. if you want user permissions on it.

if it works then you're now offically "the cats ass"

that's an oxymoron metaphor

Last edited by BW-userx; 02-03-2016 at 06:55 AM.
 
1 members found this post helpful.
Old 02-04-2016, 02:50 PM   #7
mtn12857
LQ Newbie
 
Registered: Feb 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
solved

"First mount your whole partition first in fstab, then off of that mount,"

Thanks, that did it.
 
Old 02-04-2016, 03:19 PM   #8
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Happy to hear it...

you are now offically "the cats ass"

Last edited by BW-userx; 02-04-2016 at 03:20 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create a read-only bind mount in fstab? ShiningMasamune Linux - General 14 05-06-2012 09:28 PM
Fstab not mounting a subdir with the bind option JosipBroz Linux - Software 2 03-11-2009 04:44 PM
nfs and bind-mount order in /etc/fstab mr.neil Linux - Server 6 06-16-2008 02:41 AM
mount --bind (fstab problem) renski Linux - General 2 11-17-2005 03:50 PM
auto and bind options in fstab kaplan71 Linux - Networking 1 05-18-2005 08:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration