create-disk

Posted 2012-03-29 01:49 by Joe

create-disk.pl

create-disk.pl

Adds a virtual disk to some system

This command adds a new virtual disk to a system managed by Cloudmin, typically a Xen instance. Normally, a virtual disk is a file on the host system that is mapped to a device on the instance, like /dev/sda3. However, it can also be a real disk device on the host system (such as a partiton, or a logical volume).

The system to add the disk to is specified with the --host parameter. The disk file on the host can either be set with --real followed by a filename like /xen/newdisk.img, or you can have Cloudmin choose a filename automatically with the --auto-real flag.

If your host system supports LVM and has it configured in Cloudmin, you can instead use the --lv flag followed by the name of a new logical volume to create.

The device file on the virtual system can either be set with --virt followed by a device name, or you can use --auto-virt to have Cloudmin choose an un-used device.

When adding a new file as a disk, the --size parameter must be given and followed by a disk size in megabytes. If you want it formatted with a filesystem, use the --format flag followed by a type like ext3. To have it mounted on the virtual system, use --mount flag followed by a mount point like /mnt/disk2.

For some virtualization types, you can specify if the disk is a hard disk or CD-ROM with the --media flag. This allows you to attach an existing ISO image as a CD, which will appear as a actual CD-ROM drive within the virtual system. On KVM the supported media types are disk and cdrom.

By default disk creation will fail if the specified file or logical volume already exists on the host system. You can instead force deletion of any existing file with the --overwrite flag.

Example usage

  cloudmin create-disk --host xencentos.home --auto-virt --auto-real --size 500
  Creating virtual disk for /dev/sda3 ..
  .. done. However, the disk will not be visible until the system is rebooted

Command Line Help

cloudmin create-disk --host hostname
                     --real device|file | --auto-real | --lv name
                     --virt device | --auto-virt
                    [--size MB]
                    [--device]
                    [--format filesystem]
                    [--mount directory|"swap"]
                    [--media type]
                    [--storage id|"name"]
                    [--overwrite]