Difference between revisions of "Creating a Virtual Machine from an Existing one Manually"

From Supercomputación y Cálculo Científico UIS
Line 3: Line 3:
 
Assuming an LVM setup, this is the command for allocating the required disk space (in this example 20Gb) for the main disk of the virtual machine. Another ammount is required for the swap space.
 
Assuming an LVM setup, this is the command for allocating the required disk space (in this example 20Gb) for the main disk of the virtual machine. Another ammount is required for the swap space.
  
{{Command|<nowiki> lvcreate -L20G -n machine-name volumegroup-name  
+
{{Command|<nowiki>lvcreate -L20G -n machine-name volumegroup-name
lvcreate -L20G -n machine-name-swap volumegroup-name </nowiki>}}
+
lvcreate -L20G -n machine-name-swap volumegroup-name</nowiki>}}
  
 
where machine-name and volumegroup-name are specific to the intended configuration.
 
where machine-name and volumegroup-name are specific to the intended configuration.
Line 10: Line 10:
 
The virtual units are formatted
 
The virtual units are formatted
  
mkfs.ext4 /dev/VG1/machine-name
+
{{Command|<nowiki>mkfs.ext4 /dev/VG1/machine-name
mkswap /dev/VG1/machine-name-swap
+
mkswap /dev/VG1/machine-name-swap</nowiki>}}
  
 
After the file copy, it is necessary to edit some configuration files: securetty, inittab and fstab
 
After the file copy, it is necessary to edit some configuration files: securetty, inittab and fstab

Revision as of 21:29, 22 August 2014

Back to: Xen on Debian

Assuming an LVM setup, this is the command for allocating the required disk space (in this example 20Gb) for the main disk of the virtual machine. Another ammount is required for the swap space.

lvcreate -L20G -n machine-name volumegroup-name lvcreate -L20G -n machine-name-swap volumegroup-name


where machine-name and volumegroup-name are specific to the intended configuration.

The virtual units are formatted

mkfs.ext4 /dev/VG1/machine-name mkswap /dev/VG1/machine-name-swap


After the file copy, it is necessary to edit some configuration files: securetty, inittab and fstab


vi securetty hvc0


vi inittab c1:12345:respawn:/sbin/agetty 38400 hvc0 linux

  1. c1:12345:respawn:/sbin/agetty 38400 tty1 linux


vi fstab /dev/xvda1 / ext3 defaults 1 1 /dev/xvda4 swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0



cd /dev mknod xvc0 c 204 191 mknod hvc0 c 229 0 mknod xvda b 202 0 mknod xvda1 b 202 1