OpenVZ Forum


Home » General » Support » *SOLVED* Shared vps files
Re: Shared vps files [message #6191 is a reply to message #6190] Mon, 11 September 2006 14:56 Go to previous messageGo to previous message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
This is possible with some tricks. This is what I've just done:

[myhwn]# vzctl create 30
Creating VPS private area: /vz/private/30
Performing postcreate actions
VPS private area was created

[root@dhcp0-174 ~]# vzctl create 31
Creating VPS private area: /vz/private/31
Performing postcreate actions
VPS private area was created

[root@dhcp0-174 ~]# rm -rf /vz/private/31/sbin/*

[root@dhcp0-174 ~]# cat > /etc/vz/conf/31.mount
#! /bin/bash
mount --bind /vz/private/30/sbin /vz/root/31/sbin

[root@dhcp0-174 ~]# chmod +x /etc/vz/conf/31.mount

[root@dhcp0-174 ~]# cat > /etc/vz/conf/31.umount
#! /bin/bash
umount /vz/root/31/sbin

[root@dhcp0-174 ~]# chmod +x /etc/vz/conf/31.umount


After that VE 31 should use the same /sbin, that uses VE30. Let's check, does it work:

[root@dhcp0-174 ~]# vzctl start 30
Starting VPS ...
VPS is mounted
Setting CPU units: 1000
VPS start in progress...
[root@dhcp0-174 ~]# vzctl start 31
Starting VPS ...
vzquota : (warning) Quota is running for id 31 already
VPS is mounted
Setting CPU units: 1000
VPS start in progress...
[root@dhcp0-174 ~]# vzctl enter 30
entered into VPS 30

-bash-3.00# ls /sbin/
MAKEDEV         clock        ether-wake   halt       insmod.static     kmodule      mkfs.ext2    netreport            poweroff     route       sulogin
addpart         consoletype  fdisk        hwclock    install-info      ldconfig     mkfs.ext3    nologin              ppp-watch    rtmon       swapoff
agetty          ctrlaltdel   findfs       ifcfg      ip                logsave      mkswap       pam_console_apply    pwdb_chkpwd  runlevel    swapon
arp             debugfs      fsck         ifconfig   ipmaddr           losetup      modprobe     pam_tally            quotacheck   runuser     sysctl
arping          delpart      fsck.cramfs  ifdown     iptables          lsmod        mount.cifs   pam_timestamp_check  quotaoff     service     syslogd
badblocks       dumpe2fs     fsck.ext2    ifenslave  iptables-restore  mii-diag     mount.smb    partx                quotaon      setsysfont  tc
blkid           e2fsck       fsck.ext3    ifup       iptables-save     mii-tool     mount.smbfs  pidof                rdisc        sfdisk      telinit
blockdev        e2image      fuser        init       iptunnel          mke2fs       nameif       pivot_root           reboot       shutdown    tune2fs
change_console  e2label      genhostid    initlog    killall5          mkfs         nash         plipconfig           rescuept     slattach    unix_chkpwd
chkconfig       elvtune      getkey       insmod     klogd             mkfs.cramfs  netplugd     portmap              resize2fs    sln

-bash-3.00# echo "qwe" > /sbin/check

-bash-3.00# exit
logout
exited from VPS 30

[root@dhcp0-174 ~]# vzctl enter 31
entered into VPS 31

-bash-3.00# ls /sbin/
MAKEDEV         chkconfig    elvtune      getkey     insmod            klogd     mkfs.cramfs  netplugd             portmap      resize2fs   sln
addpart         clock        ether-wake   halt       insmod.static     kmodule   mkfs.ext2    netreport            poweroff     route       sulogin
agetty          consoletype  fdisk        hwclock    install-info      ldconfig  mkfs.ext3    nologin              ppp-watch    rtmon       swapoff
arp             ctrlaltdel   findfs       ifcfg      ip                logsave   mkswap       pam_console_apply    pwdb_chkpwd  runlevel    swapon
arping          debugfs      fsck         ifconfig   ipmaddr           losetup   modprobe     pam_tally            quotacheck   runuser     sysctl
badblocks       delpart      fsck.cramfs  ifdown     iptables          lsmod     mount.cifs   pam_timestamp_check  quotaoff     service     syslogd
blkid           dumpe2fs     fsck.ext2    ifenslave  iptables-restore  mii-diag  mount.smb    partx                quotaon      setsysfont  tc
blockdev        e2fsck       fsck.ext3    ifup       iptables-save     mii-tool  mount.smbfs  pidof                rdisc        sfdisk      telinit
change_console  e2image      fuser        init       iptunnel          mke2fs    nameif       pivot_root           reboot       shutdown    tune2fs
check           e2label      genhostid    initlog    killall5          mkfs      nash         plipconfig           rescuept     slattach    unix_chkpwd

-bash-3.00# cat /sbin/check
qwe

-bash-3.00# exit
logout
exited from VPS 31

[root@dhcp0-174 ~]# vzctl stop 30
Stopping VPS ...
VPS was stopped
vzquota : (error) Quota off syscall for id 30: Device or resource busy
vzquota off failed [3]

[root@dhcp0-174 ~]# vzctl stop 31
Stopping VPS ...
VPS was stopped
VPS is unmounted


So it works! =)
The only problem is OpenVZ disk quota. This feature obviously will not work properly with such configuration.
You should turn it off.

BTW, Virtuozzo uses vzfs instead simfs (this one is used in OpenVZ), and vzfs accomplish file sharing very effectively.


 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Moving on to FreeVPS or Xen
Next Topic: *SOLVED* Transfer Problem (32bit --> 64bit)
Goto Forum:
  


Current Time: Mon Jul 15 10:38:56 GMT 2024

Total time taken to generate the page: 0.02319 seconds