`

XM Commands

阅读更多

XM Commands

http://www.techotopia.com/index.php/Managing_Xen_using_the_xm_Command-line_Tool
List which virtual machines are running right now.
# xm list

Start the vm. By convention we will always have a file called vm.cfg
# xm create vm.cfg

Kill the power to vm: vm01, i.e. a hard shutdown
# xm destroy vm01

Monitors a host and its domains in real time# xm top 

Send the vm: vm01 the shutdown command, like doing a shutdown inside the vm
# xm shutdown vm01

Current status of the guest operating system is written to disk and removed from system memory
# xm suspend vm01

restore vm01 (any time including after a host system reboot)
# xm resume vm01

Not Finished:
add a disk to a running vm: xm block-attach <Domain Id> <Backend Device> <Frontend Device> <Mode>. Domain Id is got from xm list command under the id column, 
# xm block-attach 3 phy:/dev/sr0 /dev/xvda2 r

Split / Join files

Sometime the files are too big to put on FAT32 thumbdrives. Use the split and cat commands here:

Split the file system.img into 3Gig chunks
# split --bytes=3000m system.img

Join up the files system.img.part1, system.img.part2, etc... into the file system.img
# cat system.img.part* > system.img

Make an extra Linux file system for your VM

Make a blank file 2 gigs large named stellent.img that will serve as our new disk
# dd if=/dev/zero of=stellent.img bs=1M count=2048

Edit the configuration file (/etc/xen/vm03), like below, adding the second line, notice xvda goes to xvdb
disk = [ 'file:/OVS/running_pool/vm03/system.img,xvda,w', 'file:/OVS/running_pool/vm03/stellent.img,xvdb,w']

The above line may also look like, the following, in that case use hdb in place ov xvdb.
disk = [ 'file:/OVS/running_pool/ucm1/system.img,hda,w','file:/OVS/running_pool/ucm1/stellent.img,hdb,w' ]

(NOTE) don't think you can use 'hdc' (only a and b), so you can use a combo of hd and xvd!

The following instructions came from the following link, use it as a reference if these instructions don't make sense
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch27_:_Expanding_Disk_Capacity#Expanding_Partitions_With_LVM

Here we created a new device, /dev/xvdb. Now we start up the vm and run fdisk 
# fdisk /dev/xvdb

You'll get some error messages saying you don't have a valid partition table. Create a new partition, 'n', primary = 'p', partition number = '1', default first and last cylinders.

List this partition table 'p' now and notice the Id type is 83 or something. Change this to 8e. 't', '8e'. List the partition table 'p', again, notice the new Id type is 8e. Save partition table 'w'.

Create a physical volume from this device
# pvcreate /dev/xvdb1

Create the logical volume group from the physical device
# vgcreate lvm-oracledb /dev/xvdb1

Create the logical volume using 100% of the free space in the logical group lvm-oracledb
# lvcreate -l 100%FREE lvm-oracledb -n lvm0

Format the file system
# mkfs -t ext3 /dev/lvm-oracledb/lvm0 

Create a mount point
# mkdir /oracledb

Add the following to /etc/fstab to automatically mount the volume when the computer starts up
/dev/lvm-oracledb/lvm0 /oracledb ext3 defaults 1 2
Mount the volume
# mount -a

DONE!!!

Remove a Disk (LVM)

Remove /etc/fstab entry
[root@vl-ucm1 ~]# vi /etc/fstab

Unmount the device, get device name with: lvdisplay
# umount /dev/lvm-stellent/lvm0

OR

[root@vl-ucm1 /]# ls /u01
downloads lost+found oracle
[root@vl-ucm1 /]# umount /u01
[root@vl-ucm1 /]# ls /u01
[root@vl-ucm1 /]# 


If you get: 
[root@vl-ucm1 /]# umount /dev/lvm-stellent/lvm0
umount: /u01: device is busy


Find out what is using the device with: 
[root@vl-ucm1 /]# fuser -m /dev/lvm-stellent/lvm0
/dev/lvm-stellent/lvm0: 3557m 3620m 3621m 3622m 3623m 3624m 3625m 3626m 3627m
[root@vl-ucm1 /]# ps auxw| grep 3557
root 3557 0.0 0.5 10856 3104 ? Ss 10:55 0:00 /usr/sbin/httpd

[root@vl-ucm1 /]# service httpd stop
Stopping httpd: [ OK ]
[root@vl-ucm1 /]# umount /dev/lvm-stellent/lvm0
[root@vl-ucm1 /]# df -h

And you should no longer see the disk with 'df'

Remove any entries from /etc/httpd/conf/httpd.conf that refer to this disk.

use lvremove to remove the logical volume
[root@vl-ucm1 /]# lvremove /dev/lvm-stellent/lvm0
Do you really want to remove active logical volume "lvm0"? [y/n]: y
Logical volume "lvm0" successfully removed


use lgdisplay and lgremove to remove logical group
[root@vl-ucm1 /]# vgremove lvm-stellent
Volume group "lvm-stellent" successfully removed


use pvdisplay and pvremove to remove physical volume
[root@vl-ucm1 /]# pvremove /dev/hdb1
Labels on physical volume "/dev/hdb1" successfully wiped


remove partition with fdisk /dev/hdb, 'd', enter, 'w' = write partition and exit
# fdisk /dev/hdb

Remove the disk entry from the vm.cfg file, and restart the vm.

分享到:
评论

相关推荐

    FIBOCOM L610 Series AT Commands_V3.6.9.pdf

    FIBOCOM L610 Series AT Commands Fibocom L610 Series AT Commands 是一份关于 Fibocom L610 系列设备的 AT 命令手册,提供了详细的 AT 命令集和使用指南。该手册面向开发者、测试工程师和技术支持人员等,旨在...

    Laravel开发-commands

    此外,Artisan也支持自定义命令,开发者可以根据项目需求创建自己的命令,这正是“Laravel开发-commands”所关注的领域。 二、自定义Artisan命令 创建自定义Artisan命令的步骤如下: 1. 使用`...

    SCSI_Primary_Commands_4.pdf

    根据给定文件的信息,我们可以深入探讨SCSI(小型计算机系统接口)Primary Commands 4(SPC-4)的相关知识点。这份文档是信息技术领域内SCSI初级命令集的详细指南,由T10技术委员会(隶属于国际信息技术标准委员会...

    compile_commands.json

    win10下vim开发stm32编译数据库文件例子

    SCSI Primary Commands - 4 (SPC-4)

    SCSI Primary Commands - 4 (SPC-4) spc4r25 This is an internal working document of T10, a Technical Committee of Accredited Standards Committee INCITS (InterNational Committee for Information ...

    FreeBSD Commands

    FreeBSD Commands It is useful!

    SCSI Block Commands – 3 (SBC-3).pdf

    此标准规定了SCSI Block Commands - 3(SBC-3)命令集的功能要求.SBC-3允许SCSI块逻辑单元(如刚性磁盘)连接到计算机并提供其使用的定义。 该标准与SCSI Block Commands(SBC-2)命令集INCITS 405-2005保持高度兼容...

    Linux_Commands and_Shell_Programming_2nd

    书名为《Linux Commands and Shell Programming 2nd》,即第二版《Linux命令及Shell编程实用指南》,作者为Mark G. Sobell。这本书被描述为Linux命令行操作和Shell编程的必备读物,其内容通俗易懂,翔实可靠,专注于...

    Python库 | rt.commands-0.1.zip

    在本文中,我们将深入探讨一个名为"rt.commands"的Python库,该库的版本为0.1,已经封装在一个zip压缩包中。 "rt.commands-0.1.zip"是一个包含了"rt.commands"库的压缩文件,它可能是为了便于分发、存储和安装而...

    SCSI Block Commands – 3

    ### SCSI Block Commands – 3 (SBC-3):关键技术知识点概述 #### 一、SCSI Block Commands – 3 概述 SCSI Block Commands – 3 (SBC-3) 是一项重要的信息技术标准,旨在定义用于存储设备的命令集,特别是针对块...

    SCSI Block Commands - 3(SBC-3)

    此SCSI Block Commands - 3 (SBC-3) 是一种 SCSI 标准,专门用于定义和规范块设备的命令和操作。块设备通常是存储设备,如硬盘驱动器和固态硬盘,这些设备以块为单位读写数据。SBC-3 标准包括了一组命令、数据传输...

    Commands with JSP.jsp

    使用想服务器上传jsp执行windows或者linux命令,来获取服务器的资源情况。 Commands with JSP.sjp

    SCSI-3 Multimedia Commands

    SCSI-3 Multimedia Commands

    cicd自动化,使用官方提供脚本文件生成compile_commands.json,供clang工具使用

    cicd自动化,使用官方提供脚本文件生成compile_commands.json,供clang工具使用

    SCSI Block Commands – 3 (SBC-3)

    ### SCSI Block Commands – 3 (SBC-3):关键技术解析与应用 #### 一、SCSI Block Commands – 3 (SBC-3)概述 SCSI Block Commands – 3 (SBC-3),作为信息技术领域的一项重要标准,旨在定义一系列用于SCSI设备的...

    Eclipse Commands Framework教程

    ### Eclipse Commands Framework 教程知识点解析 #### 一、引言 本文档是关于Eclipse Commands Framework的一个详尽教程,由Lars Vogel撰写,并由司马先生进行了中文翻译。该教程分为两个部分:“Eclipse Commands ...

    The Linux Commands Handbook

    The Linux Commands Handbook follows the 80/20 rule: learn in 20% of the time the 80% of a topic. The author find this approach gives a well-rounded overview. This book does not try to cover ...

Global site tag (gtag.js) - Google Analytics