OpenVZ Forum


Home » General » Support » Need help with mount bind
Need help with mount bind [message #38901] Thu, 18 February 2010 06:45 Go to next message
crombiecrunch is currently offline  crombiecrunch
Messages: 2
Registered: February 2010
Junior Member
Hello all

My server is setup with a 2TB main drive and a 750GB drive mounted on the HN as /backup. I want to share that drive with containers that are running cpanel on them. I tried doing a mount --bind /backup /vz/root/101/backup on th HN but when going to the container and doing a DF the /backup is not listed there.


Any help on getting this setup? Ideally I would like to break it down to x amount of GB on the /backup per container. So say I have a VPS which has 35GB of HDD they can only use 35GB on the /backup.

Re: Need help with mount bind [message #38922 is a reply to message #38901] Sat, 20 February 2010 10:06 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hello jonathan,

I'd like to start from the end of your post.
Quote:

Ideally I would like to break it down to x amount of GB on the /backup per container. So say I have a VPS which has 35GB of HDD they can only use 35GB on the /backup.


I'm not sure that this is the best idea and I hope that you will be able to find an optimal variant but consider this as a starting point to proceed further: don't you want to allocate the whole 750Gb disk to a single volume group and then create just logical volumes that are corresponded to VEs backup directories e.g. /backup/101, /backup/102, /backup/103 etc. Each of them you can mount --bind inside appropriate VE.
For further information please turn to:
http://tldp.org/HOWTO/LVM-HOWTO/

That's a flexible way to solve your problem from my point of view as you can easily create an additional logical volume as well as set a well-defined size to it when a particular VE is being created.


Quote:

but when going to the container and doing a DF the /backup is not listed there.


But isn't this a normal "df" utility behavior? If I do "mount --bind" on a pure Linux machine, I don't expect to view information in "df" output. Am I wrong?
Re: Need help with mount bind [message #38925 is a reply to message #38901] Sat, 20 February 2010 10:36 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Or even better variant.
After the logical volume is created move it inside VE with help of
"vzctl --devnodes" command. Then you may create a filesystem inside a VE and mount it as you want. The difference is that this variant is more correct and "df" works in this case.
Re: Need help with mount bind [message #38990 is a reply to message #38925] Sat, 27 February 2010 17:56 Go to previous messageGo to next message
crombiecrunch is currently offline  crombiecrunch
Messages: 2
Registered: February 2010
Junior Member
Ok

So I had this working the other day

On my /backup drive I created several folders 101,102,etc

I then used the command

mount --bind /backup/101 vz/root/101/backup

and it worked. Last night I had to reboot the main node and now when I try to do the above command I get

mount: mount point vz/root/101/backup does not exist

The containers 101 and 102 which I had originally done this to still have access to /backup for whatever reason and places the files in the correct folder on /backup, i.e. 101. And I say this because I thought when the main node got rebooted the mount binds got deleted. But it seems this didnt happen.

I am trying to mount bind a new container 105 and for the life of me I can not get it to bind
Re: Need help with mount bind [message #39014 is a reply to message #38990] Thu, 04 March 2010 08:45 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hello,

vz/root/101/backup

this is a relative path not an absolute one. It might cause a problem because it depends from what directory the command is invoked.
Re: Need help with mount bind [message #39021 is a reply to message #38901] Thu, 04 March 2010 09:04 Go to previous message
TheStig is currently offline  TheStig
Messages: 94
Registered: December 2008
Member
On my more recent OpenVZ kernels (2.6.24 or .26) df (or mount for that matter) lists devices bound in via "mount --bind" inside a VPS correctly, even displaying the correct path on the HNs /dev/. On my 'custom' 2.6.22 it doesn't work unless I run df on the bound in device directly (eg. 'df /var/www').

I'm not quite sure if that also works if you bind just a subdirectory instead of an device, as I always create LVMs or DRBDs for my VPS.

If you just want to backup your VPS I wouldn't make the backup accessible inside a VPS but rather (r)sync the contents of /vz/private/#/whatever-you-need/ via a cronjob to the backup disk. This way your backup is still save, even if your VPS is cracked.
Previous Topic: Installation & Setup
Next Topic: /proc not mounted erorr in containers
Goto Forum:
  


Current Time: Tue Aug 13 13:53:12 GMT 2024

Total time taken to generate the page: 0.02858 seconds