Skip to content

Instantly share code, notes, and snippets.

@r4um
Last active December 10, 2015 12:48
Show Gist options
  • Save r4um/4436336 to your computer and use it in GitHub Desktop.
Save r4um/4436336 to your computer and use it in GitHub Desktop.
Create CloudStack template manually
# Create template from http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2
# Add a disk offering, assuming additional disk is at /dev/xvdb
# Partition xvdb appropiately / and a swap (5000MB), create filesystem for /, mount it under /mnt
# Change to root and rsync on disk data to new intended root aka /mnt
cd /
rsync -apv --exclude mnt --exclude proc --exclude sys . mnt/
mkdir mnt/{sys,proc}
# change root to /mnt
chroot /mnt
#mount proc and sys
mount -t proc none /proc
mount -t sysfs none /sys
# Update / and swap fstab entry to new device uuids (see list from blkid command)
blkid
vi /etc/fstab
# Make sure root UUID entry from fstab matches the one in /boot/grub/grub.cfg
update-grub
grub-install /dev/xvdb
# Update TZ to UTC
dpkg-reconfigure tzdata
# delete user
userdel -f -r user
# Exit from the chroot
exit
fdisk /dev/svdb #Disable bootflag on partition 1
fdisk /dev/xdva #Enable boot flag on partition 1
# edit /etc/default/grub and set GRUB_DEFAULT=6
vi /etc/default/grub
udpate-grub
# reboot the VM and see it comes up
reboot
# Take snapshot from DATA disk and create template from CloudStack UI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment