Manage xen save, stop, and pause using the character tool xm

  
 

Purpose: Easily manage xen virtual machines with xm commands. Command list:

xm list: list of all known virtual machines xm create: start an unmanaged virtual machine xm top: provide a state overview of all virtual machines xm console: open console management virtual machine xm new : Add virtual machine to Xenbase hosting environment xm start: Start virtual machine xm destroy from Xenbase hosted environment: Shut down virtual machine like power off xm shutdown: Turn off virtual machine correctly xm reboot: Restart virtual machine xm pause: pause virtual The activity of the machine without releasing the memory resources used xm unpause: Activate the virtual machine xm saved with the xm pause command save: save the virtual machine state to a file xm restore: restart the virtual machine xm block-attach that has been saved in the file: Add a new hard disk xm block-detach: delete a hard disk.

The following explains some important commands (1), showing all running virtual machines

[root@localhost ~]#xm list Name ID Mem(MiB) VCPUs State Time(s ) Domain-0 0 32768 16 r----- 210.9 appdata_vm 1 6113 8 -b---- 202.3 mongo_vm 2 8191 8 -b---- 31.8 mysql_vm 3 6113 8 -b---- 31.3 queue_vm 4 6113 8 -b---- 31.5

(2), run a virtual machine

[root@localhost ~]#xm create /etc/xen/appdata_vm Using config file "/etc /xen/appdata_vm". Started domain appdata_vm

(3), enter a virtual machine for management

[root@localhost ~]#xm console appdata_vm

(4) Shut down the virtual machine

[root@localhost ~]#xm shutdown appdata_vm

(5), restart the virtual machine

[root@localhost ~]#xm reboot appdata_vm< Br>

(6), increase the hard disk space of the xen virtual machine

Use the dd command to make a 30GB hard disk device. [root@localhost ~]#dd if=/dev/zero bs=1024k count=30720 >> /data/appdata_vm.img Add to virtual machine [root@localhost ~]#xm block-attach appdata_vm tap:aio: /data/appdata_vm.img xvdb w Enter the virtual machine to format and mount the device [root@localhost ~]#xm console appdata_vm [root@localhost ~]#fdisk -l Disk /dev/xvdb: 32.2 GB, 32212254720 bytes 255 Heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/xvdb doesn't contain a valid partition table Found /dev/xvdb this is the hard drive I just added Settings. [root@localhost ~]#mkfs.ext3 /dev/xvdb Format [root@localhost ~]#mount /dev/xvdb /home Mount to /home directory. View [root@localhost ~]#df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda3 6.8G 1.9G 4.6G 30% //dev/xvda1 494M 18M 451M 4% /boot /dev/xvdb 30G 173M 28G 1% /home tmpfs 3.0G 0 3.0G 0% /dev/shm

My hard drive adds 30G of space.

Copyright © Windows knowledge All Rights Reserved