LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   command info (https://www.linuxquestions.org/questions/linux-newbie-8/command-info-4175416807/)

Arjun 07-15-2012 04:51 AM

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

jv2112 07-15-2012 05:01 AM

--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 ?

pixellany 07-15-2012 05:06 AM

Quote:

Originally Posted by jv2112 (Post 4728542)
--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.

sharadchhetri 07-15-2012 05:16 AM

Quote:

Originally Posted by pixellany (Post 4728545)
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

Arjun 07-15-2012 06:16 AM

Quote:

Originally Posted by jv2112 (Post 4728542)
--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 (Post 4728545)
It is on my system...

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


Didnt got info about this command

VDP76 07-15-2012 06:29 AM

Quote:

Originally Posted by Arjun (Post 4728585)
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!

brianL 07-15-2012 06:30 AM

Look here:
http://linux.die.net/man/8/mount

sharadchhetri 07-15-2012 06:41 AM

Quote:

Originally Posted by brianL (Post 4728592)

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.

Arjun 07-15-2012 06:57 AM

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

sharadchhetri 07-15-2012 06:59 AM

Quote:

Originally Posted by Arjun (Post 4728608)
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/

wpeckham 07-15-2012 07:32 AM

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.

sharadchhetri 07-15-2012 08:42 AM

Quote:

Originally Posted by wpeckham (Post 4728624)
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:/#


sharadchhetri 07-15-2012 08:44 AM

Quote:

Originally Posted by sharadchhetri (Post 4728660)
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:/#

Arjun 07-16-2012 01:12 AM

OK, got it

But, will it work with a non-root or with a normal user?

sharadchhetri 07-16-2012 04:43 AM

Quote:

Originally Posted by Arjun (Post 4729196)
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.


All times are GMT -5. The time now is 10:44 PM.