Placing OpenVZ container on 2nd storage device.

KuJoe

New Member
Sep 5, 2011
23
0
1
Hello, I currently have my server configured with 2 RAIDs. A RAID10 setup (/dev/sda) and a RAID1 setup (/dev/sdb). I installed Proxmox and the RAID10 was set as the primary local storage, which I wanted. But I wanted to use the RAID1 setup for a single OpenVZ container, is this possible? I made an ext4 partition for the RAID1 and added it to Proxmox's storage pool as a directory (/vz). I see the option of using the storage for KVM (although it's not an LVM) but for OpenVZ I do not see the option.

I already have the OpenVZ container created but I don't mind rebuilding a new one if that makes things easier.

Thanks!
 
Well I feel a bit foolish. It appears this is a limitation of OpenVZ and cannot be done at this time. Oh well, time to play with bind mounts...
 
Wow, this actually works out much better. For others who are interested, here's how I did it (since the script provided in OpenVZ's wiki does NOT work):
Instructions are abbreviated, I can provide step-by-step if needed but I figured most people on these boards know how to create and mount a new filesystem).
  1. Create a partition with your new drive (fdisk -u /dev/sdX).
  2. Make a filesystem on the new partition (mkfs.ext4 /dev/sdX#)
  3. Mount new filesystem (mount /dev/sdX# /new)
  4. Create new mount point for the bind mount (mkdir /var/lib/vz/private/VZID/new) <-- /vz/root/ was recommended but I couldn't get it to work.
  5. Create the mount file (vi /etc/vz/conf/VZID.mount)
  6. Add the following lines to the mount file:
    Code:
    #!/bin/bash
    mount -n -t simfs /new /var/lib/vz/root/VZID/new -o /new
  7. Start container (vzctl start VZID)
  8. View new mount (df)
Replace /new with your directory name and replace VZID with your container ID.

BONUS - In addition to using the new filesystem as storage for your OpenVZ VPSs, I also went into the Proxmox web GUI and added the filesystem as storage for backups to make better use of the filesystem and not have any wasted space.

I only just figured this out moments before typing this up so if I missed something please let me know!
 
See Proxmox VE 2.0 beta - you can define multiple storage for OpenVZ
 
See Proxmox VE 2.0 beta - you can define multiple storage for OpenVZ

LoL, figures I would miss something like that. Oh well, the bind mount option actually works better for me because I can use the RAID1 disk space for OpenVZ and for scheduled backups in Proxmox. :)
 
in 2.0, you can use each storage for multiple purposes. that means you can use a mount point for container, backup, storing disk images or iso files and templates.
 
You can always change container location in config files. if you edit /etc/vz/vz.conf, then, if i remember correctly, even the default location (where proxmox creates the container) will be changes to the one you like.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!