Xen VM management

Source: Internet
Author: User

1. Command list:
Xm list: list of all known virtual machines
Xm create: Start an unmanaged Virtual Machine
Xm top: provides an overview of the status of all VMS
Xm console: Open the console to manage virtual machines
Xm new: Add a virtual machine to the Xenbase hosting environment
Xm start: start a VM from the Xenbase hosting environment
Xm destroy: Shut down the virtual machine as if power off.
Xm shutdown: Shut down the VM correctly
Xm reboot: restart the VM
Xm pause: pause VM activity without releasing memory resources in use
Xm unpause: Activate the VM that is paused using the xm pause command
Xm save: saves the VM status to a file.
Xm restore: restart the virtual machine that has been saved in the file.
Xm block-attach: Add a new hard disk
Xm block-detach: delete a hard disk.

2.

The following describes some important commands.
(1) display all running virtual machines

[Root @ localhost ~] # Mx 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
Performance_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 virtual machines

[Root @ localhost ~] # Xm shutdown appdata_vm
(5) restart the Virtual Machine

[Root @ localhost ~] # Xm reboot appdata_vm
(6) Increase the hard disk space of the xen Virtual Machine
Use the dd command to create a 30 GB hard disk device.
[Root @ localhost ~] # Dd if =/dev/zero bs = 1024 k 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
Format and mount the device on the VM.
[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
I found/dev/xvdb, which is the hard disk settings I just added.
[Root @ localhost ~] # Format mkfs. ext3/dev/xvdb
[Root @ localhost ~] # Mount/dev/xvdb/home to the/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 494 M 18 M 451 M 4%/boot
/Dev/xvdb 30G 173 M 28G 1%/home
Tmpfs 3.0G 0 3.0G 0%/dev/shm

My hard drive adds 30 GB space.
(7) Start A Virtual Machine
Xm start name
(8) virtual authority Power Supply
 
Xm des name
Time Setting for three VMS
Xen virtual machines sometimes need to modify the time, but the system time cannot be modified simply by date-s time. Perform the following operations:
1. Run echo 1>/proc/sys/xen/independent_wallclock under Root.
2. Run date-s 14:11:12.

Author "walking in the rain"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.