The filesystem content (VDSmanager)

From ISPWiki

Jump to: navigation, search


filesystem content (VDSmanager)

The filesystem file is located in the directory that holds the virtual machine. The file format:

line with the hard drives' images (up to four lines)

  • drive - hard drive, such as hda, hdb, hdc or hdd.
  • type - image type or creation method.
    • img - pre-defined image-file connected to the machine.
    • lvm - LVM-disk.
    • new - you need to create an image and connect it to the virtual machine. It can have img or kvm type, depending on the settings and available disk space.
    • tar - create a new disk and paste the content of the name archive.
  • name - image name. Once the filesystem file has been processed (disks have been created, etc.), the image name will renew and include a path.
  • size - if a root disk is created, this will be the minimal image size. If not, this is the image size.
  • resize-type - type of the disk resizing.
    • с - create a required disk and paste the content of the old one.
    • n - the size cannot be altered.
    • r - changing the file size (or the lvm-device). The file system must be resized with user privileges.



A 5000 MB virtual hard drive will be created. Its size cannot be altered.

Connecting an iso-image


Please note, that cdrom is connected as secondary master disk, thus the hdc-disk and cdrom disks cannot be used together.



Booting from the first hard drive


Booting from с cd-rom The latest versions of ofqemu-kvm allow you to set priority and call the boot menu (see man qemu)

Root partition

This parameter is used for configuring the settings and changing image size.


Creating disk templates for KVM (VDSmanager)

To convert a KVM-based virtual machine into a template

  1. Follow the procedures below
    1. Copy the template content to the directory that holds the virtual machine (normally, /kvm/machines/NAME/ )
    2. Execute the /kvm/machines/NAME/install script (a parameter is a path to the directory with virtual machine)
    3. Process the file filesystem
    4. Create the net.conf with parameters file
    5. Execute the network_conf script
    6. Execute the setpass script
  2. You need to know the following scripts for setting up the network and root password.
    1. network_conf - configuring the network. Parameters that are transferred to the script
      • $1 - path to the virtual machine directory
      • $2 - path to the catalogue with the root image
    2. setpass - setting up the root passwords. Parameters:
      • $1 - path to the virtual machine directory
      • $2 - path to the catalogue with the root image
      • $3 - root hash password
  3. To run the configuration scripts, the file system must be "known" to the images , for example, ext2 or ext3

If the network_conf or setpass files are missing, VDSmanager will copy the template and try to alter the hard drive image size.

For the system to boot correctly, two hard drivers are installed: the first disk is a boot drive with the mounting point /boot, the second disk is the main drive with the mounting point /.

For example, we have created a VPS with two hard drives, such as hda - /kvm/machines/ 200 MB in size and hdb - /kvm/machines/ 4Gb in size. Its name is, the IP-address is The operating system is Fedora-12-i386.

Once the system has been installed, you need to make it work as a template

  1. Edit /boot/grub/grub.conf, /etc/fstab
  2. Disable selinux

Please note, that a hard drive partition created during the installation process will be called /dev/sdb1 If you wish to create partitions through VDSmanager and change their size, you need to change /dev/sdb1 into /dev/sdb in the guest system.

Mount the root disk image to the /tmp/mnt directory

mount -o loop,offset=32256 /kvm/machines/ /tmp/mnt

The offset parameter defines the address of the partition's beginning (normally, this is sector 63, a sector size is 512 byte). Run the command below to learn information about partitions

fdisk -lu /kvm/machines/

If the partition was created through VDSmanager, you do not need to provide the parameter.

Archive the disk content:

tar -czpf /kvm/machines/ -C /tmp/mnt .
umount /tmp/mnt

Create a directory for the template

mkdir /kvm/template/TEMPLATE-NAME

Copy the machine into that directory

cp /kvm/machines/* /kvm/template/TEMPLATE-NAME

Delete the old disk

rm /kvm/template/TEMPLATE-NAME/


mv /kvm/template/TEMPLATE-NAME/ /kvm/machines/

if the boot partition for our machine is created as lvm, add the command

dd if=/dev/kvm00/ of=/kvm/template/TEMPLATE-NAME/boot.img


tar -czf /kvm/template/TEMPLATE-NAME/image /kvm/template/TEMPLATE-NAME/boot.img /kvm/template/TEMPLATE-NAME/root.tgz


rm /kvm/template/TEMPLATE-NAME/boot.img /kvm/template/TEMPLATE-NAME/root.tgz

Delete the old machine from VDSmanager

Edit the filesystem file:



tar -xzf $1/image -C $1
rm $1/image

Edit /usr/local/ispmgr/etc/vdsmgr.conf add the lines below

disktemplate "TEMPLATE-NAME" {
	Path /kvm/template/TEMPLATE-NAME
	Status ok

The template is ready.

Was this helpful? Yes | No
Personal tools