- 浏览: 1304946 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (351)
- Java General (37)
- .net General (2)
- Linux Toy (55)
- Oracle (81)
- Mysql (11)
- Programer Career (12)
- Oh, my living ! (2)
- Shell Script (8)
- Web Service (0)
- Linux Server (22)
- Php/Python/Perl (3P) (2)
- Javascript General (5)
- Saleforce Apex Dev (2)
- Web General (5)
- Xen & VM tech. (17)
- PSP (13)
- OpenSolaris (34)
- php (1)
- RAI/flex/action script (16)
- asterisk/CTI (7)
- 交互设计 (6)
- English (3)
- Lucene (1)
最新评论
-
GuolinLee:
markmark
JVM调优总结 -Xms -Xmx -Xmn -Xss -
di1984HIT:
写的太好啊。
JVM调优总结 -Xms -Xmx -Xmn -Xss -
javajdbc:
javajdbc 写道
JVM调优总结 -Xms -Xmx -Xmn -Xss -
javajdbc:
...
JVM调优总结 -Xms -Xmx -Xmn -Xss -
alvin198761:
非常感谢,国外的被封杀了,你这里还有一份
How to Convert An Image-Based Guest To An LVM-Based Guest
How to Convert An Image-Based Guest To An LVM-Based Guest
- 博客分类:
- Xen & VM tech.
Xen: How to Convert An Image-Based Guest To An LVM-Based Guest
Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 03/09/2009
This short article explains how you can move/convert a Xen guest that uses disk images to LVM volumes. Virtual machines that use disk images are very slow and heavy on disk IO, therefore it's often better to use LVM. Also, LVM-based guests are easier to back up (using LVM snapshots ).
I do not issue any guarantee that this will work for you!
1 Preliminary Note
To use LVM-based guests, you need a volume group that has some free space that is not allocated to any logical volume. In this example, I use the volume group /dev/vg0 with a size of approx. 465GB...
vgdisplay
server1:~# vgdisplay
--- Volume group ---
VG Name vg0
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 465.28 GB
PE Size 4.00 MB
Total PE 119112
Alloc PE / Size 59842 / 233.76 GB
Free PE / Size 59270 / 231.52 GB
VG UUID gnUCYV-mYXj-qxpM-PEat-tdXS-wumf-6FK3rA
server1:~#
... that contains the logical volume /dev/vg0/root with a size of approx. 232GB and the logical volume /dev/vg0/swap_1 (about 1GB) - the rest is not allocated and can be used for Xen guests:
lvdisplay
server1:~# lvdisplay
--- Logical volume ---
LV Name /dev/vg0/root
VG Name vg0
LV UUID kMYrHg-d0ox-yc6y-1eNR-lB2R-yMIn-WFgzSZ
LV Write Access read/write
LV Status available
# open 1
LV Size 232.83 GB
Current LE 59604
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:0
--- Logical volume ---
LV Name /dev/vg0/swap_1
VG Name vg0
LV UUID SUI0uq-iTsy-7EnZ-INNz-gjvu-tqLD-rGSegE
LV Write Access read/write
LV Status available
# open 2
LV Size 952.00 MB
Current LE 238
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:1
server1:~#
I have an image-based Xen guest called xen1.example.com that I created using the following command:
xen-create-image --hostname=xen1.example.com --size=4Gb --swap=256Mb --ip=192.168.0.101 --memory=128Mb --arch=amd64 --role=udev
This is its Xen configuration file:
vi /etc/xen/xen1.example.com.cfg
# # Configuration file for the Xen instance xen1.example.com, created # by xen-tools 3.9 on Mon Mar 9 19:22:40 2009. # # # Kernel + memory size # kernel = '/boot/vmlinuz-2.6.26-1-xen-amd64' ramdisk = '/boot/initrd.img-2.6.26-1-xen-amd64' memory = '128' # # Disk device(s). # root = '/dev/xvda2 ro' disk = [ 'file:/home/xen/domains/xen1.example.com/swap.img,xvda1,w', 'file:/home/xen/domains/xen1.example.com/disk.img,xvda2,w', ] # # Hostname # name = 'xen1.example.com' # # Networking # vif = [ 'ip=192.168.0.101,mac=00:16:3E:F2:DC:FA' ] # # Behaviour # on_poweroff = 'destroy' on_reboot = 'restart' on_crash = 'restart' |
As you see, the guest is using two disk images, /home/xen/domains/xen1.example.com/disk.img (4GB) and /home/xen/domains/xen1.example.com/swap.img (256MB).
We need the exact image sizes so that we can create logical volumes of the same size. If you don't remember the exact disk and swap sizes anymore, you can go to the directory where the images are stored...
cd /home/xen/domains/xen1.example.com
... and run the following command - it will show the image sizes in human-readable format:
ls -lh
2 Converting The Images To LVM
Before we convert the images, we must shut down the guest:
xm shutdown xen1.example.com
Then we create logical volumes of the same size as the disk images, e.g. as follows:
lvcreate -L4G -n xen1_root vg0
lvcreate -L256M -n xen1_swap vg0
This creates the logical volumes /dev/vg0/xen1_root (4GB) and /dev/vg0/xen1_swap (256MB):
lvdisplay
server1:~# lvdisplay
--- Logical volume ---
LV Name /dev/vg0/root
VG Name vg0
LV UUID kMYrHg-d0ox-yc6y-1eNR-lB2R-yMIn-WFgzSZ
LV Write Access read/write
LV Status available
# open 1
LV Size 232.83 GB
Current LE 59604
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:0
--- Logical volume ---
LV Name /dev/vg0/swap_1
VG Name vg0
LV UUID SUI0uq-iTsy-7EnZ-INNz-gjvu-tqLD-rGSegE
LV Write Access read/write
LV Status available
# open 1
LV Size 952.00 MB
Current LE 238
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:1
--- Logical volume ---
LV Name /dev/vg0/xen1_root
VG Name vg0
LV UUID MQzhrS-OpOt-2IbY-BozD-l5vN-3doB-GRtyMc
LV Write Access read/write
LV Status available
# open 0
LV Size 4.00 GB
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:2
--- Logical volume ---
LV Name /dev/vg0/xen1_swap
VG Name vg0
LV UUID GHwsIT-a0sj-M72J-OVof-Ydju-Sexf-Ex824b
LV Write Access read/write
LV Status available
# open 0
LV Size 256.00 MB
Current LE 64
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:3
server1:~#
Now we can convert the images as follows:
dd if=/home/xen/domains/xen1.example.com/disk.img of=/dev/vg0/xen1_root
dd if=/home/xen/domains/xen1.example.com/swap.img of=/dev/vg0/xen1_swap
(This can take a lot of time, depending on how big the images are.)
Afterwards, we must open /etc/xen/xen1.example.com.cfg ...
vi /etc/xen/xen1.example.com.cfg
... and change...
[...] disk = [ 'file:/home/xen/domains/xen1.example.com/swap.img,xvda1,w', 'file:/home/xen/domains/xen1.example.com/disk.img,xvda2,w', ] [...] |
... to ...
[...] disk = [ 'phy:/dev/vg0/xen1_swap,xvda1,w', 'phy:/dev/vg0/xen1_root,xvda2,w', ] [...] |
You can now start the guest again:
xm create /etc/xen/xen1.example.com.cfg
If everything goes well, you can delete the disk images:
rm -f /home/xen/domains/xen1.example.com/disk.img
rm -f /home/xen/domains/xen1.example.com/swap.img
发表评论
-
Debootstrap Intrepid Server PV DomU at Xen 3.3.1 CentOS 5.2 Dom0 (all 64-bit)
2010-04-11 14:20 1854January 7, 2009 As appears ... -
Virt-install&Virt-manager at Xen 4.0-rc8 (2.6.32.10 pvops) Dom0 on top Ubuntu Ka
2010-04-11 12:06 3236Virt-install&Virt-manager a ... -
Set up Xen 3.4.3 Dom0 via xenified 2.6.31.12 kernel on top of Ubuntu 9.10 Server
2010-04-11 12:03 2354Set up Xen 3.4.3 Dom0 via xenif ... -
在 Xen 下运行 Openfiler
2010-04-05 15:26 23372010年04月5日 | 标签: ope ... -
让 Xen dom0 得到足够 CPU 处理 IO
2010-04-04 09:34 3192让 Xen dom0 得到足够 CPU 处理 IO ... -
在 Ubuntu 上安装和配置 Xen
2010-04-04 09:19 5736在 Ubuntu 上安装和配置 Xen ... -
在 CentOS 上安装和配置 Xen
2010-04-04 09:17 2426在 CentOS 上安装和配置 Xen 2 ... -
在 OpenSolaris 上安装和配置 Xen
2010-04-04 09:16 1592在 OpenSolaris 上安装和配置 Xen ... -
看中了一个vps
2010-04-04 09:11 2208http://www.vpsee.com/vps-plans/ ... -
OpenSolaris 2008.11 Paravirtualized domU on Xen 3.1.2
2009-11-21 21:57 1536By Tait Clarridgeon February ... -
centos xen rpm repo
2009-11-12 21:48 2096一位xen 虚拟化技术的支持者一直在维护的..... ... -
KVM/QEMU Emulator User Documentation
2008-07-05 20:22 9507<script type="text/ja ... -
ubuntu 8.04 KVM 中更换 cdrom iso文件
2008-07-05 19:59 24931. 启动kvm后,进入 monitor 模式 alt+ctl ... -
在VirtualBox中如何利用NAT使guest 访问host及访问其他host
2008-05-25 09:22 3802需要软件包 uml-utilit ... -
体验Windows Server 2008 RC0的虚拟化技术
2008-04-30 12:47 13202007-10-11 10:20:19 版权声明: ... -
install opensolaris domU on linux dom0
2008-03-16 08:23 1679IntroductionWith a Solaris dom0 ...
相关推荐
This is an attempt to collect everything needed to know to get LVM up and running. The entire process of getting, compiling, installing, and setting up LVM will be covered. Pointers to LVM ...
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
用于RedHat6、7通过图形化界面控制LVM分区管理,需要显示器和GNOME(GNU)图形化界面,为RedHat7光盘缺失LVM图形配置工具而准备
基于GP-LVM和LS-SVM航班延误等级预测研究.pdf
1) git clone git@github.com:projectatomic/docker-lvm-plugin.git (You can also use HTTPS to clone: git clone https://github.com/projectatomic/docker-lvm-plugin.git) 2) cd docker-lvm-plugin 3) export GO...
离线安装包,亲测可用
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
For example, if it is an lvm partition, encrypted or on USB. You can also stay in the initramfs. This can be very useful for debugging, or if you just want a very fast booting system.
RockyLinux84-zsh-lvm-160g.ova,网盘文件,永久连接
Ubuntu2004-zsh-lvm-160g.ova,网盘文件,永久连接
docker-lvm-plugin-1.13.1-47.2.gitf43d177.el7.x86_64.rpm
HP-LVM中文 惠普LVM简介PPT。 HP-LVM中文 惠普LVM简介PPT。
HP-LVM中文参考
redhat-lvm创建管理
Docker使用LVM存储配置direct-lvm模式
1-15-LVM管理.docx
官方离线安装包,测试可用。请使用rpm -ivh [rpm完整包名] 进行安装
inux-LVM管理.doc
LVM使用手册 1 简介 1.1 什么是LVM? LVM是 Logical Volume Manager(逻辑卷管理)的简写,它由Heinz Mauelshagen在Linux 2.4内核上实现,目前最新版本为:稳定版1.0.5,开发版 1.1.0-rc2,以及LVM2开发版。 与...