OpenVZ Forum


Home » General » Support » install into existing directory?
install into existing directory? [message #43260] Mon, 15 August 2011 19:39 Go to next message
williamt is currently offline  williamt
Messages: 5
Registered: April 2011
Junior Member
Is there a way to make vzctl install into a directory that already exists?
For example if I setup my containers using lvm. I first have to create a device and mount it under /vz/private.

So if I'm create container id 1 I will already have a directory called
/vz/private/1 and vzctl refuses to install to it.

As a work around before I mount /vz/private/1, I have to install to a regular directory ,move it to a temp directory, mount /vz/private/1 and finally move files into
it, which is kind of a pain.

Any help would be appreciated.

Re: install into existing directory? [message #43326 is a reply to message #43260] Thu, 25 August 2011 02:31 Go to previous messageGo to next message
openmin is currently offline  openmin
Messages: 11
Registered: December 2010
Junior Member
Your question is hard to understand.

What are the actual vzctl parameters you tried to run?
Re: install into existing directory? [message #43328 is a reply to message #43260] Thu, 25 August 2011 07:14 Go to previous messageGo to next message
azagzin is currently offline  azagzin
Messages: 38
Registered: May 2008
Location: Vilnius
Member
williamt wrote on Mon, 15 August 2011 15:39
Is there a way to make vzctl install into a directory that already exists?
For example if I setup my containers using lvm. I first have to create a device and mount it under /vz/private.

So if I'm create container id 1 I will already have a directory called
/vz/private/1 and vzctl refuses to install to it.

As a work around before I mount /vz/private/1, I have to install to a regular directory ,move it to a temp directory, mount /vz/private/1 and finally move files into
it, which is kind of a pain.

Any help would be appreciated.


you want to say, install each VE on separate LV ?
Re: install into existing directory? [message #43329 is a reply to message #43328] Thu, 25 August 2011 09:14 Go to previous messageGo to next message
openmin is currently offline  openmin
Messages: 11
Registered: December 2010
Junior Member
Understand now, but don't know any way.

Not really a solution to your problem, but what about putting the whole vz folder into one LV (this is also what OpenVZ distributions like proxmox do)?
create ct on top of local lvm lv [message #43333 is a reply to message #43260] Thu, 25 August 2011 13:58 Go to previous messageGo to next message
curx
Messages: 739
Registered: February 2006
Location: Nürnberg, Germany
Senior Member

Hi,

you can script a vzctl-install-lv.sh to create a lvm lv with any settings you need, mount lv and a then use vzctl create cmd - with the use of

vzctl create <ctid> --private <mount_path_of_your_lvmlv> --root <mount_path_of_your_lvmlv> ...

See more on vzctl man page, section "Performing container actions, create"

Bye,
Thorsten
Re: create ct on top of local lvm lv [message #43339 is a reply to message #43333] Fri, 26 August 2011 12:28 Go to previous messageGo to next message
TheStig is currently offline  TheStig
Messages: 94
Registered: December 2008
Member
actually that works without any problems here (using debian5 with 2.6.26-2-openvz-amd64 kernel). just recently moved an old server to an openvz-container for which i mounted a newly created lvm to /vz/private/#ID ...
Re: create ct on top of local lvm lv [message #43342 is a reply to message #43339] Fri, 26 August 2011 16:04 Go to previous messageGo to next message
williamt is currently offline  williamt
Messages: 5
Registered: April 2011
Junior Member
TheStig wrote on Fri, 26 August 2011 05:28
actually that works without any problems here (using debian5 with 2.6.26-2-openvz-amd64 kernel). just recently moved an old server to an openvz-container for which i mounted a newly created lvm to /vz/private/#ID ...


Your saying if you create and mount your new lvm partition under say /vz/private/10
You can then do a vzctl create 10 --ostemplate yourtemplate
and it works fine??

This is what I get:
# lvcreate -L8G -n 6 rootvg
# mkfs.ext4 /dev/rootvg/6
# mkdir /vz/private/6
# mount /dev/rootvg/6 /vz/private/6
# vzctl create 6 --ostemplate scientific-6-x86_64
Private area already exists in /vz/private/6
Creation of container private area failed

OR

# vzctl create 6 --ostemplate scientific-6-x86_64 --private /vz/private/6 --root /vz/private/6
Private area already exists in /vz/private/6
Creation of container private area failed



Using:
# uname -a
Linux custvm0.sonic.net 2.6.32-042stab029.1 #1 SMP Sun Aug 7 19:35:21 MSD 2011 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/redhat-release
Scientific Linux release 6.0 (Carbon)
# rpm -qa |grep vzctl
vzctl-lib-3.0.28.3-1.x86_64
vzctl-3.0.28.3-1.x86_64
Re: create ct on top of local lvm lv [message #43344 is a reply to message #43342] Sat, 27 August 2011 19:19 Go to previous message
azagzin is currently offline  azagzin
Messages: 38
Registered: May 2008
Location: Vilnius
Member
you forgot one think, /vz/private/6 it's a hard link to /vz/root/6
Previous Topic: RHEL6-Kernel for Ubuntu
Next Topic: can not create VEs
Goto Forum:
  


Current Time: Mon Jul 15 10:50:15 GMT 2024

Total time taken to generate the page: 0.02363 seconds