LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 07-15-2012, 04:51 AM   #1
Arjun
Member
 
Registered: Feb 2011
Posts: 120
Blog Entries: 2

Rep: Reputation: 0
command info


Hello Linux masters,

I have heard about a command. Here it is.

Quote:
mount --bind /var/www/html/htdocs /home/userid
I have searched it on google but didnt got the function of this command.

So finally thought to post it here to get the answer.

I would like to know the function of this command.

Thanks
 
Old 07-15-2012, 05:01 AM   #2
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 106Reputation: 106
--bind is not a option of the mount command. What is the command you are trying to research suppose to do ? Also in what context did you hear of it ?
 
Old 07-15-2012, 05:06 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by jv2112 View Post
--bind is not a option of the mount command.
It is on my system...

Arjun;
Enter "man mount" to see an explanation of all the options.
 
Old 07-15-2012, 05:16 AM   #4
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Rep: Reputation: 23
Quote:
Originally Posted by pixellany View Post
It is on my system...

Arjun;
Enter "man mount" to see an explanation of all the options.
whatever is written in man page that would be only option to use.
use the command,

man mount

Regards
sharad
www.sharadchhetri.com
 
Old 07-15-2012, 06:16 AM   #5
Arjun
Member
 
Registered: Feb 2011
Posts: 120

Original Poster
Blog Entries: 2

Rep: Reputation: 0
Quote:
Originally Posted by jv2112 View Post
--bind is not a option of the mount command. What is the command you are trying to research suppose to do ? Also in what context did you hear of it ?

It says

Quote:
Loopback device, or even copy it
I still didnt understand about it..

Quote:
Originally Posted by pixellany View Post
It is on my system...

Arjun;
Enter "man mount" to see an explanation of all the options.

Didnt got info about this command
 
Old 07-15-2012, 06:29 AM   #6
VDP76
Member
 
