Home > Support > HOWTO List > Setting up a VPS with a custom file system image

Setting up a VPS with a custom file system image

Do you want to use a distro we do not offer as standard if you have a particular Xen file system image that you'd like?  If so we can support that.

Just pop in an order and in the order comments request a temporary partition separate from the default file system image we will give you.  If you already have a server, you can mount one of the backups instead and overwrite that.

You can upload your image to that file partition.  Something like the following command can copy up a file system image:

# run this from your PC or where ever.  dest is your VPS IP

rsync --rsh=ssh --compress --recursive --times --owner --group --one-file-system  --numeric-ids --links --archive \
--exclude '/proc/*' --exclude '/sys/*' \
--exclude /boot /* $dest:/backups/

You may need to 'tweak' a few things on the resulting image.  The following commands are a guideline only.  You probably should not copy/paste them unless you are confident in what they will do.

# the location from where you will ultimately be trying to boot

# you will need these devices
for i in 1 2 3 4 5 6 7 8 9 ; do  
mknod $CHROOT/dev/xvda$i b 202 $i

# set from where you can log in using the rimuhosting console over ssh feature

if [ -e $CHROOT/etc/securetty ]  && ! grep -qai tty0 $CHROOT/etc/securetty ; then 
echo "tty0" >> $CHROOT/etc/securetty

if [ -e $CHROOT/etc/securetty ]  && ! grep -qai 'vc/0' $CHROOT/etc/securetty ; then 
echo "vc/0" >> $CHROOT/etc/securetty

# in the VPS we stop it by sending it a ctrl-alt-del signal.  So we want it to shutdown when it gets this (not reboot)
if [ ! -e $CHROOT/etc/inittab.orig ]; then
     cp $CHROOT/etc/inittab $CHROOT/etc/inittab.orig
# we want something like this in inittab to shut down the vps on cad ca::ctrlaltdel:/sbin/shutdown -h now
sed --in-place 's#ctrlaltdel:/sbin/shutdown.*#ctrlaltdel:/sbin/shutdown -h now#' $CHROOT/etc/inittab

# just need the one console running

for ((i=2;i<7;i++)); do replace "$i:2345:respawn" "#$i:2345:respawn" -- /backups/etc/inittab; done
replace "1:2345:respawn:/sbin/mingetty tty1" "co:2345:respawn:/sbin/mingetty --noclear console" -- $CHROOT/etc/inittab

# install the main rimuhosting ssh key, so we can help manage the server
grep -qai rimuhosting $CHROOT/root/.ssh/authorized_keys || (mkdir -p $CHROOT/root/.ssh; echo "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIBufK3VvFDfjRAswyZibINSWLILZ4sTGuW8ffF5tmMRouGbA55SbUqjOeDQgBfUs0HRp5K34Qnw608DEhZwz6or5nSWXS3GKGBJFR+yPgkvoU4dwymKn54Y/kH0LkTtgCv2bSfnUJcWvXfxpgEnnMr3iUmVY2WvsWt4TWADsfQ6Kw== rimuhosting" >> $CHROOT/root/.ssh/authorized_keys)

# make sure we have these devices
/sbin/MAKEDEV -d $CHROOT/dev random urandom net

# NPTL / TLS does not work well with VPS setups.  Easiest to just move it out of the way
mv $CHROOT/backups/lib/tls $CHROOT/backups/lib/tls.broken

# disable 'unnecessary' services.  Or use update-rc.d if that is your distro poison
for i in cups gpm haldaemon hplip apmd ip6tables iptables kudzu acpid alsamixer
netfs nfslock nifd pcmcia smartd ; do /sbin/chkconfig --del $i; done

If you are running a distro that requires recompilations ( **cough** gentoo **cough** ), please keep it to a minimum.  The VPS is running on a host with other users.  And long compiles (e.g. over 30 minutes) or frequent recompiles are not fair on other VPS users.

In /backups/etc/inittab you should have just one getty line: co:2345:respawn:/sbin/mingetty --noclear tty1

Setup /backup/etc/fstab so it looks like your main /etc/fstab file system.  When we boot up your /backup partition we will change it to xvda1 (when at /backups it is probably running as xvda2).  i.e. leave the / entry in /backup/etc/fstab as it was originally (and maybe remove the /backup entry since that will likely not be there after the boot up to the /backup parititon when it is mounted as /).


When you're done with the setup, let us know and we will reboot your VPS with the new disto filesystem at /dev/xvda1. Be sure to let us know the root password; where your network is configured; and where there is an equivalent to rc.local on your distro so we can manually add network or sshd setup to the boot up process to get you going.

If the new file system won't boot up we can restart you with your original file system.

Also note that you should be able to access your VPS (even if it does not come up with the network working) via our console-over-ssh feature.

Note that working with custom vps images can be a bit fiddly.  We are happy to help (as with anything) though we do ask that you submit any work requests for getting the custom VPS image working under the paid type support ticket.

A support fee will apply to customers setting up a custom VPS image.  It will be the greater of $30 or $60/hr spent helping get the image remotely accessible.