Cheat sheet

From PrgmrWiki

So You Wanna Administrate prgmr.com

Here's some handy commands for reference.

You can see a list of our servers here

Need to know if a dom0 has sufficient RAM for a new user? Use xm info.

There is usually enough disk space, but if you need to find out anyway, you can use lvdisplay or vgdisplay

swapip.pl will let you grab a new IP for a user. Make sure they're not configured with an IP already - this doesn't change anything except what Freeside thinks their IP is.

Lifeboat uses pmshell. The other conserver uses /usr/bin/console.

Need to upgrade a user? Modify their RAM in their /etc/xen/username configuration file, then add the disk space with lvextend.

--alloc=normal will be needed in most cases.

If the dom0 is hydra or older, you need to add a new partition with their new space using lvcreate -C y -L $DISK_in_ -n ${LVNAME} ${DG}

e.g. lvcreate -C y -L 100M -n guests username_2nd
Don't forget to add their new disk to the config file.

Need to update rDNS?

nsupdate does this; you can find the key in /usr/local/etc. There's a script to handle this dish:~/will/rdnsupdate

Here's how to move a user from one dom0 to another.

First, domucreate -f them on the new server.
# You can find the relevant details in their /etc/xen config. Distro doesn't matter, because you're going to overwrite it anyway.
Next, /sbin/kpartx -dv their disk because the partitioning might be wrong.
# Zeroing out the disk is okay if you really want to.
Now, copy over the old disk to the new server with ssh oldserver "dd if=/dev/mapper/guests-username bs=512k (or something)" | dd of=/dev/mapper/guests-username bs=512k
# if = inputfile
# of = output file
# bs = chunk size, relevant for transfer only. Larger sizes may speed up the transfer.
Finish up with kpartx -av
Make sure it works by doing something like fsck.ext3 -n or something non-writing on the filesystem.

Find the dom0 a user exists on with this script: http://www.schmalenberger.us/prgmr/dom0find