http://note19.com/category/xen/

How to prepare the disk for Fedora 8 and Xen

February 24, 2008

You should install a minimal Fedora 8 on a server that you plan to run Xen on. This includes a minimal logical volume for the host; this way you can add additional logical volumes: one for each Xen guest. Before you can do this you’ll need to understand the Fedora Logical Volume Manager (LVM2).

Let’s start with a bit of introduction. On UNIX a file-system is a structure that is defined on a set of storage devices. A storage device must be partitioned before you can create a file-system or a logical volume. Once a file-system has been created, it can be mounted on a directory.

Linux supports different types of file-systems. For example, local file-systems such as ext2, ext3, ext4, FAT, NTFS, HFS, HFS+, JFS and XFS; or network file-systems such as NFS, OpenAFS and GFS.

For Xen, a file that contains an image of a file-system is easiest for a para-virtualized virtual machine. Files that contain an image of a file-system are accessed via Xen blktap or the loop-back mechanism.

A file that contains an image of a hard disk is the easiest for a hardware virtual machine (e.g., if you plan to run an unmodified guest such as Windows). These files are accessed via hard QEMU disk emulation.

Before you can create a logical volume, you need to partition the physical drive. You do this by using the fdisk command. Next you’ll need to create a physical volume for each partition using the pvcreate command. After you’ve created a physical volume, you’ll need to add the physical volume to a volume group. You create a volume group using the command vgcreate. Next you’ll need to create a logical volume on the volume group. Finally, after you’ve created a logical volume, you are ready to create a file-system in it.

But first, here is the summary of the commands:

  1. fdisk /dev/hda
    Use the fdisk command to create one or more logical disks called partitions on the first IDE disk (hda).
  2. pvcreate /dev/hda1
    Creates a physical volume on each partition
  3. pvdisplay
    Displays the status and size of the physical volumes
  4. vgcreate VM /dev/hda1
    Add physical volume to a volume group
  5. vgdisplay VM
    Displays the status of a volume group
  6. lvcreate -L10G -n UBUNTU VM
    Creates a 10GB logical volume called UBUNTU on volume group VM. This command also creates an entry in /dev/mapper that maps the logical volume to the physical volume that it was created from. You can access a logical volume from /dev/VM/UBUNTU
  7. lvdisplay
    Displays the status and size of logical volumes

Reply via email to