We switched over nearly a year ago. Ploop is the way to go now. I wrote a script to help the migration from simfs to ploop. The vzctl conversion process takes the VPS offline during the conversion which could be hours of downtime for large virtual servers. My script only takes the server down for a couple of minutes while rsync syncs up files.
http://blog.byteonsite.com/?p=10
Nice script but doesn't work as expected.
I took a while and fixed for everyone else who will need it. The script does a nice job
#!/bin/sh
# ./convert VEID
rsync_options='-aHv'
partition='vz'
if [ ! -e /etc/vz/conf/$1.conf ]; then
echo "Virtual server configuration file: /etc/vz/conf/$1.conf does not exist."
exit 1
fi
if [ -d /$partition/private/$1/root.hdd ]; then
echo "Server already has ploop device"
exit 1
fi
if [ ! -d /$partition/private/$1 ]; then
echo "Server does not exist"
exit 1
fi
# Get disk space in G of current VPS
disk=`vzctl exec $1 df -BG | grep simfs | awk {'print $2'} | head -n1`
if [ ! $disk ]; then
echo "Could not retrieve disk space figure. Is VPS running?"
exit 1
fi
# Create and mount file system
mkdir -p /$partition/private/1000$1/root.hdd
ploop init -s $disk /$partition/private/1000$1/root.hdd/root.hdd
cp /etc/vz/conf/$1.conf /etc/vz/conf/1000$1.conf
vzctl mount 1000$1
# Rsync over files (sync 1)
rsync $rsync_options /$partition/root/$1/. /$partition/root/1000$1/
# Stop primary, mount, sync final
vzctl stop $1
vzctl mount $1
rsync $rsync_options /$partition/root/$1/. /$partition/root/1000$1/
vzctl umount $1
vzctl umount 1000$1
mv /$partition/private/$1 /$partition/private/$1.backup
mv /$partition/private/1000$1 /$partition/private/$1
vzctl start $1
# Cleanup
rm -f /etc/vz/conf/1000$1.conf
rmdir /vz/root/1000$1
# Verification
verify=`vzlist -H -o status $1`
if [ $verify = "running" ]; then
echo "Virtual server conversion successful. Verify manually then run: rm -Rf /$partition/private/$1.backup to remove backup."
else
echo "Server conversion was not successful..Reverting.."
mv -f /$partition/private/$1 /$partition/private/$1.fail
mv /$partition/private/$1.backup /$partition/private/$1
vzctl start $1
fi
Fixes:
1) Changed disk=`vzctl exec $1 df -BG | grep simfs | awk {'print $2'}` to disk=`vzctl exec $1 df -BG | grep simfs | awk {'print $2'} | head -n1` because there may be multiple simfs per VPS(for example, cPanel's virtfs)
2) Changed mkdir /$partition/private/1000$1/root.hdd to mkdir -p /$partition/private/1000$1/root.hdd. /$partition/private/1000$i doesn't exist in the first place, hence root.hdd will fail to create. -p flag will do the trick.
3) Changed ploop init -s $/$partition/private/1000$1/root.hdd/root.hdd to ploop init -s $disk /$partition/private/1000$1/root.hdd/root.hdd. I assume Devon had a typo there.
Either way, the updated script works fine now. Thanks Devon!