Registered: Apr 2010
Location: Bayreuth, Germany
Distribution: CrunchBang Linux (#!)
Posts: 111

Rep: Reputation: 19
Quote:
Originally Posted by Arjun View Post
I still didnt understand about it..
Google is your friend in these cases, it leeds you to pages like this.
Quote:
Using bind mounts, we can mount all, or even part of an already-mounted filesystem to another location, and have the filesystem accessible from both mount points at the same time!
 
2 members found this post helpful.
Old 07-15-2012, 06:30 AM   #7
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 15.0
Posts: 8,233
Blog Entries: 61

Rep: Reputation: Disabled
Look here:
http://linux.die.net/man/8/mount
 
2 members found this post helpful.
Old 07-15-2012, 06:41 AM   #8
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Rep: Reputation: 23
Quote:
Originally Posted by brianL View Post
OK , I got it.

The bind mounts.
Since Linux 2.4.0 it is possible to remount part of the file hierarchy somewhere else. The call is

mount --bind olddir newdir .

Bro, can u tell us 2 questions-
(1) what are Old directory and new Directory name.
(2) Why your trying to mount in /home/userid ;(if the /home/userid is already mounted, u can not mount)

Paste the error here.
 
Old 07-15-2012, 06:57 AM   #9
Arjun
Member
 
Registered: Feb 2011
Posts: 120

Original Poster
Blog Entries: 2

Rep: Reputation: 0
Nice tutorial in the link

Thanks for this

Can you tell me if it is possible to mount the directory of a user group to another user group directory ?

like

Quote:
mount --bind /home/user1/html /home/user2/html
 
Old 07-15-2012, 06:59 AM   #10
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Rep: Reputation: 23
Quote:
Originally Posted by Arjun View Post
Nice tutorial in the link

Thanks for this

Can you tell me if it is possible to mount the directory of a user group to another user group directory ?

like
I just practically done this "mount --bind" option.
U can check this out in my blog.I have embedded the youtube video.

http://sharadchhetri.com/2012/07/15/...-ubuntu-12-04/
 
Old 07-15-2012, 07:32 AM   #11
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 4,916

Rep: Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400
y-dont-tube

Videos are neat, but my corporate laptop and network are pre-configured to block video streaming to reduce network impact on production. If your information is not available as text, it might just as well not exist for a significant segment of the community.
 
Old 07-15-2012, 08:42 AM   #12
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Rep: Reputation: 23
Quote:
Originally Posted by wpeckham View Post
Videos are neat, but my corporate laptop and network are pre-configured to block video streaming to reduce network impact on production. If your information is not available as text, it might just as well not exist for a significant segment of the community.
Here I am mounting one .iso file .
This is a brief step by step. (/opt/test = old_dir and /opt/newtest = new_dir)



root@tuxworld:/# ls -l /opt/test/
total 0
root@tuxworld:/# ls -ld /opt/test/
drwxr-xr-x 2 root root 4096 Jul 15 17:15 /opt/test/
root@tuxworld:/#
root@tuxworld:/# mkdir /opt/newtest
root@tuxworld:/#
root@tuxworld:/# mount -o loop /root/CentOS6.3.iso /opt/test/
mount: warning: /opt/test/ seems to be mounted read-only.
root@tuxworld:/# ls /opt/test/
CentOS_BuildTag Packages RPM-GPG-KEY-CentOS-Security-6
EULA RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Testing-6
GPL repodata TRANS.TBL
images RPM-GPG-KEY-CentOS-6
isolinux RPM-GPG-KEY-CentOS-Debug-6
root@tuxworld:/#

root@tuxworld:/# mount --bind /opt/test/ /opt/newtest
mount: warning: /opt/newtest seems to be mounted read-only.
root@tuxworld:/#
root@tuxworld:/# ls /opt/newtest
CentOS_BuildTag Packages RPM-GPG-KEY-CentOS-Security-6
EULA RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Testing-6
GPL repodata TRANS.TBL
images RPM-GPG-KEY-CentOS-6
isolinux RPM-GPG-KEY-CentOS-Debug-6
root@tuxworld:/#
root@tuxworld:/#
root@tuxworld:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 28G 25G 2.2G 93% /
udev 2.0G 4.0K 2.0G 1% /dev
tmpfs 794M 884K 793M 1% /run
none 5.0M 4.0K 5.0M 1% /run/lock
none 2.0G 332K 2.0G 1% /run/shm
/dev/sda7 9.3G 1.2G 7.7G 14% /partition7
/dev/loop0 3.5G 3.5G 0 100% /opt/test
root@tuxworld:/#

 
Old 07-15-2012, 08:44 AM   #13
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Rep: Reputation: 23
Smile

Quote:
Originally Posted by sharadchhetri View Post
Here I am mounting one .iso file .
This is a brief step by step. (/opt/test = old_dir and /opt/newtest = new_dir)



root@tuxworld:/# ls -l /opt/test/
total 0
root@tuxworld:/# ls -ld /opt/test/
drwxr-xr-x 2 root root 4096 Jul 15 17:15 /opt/test/
root@tuxworld:/#
root@tuxworld:/# mkdir /opt/newtest
root@tuxworld:/#
root@tuxworld:/# mount -o loop /root/CentOS6.3.iso /opt/test/
mount: warning: /opt/test/ seems to be mounted read-only.
root@tuxworld:/# ls /opt/test/
CentOS_BuildTag Packages RPM-GPG-KEY-CentOS-Security-6
EULA RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Testing-6
GPL repodata TRANS.TBL
images RPM-GPG-KEY-CentOS-6
isolinux RPM-GPG-KEY-CentOS-Debug-6
root@tuxworld:/#

root@tuxworld:/# mount --bind /opt/test/ /opt/newtest
mount: warning: /opt/newtest seems to be mounted read-only.
root@tuxworld:/#
root@tuxworld:/# ls /opt/newtest
CentOS_BuildTag Packages RPM-GPG-KEY-CentOS-Security-6
EULA RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Testing-6
GPL repodata TRANS.TBL
images RPM-GPG-KEY-CentOS-6
isolinux RPM-GPG-KEY-CentOS-Debug-6
root@tuxworld:/#
root@tuxworld:/#
root@tuxworld:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 28G 25G 2.2G 93% /
udev 2.0G 4.0K 2.0G 1% /dev
tmpfs 794M 884K 793M 1% /run
none 5.0M 4.0K 5.0M 1% /run/lock
none 2.0G 332K 2.0G 1% /run/shm
/dev/sda7 9.3G 1.2G 7.7G 14% /partition7
/dev/loop0 3.5G 3.5G 0 100% /opt/test
root@tuxworld:/#

Match the last output. You can understand what actually --bind do.

root@tuxworld:/# ls -l /opt/test/
total 528
-r--r--r-- 2 root root 14 Jul 7 14:11 CentOS_BuildTag
-r--r--r-- 2 root root 212 Jul 2 01:51 EULA
-r--r--r-- 2 root root 18009 Jul 2 01:51 GPL
dr-xr-xr-x 3 root root 2048 Jul 6 01:27 images
dr-xr-xr-x 2 root root 2048 Jul 6 01:26 isolinux
dr-xr-xr-x 2 root root 499712 Jul 7 14:13 Packages
-r--r--r-- 2 root root 1354 Jul 2 01:51 RELEASE-NOTES-en-US.html
dr-xr-xr-x 2 root root 4096 Jul 7 14:15 repodata
-r--r--r-- 2 root root 1706 Jul 2 01:51 RPM-GPG-KEY-CentOS-6
-r--r--r-- 2 root root 1730 Jul 2 01:51 RPM-GPG-KEY-CentOS-Debug-6
-r--r--r-- 2 root root 1730 Jul 2 01:51 RPM-GPG-KEY-CentOS-Security-6
-r--r--r-- 2 root root 1734 Jul 2 01:51 RPM-GPG-KEY-CentOS-Testing-6
-r--r--r-- 1 root root 3165 Jul 7 14:15 TRANS.TBL
root@tuxworld:/#
root@tuxworld:/# ls -l /opt/newtest/
total 528
-r--r--r-- 2 root root 14 Jul 7 14:11 CentOS_BuildTag
-r--r--r-- 2 root root 212 Jul 2 01:51 EULA
-r--r--r-- 2 root root 18009 Jul 2 01:51 GPL
dr-xr-xr-x 3 root root 2048 Jul 6 01:27 images
dr-xr-xr-x 2 root root 2048 Jul 6 01:26 isolinux
dr-xr-xr-x 2 root root 499712 Jul 7 14:13 Packages
-r--r--r-- 2 root root 1354 Jul 2 01:51 RELEASE-NOTES-en-US.html
dr-xr-xr-x 2 root root 4096 Jul 7 14:15 repodata
-r--r--r-- 2 root root 1706 Jul 2 01:51 RPM-GPG-KEY-CentOS-6
-r--r--r-- 2 root root 1730 Jul 2 01:51 RPM-GPG-KEY-CentOS-Debug-6
-r--r--r-- 2 root root 1730 Jul 2 01:51 RPM-GPG-KEY-CentOS-Security-6
-r--r--r-- 2 root root 1734 Jul 2 01:51 RPM-GPG-KEY-CentOS-Testing-6
-r--r--r-- 1 root root 3165 Jul 7 14:15 TRANS.TBL
root@tuxworld:/#
 
1 members found this post helpful.
Old 07-16-2012, 01:12 AM   #14
Arjun
Member
 
Registered: Feb 2011
Posts: 120

Original Poster
Blog Entries: 2

Rep: Reputation: 0
OK, got it

But, will it work with a non-root or with a normal user?
 
Old 07-16-2012, 04:43 AM   #15
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Rep: Reputation: 23
Quote:
Originally Posted by Arjun View Post
OK, got it

But, will it work with a non-root or with a normal user?
No, root permission is required. Try yourself it will show the message.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Getting command line info GottaLearnLINUX Linux - Newbie 4 08-09-2009 07:29 PM
info command walruswalrus Linux - Software 1 12-02-2005 12:14 PM
kernel info command cabinetcrafter Mandriva 1 03-12-2005 12:44 PM
info command not found aus9 Mandriva 5 01-10-2005 07:16 AM
System Info Command? tenraek Linux - General 1 05-20-2003 04:59 PM

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

All times are GMT -5. The time now is 10:12 AM.

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