Showing posts with label ProxmoxVE. Show all posts
Showing posts with label ProxmoxVE. Show all posts

Monday, April 02, 2012

Protecting ProxmoxVE VMs with IPCop on KVM

I found out a few weeks ago that protecting openvz virtual machines running ubuntu was a bit problematic as I was unable to run UFW on them.

I was able to setup IPCop v2.04 on KVM which will act as a virtual firewall for all of the virtual machines in our ProxmoxVE 2.0 cluster

I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

Wednesday, March 28, 2012

ProxmoxVE 2: Configuring DRBD

I am running ProxmoxVE 2.0-35/d07f49c3 on two nodes connected using a cross cable on gigabit nics.
host1 ip: 10.0.10.201
host2 ip: 10.0.10.202

Check if drbd module is available
modprobe -l | grep drbd
Check if drbd module is loaded
lsmod | grep drbd
If not, load it with
modprobe -v drbd
Check the module version
modinfo drbd | grep version
I installed the appropriate drbd8-utils package on both nodes
dpkg -i drbd8-utils_8.3.10-0_amd64.deb
I built my own deb from source. You can find my build here.

I shrank the data volume on both of
I made use of the extents I freed up by shrinking the data volume to create an lvm volume that will be used for drbd.
lvcreate --verbose --extents 50000 --name lv4drbd pve
Next I modified /etc/drbd.d/global_common.conf so that it only contains:
global {
    usage-count no;
}
common {
    protocol C;
    syncer {
        rate 30M; 
    }
}
Next I created a new resouce file /etc/drbd.d/drbd0.res
resource drbd0 {
    protocol C;
    startup {
        wfc-timeout  0;
        degr-wfc-timeout 60;
        become-primary-on both;
    }
    net {
        cram-hmac-alg sha1;
        shared-secret "drbd0-secret";
        allow-two-primaries;
        after-sb-0pri discard-zero-changes;
        after-sb-1pri discard-secondary;
        after-sb-2pri disconnect;
    }
    on host1 {
        device /dev/drbd0;
        disk /dev/pve/lv4drbd;
        address 10.0.10.201:7780;
        meta-disk internal;
    }
    on host2 {
        device /dev/drbd0;
        disk /dev/pve/lv4drbd;
        address 10.0.10.202:7780;
        meta-disk internal;
    }
}
I added the IP address of the other host into each of the /etc/hosts files.

Next I started drbd on both nodes with
/etc/init.d/drbd start
I then initialized drbd metatdata on both nodes with
drbdadm create-md drbd0
Next I brought up the device on both nodes with
drbdadm up drbd0
I checked the status on both nodes with
drbd-overview
Next I started synchronization(should be instantaneous) from one node with
drbdadm -- --clear-bitmap new-current-uuid drbd0
Lastly, I restarted the drbd service on both nodes to enable Primary/Primary operation
/etc/init.d/drbd stop
/etc/init.d/drbd start

I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

ProxmoxVE 2.0: Shrinking the data volume

After installing ProxmoxVE 2.0rc1, a data volume was created which makes use of most of the space on the drive.

I wanted to carve out a separate volume for some other use so I needed to shrink this data volume:

First, I unmounted the logical volume with:
umount /var/lib/vz
Then I proceeded to shrink the file system to the minimum size possible with:
resize2fs -Mf /dev/pve/data
Then I proceeded to reduce the size of the logical volume with:
lvreduce --verbose --extents -100000 /dev/pve/data
Then I proceeded to grow the file system back to occupy the now reduced volume with:
resize2fs -f /dev/pve/data
Lastly, I remounted the file system with:
mount /dev/pve/data /var/lib/vz

I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

Wednesday, March 07, 2012

ProxmoxVE 2.0rc1 Notes:Setup

This is Part#1 of a series of posts on my experience with Proxmox 2.0rc1.

I was tasked to look for a suitable solution to build an internal cloud/virtualization infrastructure and I've decided to spend some time with ProxmoxVE 2.0rc1.

The list below is the hardware available to me:
2 desktop computers
Intel i3-530
4GB DDR3
1TB Hard drive

Things I want to try:
- benchmark disk/file IO performance of host system
- benchmark dis/file IO performance of guest system
- openvz live migration
- kvm live migration
- HA storage for the VM using DRBD
- ProxmoxVE HA i.e. guest starting on secondary node when primary node goes down
- openvz ubuntu server 10.04LTS guest running tomcat6 on sun-java6-jdk
- kvm ubuntu server 10.04LTS guest running tomcat6 on sun-java6-jdk

Installing ProxmoxVE 2.0rc1 on the hardware was fairly straight forward.
The installer took over the whole 1TB drive and partitioned it on its own.

running fdisk -l /dev/sda && df -Th revealed:
- /dev/sda1 is 495MB ext3 mounted on /boot
- dev/sda2 is 999.5GB LVM

running pvscan && vgscan revealed:
- /dev/sda2 was configured as an lvm2 physcial volume
- a volume group named pve was created by proxmox

running lvscan && mount revealed:
- a 4GB /dev/pve/swap volume was created for swap
- a 96GB /dev/pve/root ext3 volume mounted as the root file system
- a 899GB /dev/pve/data ext3 volume mounted on /var/lib/vz

Next I updated ProxmoxVE 2.0rc1 which is Debian based.
The host is behind a proxy server so to update I ran:

export http_proxy=http://10.0.0.1:3128

apt-get update && apt-get -y upgrade

I proceeded to install some useful tools:
apt-get install screen dstat

Next, I configured NTP to sync to a time server on the local network

Next I downloaded an openvz template for ubuntu 10.04LTS and proceeded to create and run a guest.

I ran across an annoying bug while accessing the guest using the console. Tab completion was not working which made it difficult to work on the web console. I found a work around and made a separate post for the web console tab fix

Stay tuned for my next post in this series: Setting up DRBD backed storage even with just one hard disk

I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

ProxmoxVE 2.0rc1 web console tab fix


I ran across an annoying bug while accessing the guest using the console. Tab completion was not working which made it difficult to work on the web console. I found a work around which modifies /usr/share/pve-manager/ext4/pvemanagerlib.js with:

cp /usr/share/pve-manager/ext4/pvemanagerlib.js /root/pvemanagerlib.js.bak

cat /usr/share/pve-manager/ext4/pvemanagerlib.js | \
sed "s/'Show Controls', value: 'No'/'Show Controls', value: 'Yes'/" \
> /usr/share/pve-manager/ext4/pvemanagerlib.js



I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.