OpenVZ Forum


Home » General » Support » Mount in vps
Mount in vps [message #7124] Wed, 04 October 2006 10:55 Go to next message
dagr is currently offline  dagr
Messages: 83
Registered: February 2006
Member
I tried to mount shared folder and got problem

created 1.mount
mount -o bind,ro /vz/cow/distr /vz/root/$VEID/DISTR

and 1.umount
umount /vz/root/$VEID/DISTR


VPS starts and stops ok and i can see thats it really mounts it, BUT!! Its not readonly for root inside VPS. Its the same like usual root - it can write anything disregard chmod attr. Same thing for VPS root - as soon as he can see this dir inside his filesystem - it can do anything with it (/vz/cow/distr) disregards permissions , etc. Is it bug or what?

2.6.9-023stab016.2-smp - RHEL4
Re: Mount in vps [message #7127 is a reply to message #7124] Wed, 04 October 2006 13:31 Go to previous messageGo to next message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
There is no bind ro bindmounts in Linux. Rolling Eyes
Re: Mount in vps [message #7128 is a reply to message #7127] Wed, 04 October 2006 13:35 Go to previous messageGo to next message
dagr is currently offline  dagr
Messages: 83
Registered: February 2006
Member
Ok , so is there any way to share dir to vps as read-only ?
Re: Mount in vps [message #7130 is a reply to message #7128] Wed, 04 October 2006 14:06 Go to previous messageGo to next message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
Here is an example how I can do it on my node:

[HN]# dd if=/dev/zero of=/tmp/shareddisk bs=1024 count=4000
4000+0 records in
4000+0 records out
[HN]# mke2fs -F /tmp/shareddisk
mke2fs 1.37 (21-Mar-2005)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
504 inodes, 4000 blocks
200 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=4194304
1 block group
8192 blocks per group, 8192 fragments per group
504 inodes per group

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[HN]# vzctl start 112
Starting VPS ...
VPS is mounted
Setting CPU units: 1000
VPS start in progress...
[HN]# mount -o loop,ro /tmp/shareddisk /vz/root/112/shared/
[root@dhcp0-132 /]# vzctl enter 112
entered into VPS 112
[VE]# cat /proc/mounts
simfs / simfs rw 0 0
proc /proc proc rw 0 0
devpts /dev/pts devpts rw 0 0
ext2 /shared ext2 ro 0 0
[VE]# cd /shared/
[VE]# touch qwe
touch: cannot touch `qwe': Read-only file system


Of course, if you have and wish to share some block device or partion you don't need to create loop device.


HTH,
vass.
Re: Mount in vps [message #7131 is a reply to message #7124] Wed, 04 October 2006 14:13 Go to previous messageGo to next message
dagr is currently offline  dagr
Messages: 83
Registered: February 2006
Member
yes , it might work . But new question comes.
Surely i will need opportunity to write in this sharedir from original system (non VPS). Can you say if its absolutely safe to make 2 mounts of this file to different dirs (i mount ro for VPS and another rw for original server ) ? ( i heard such situation can cause some problems)
Re: Mount in vps [message #7134 is a reply to message #7131] Wed, 04 October 2006 14:40 Go to previous messageGo to next message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
Hmmm.... yeap, I suppose there can be some problems... Sad
Re: Mount in vps [message #7135 is a reply to message #7124] Wed, 04 October 2006 14:51 Go to previous messageGo to next message
dagr is currently offline  dagr
Messages: 83
Registered: February 2006
Member
ok i found out the problem with loopback. If you make 2 loopback mounts, one of them rw , then all changes in partition are cached, ie you will not see changes inside VPS ro mount until remount, ie VPS restart.
Re: Mount in vps [message #7136 is a reply to message #7135] Wed, 04 October 2006 14:56 Go to previous messageGo to next message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
The only solution I see now is to create NFS server and mount rw and ro on hw node and then bindmount ro mounts inside VE....
Re: Mount in vps [message #7141 is a reply to message #7136] Wed, 04 October 2006 16:52 Go to previous messageGo to next message
Valmont is currently offline  Valmont
Messages: 225
Registered: September 2005
Senior Member
Maybe will be enough just nfs server on hw and two nfs clients from vpses? without binds Smile

But it's not very secure to setup nfs server on hw...
Re: Mount in vps [message #7144 is a reply to message #7141] Thu, 05 October 2006 06:30 Go to previous message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
You can't mount nfs directly from VE, nfs is not virtualized now. However, you're right, you can run server on HN and mount nfs in /vz/root/<VEID>/shareddir/.

[Updated on: Thu, 05 October 2006 06:42]

Report message to a moderator

Previous Topic: *SOLVED* quagga on FC5 and RHEL4
Next Topic: Better SO x Control Panel
Goto Forum:
  


Current Time: Tue Jul 29 16:08:46 GMT 2025

Total time taken to generate the page: 0.18235 seconds