DomU-gen

From PostgreSQL_wiki
Revision as of 02:07, 6 October 2012 by Martin (talk | contribs) (post install)
Jump to: navigation, search

Gestandaardiseerd genereren van virtuele machines.

virt-install --connect qemu:///system -n test-kvm -r 256 --vcpu=1 \
--disk path=/dev/mapper/kvm150--data-data--lv--install \
-l http://mirror.webhuis.nl/debian/dists/squeeze/main/installer-amd64 \
os-type linux --os-variant debiansqueeze --accelerate \
--network=bridge:br0 --hvm --vnc --debug --extra-args 
"auto=true preseed/url=http://mirror.webhuis.nl/webhuis-preseed-noswap-squeeze.cfg
netcfg/disable_dhcp=true netcfg/get_ipaddress=10.22.23.167 netcfg/get_netmask=255.255.255.224
netcfg/get_gateway=10.22.23.161 netcfg/get_nameservers=10.22.23.187 hostname=test-kvm.webhuis.nl"

lvextend --extents +100%FREE /dev/vg-root-install/root

post install

  • Verwijder swap uit fstab van de guest
  • shutdown
  • create guest
  • guest komt op check
  • shutdown
/dev/mapper/vg--root--install-swap_1 none            swap    sw              0       0
verwijder de symlink /dev/mapper/vg--root--install-swap_1

Host

    <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/mapper/kvm150--swap-test--kvm'/>
      <target dev='vdb' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/mapper/kvm150--data-support--svn--dvg'/>
      <target dev='vdc' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>

boot met init=/bin/bash mount -rw -o remount / mkdir /hotv mv home opt tmp var -> hotv ln -s /hotv/var /var allemaal

Guest

   1  fdisk -l
   2  top
   3  fdisk -l
   4  fdisk /dev/vda
   5  ls -al /dev/mapper/
   6  df -h
   7  top
   8  df -h
   9  swapoff
  10  vi /etc/fstab 
  11  lvdisplay 
  12  swapoff /dev/vg-root-install/swap_1
  13  lvremove /dev/vg-root-install/swap_1
  14  lvdisplay 
  15  lvextend -l +100%FREE root
  16  lvextend -l +100%FREE /dev/vg-root-install/root 
  17  pvscan
  18  fdisk /dev/vdb
  19  mkswap /dev/vdb1
  20  vi /etc/fstab 
  21  mount -a
  22  top
  23  swapon
  24  swapon /dev/vdb1 
  25  top
  26  fdisk /dev/vdc
  27  mkfs.ext3 /dev/vdc1
  28  mkdir /hotv
  29  cd /hotv
  30  mkdir home opt tmp var
  31  ls -al 
  98  vgcreate data /dev/vdc1
  99  lvcreate -l +100%FREE -n htv data
 100  lvdisplay 
 101  mount -t ext3 /dev/data/htv /mnt/
 102  mkfs.ext3 /dev/data/htv 
 103  mount -t ext3 /dev/data/htv /mnt/

Ombouwen klassieke KVM LVM machine

Disk /dev/vda: 8589 MB, 8589934592 bytes
16 heads, 63 sectors/track, 16644 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00081a09

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1               3       15651     7886848   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2           15653       16643      498689    5  Extended
Partition 2 does not end on cylinder boundary.
/dev/vda5           15653       16643      498688   82  Linux swap / Solaris

Terug naar: Webhuis bouwstenen