creating Ubuntu based VM Template

Mainly you will need to create Ubuntu VM manually and then do the following steps to the template before converting it to Template

  1. create new Ubuntu vm and while installing it make sure you do the following steps
    • make the boot partition is separate from other partitions (you can choose any file system for it)
    • remaining partitions should be lvm based storage be on lvm based storage
          so that after you are done installing the following when you do lvdisplay
      lvdisplay
        --- Logical volume ---
        LV Name                /dev/ubuntu/root
        VG Name                ubuntu
        LV UUID                FRarW6-pk6o-BibE-dkIy-3c8O-U1l9-en27mC
        LV Write Access        read/write
        LV Status              available
        # open                 1
        LV Size                19.39 GiB
        Current LE             4964
        Segments               2
        Allocation             inherit
        Read ahead sectors     auto
        - currently set to     256
        Block device           254:0
      
        --- Logical volume ---
        LV Name                /dev/ubuntu/swap_1
        VG Name                ubuntu
        LV UUID                s4PNXH-vtLx-U09C-Ggzn-2wg6-vbFC-qReidn
        LV Write Access        read/write
        LV Status              available
        # open                 1
        LV Size                376.00 MiB
        Current LE             94
        Segments               1
        Allocation             inherit
        Read ahead sectors     auto
        - currently set to     256
        Block device           254:1

      and df output is

      df -h
      Filesystem            Size  Used Avail Use% Mounted on
      /dev/mapper/ubuntu-root
                             20G   14G  4.8G  74% /
      tmpfs                 751M     0  751M   0% /lib/init/rw
      udev                  737M   76K  737M   1% /dev
      tmpfs                 751M     0  751M   0% /dev/shm
      /dev/xvda1            228M   16M  201M   8% /boot
      
      

      Note: the sizes are not important

get the script file: xenicastart.sh from your xenica package (or you can get it from HERE) and put inside /etc/ so that you will have the file locations as follows

/etc/xenicastart.sh

assign the executable mode to the file by the command

chmod +x /etc/xenicastart.sh

Open the file /etc/rc.local in edit mode and put the line

/etc/xenicastart.sh

inside /etc/rc.local

(echo n; echo p; echo 3; echo 16775168; echo ; echo t; echo 3; echo 8e; echo w) | fdisk -u /dev/xvda

to the number you got in step 5 +1