- 浏览: 1305219 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (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
Moving a Xen Guest into an LVM container from a loopback sparse image is easy enough.
You’ll need to power down the VM using xm shutdown mymachine
Once done, create the logical volume with: lvcreate –name mymachine-disk –size 10G myvg 10G should match the exact size (if not more) of your current VM. Now create the same for the swap file: lvcreate -name mymachine-swap -size 128M myvg. Now edit your machine’s config (/etc/xen/mymachine.cfg), replacing the disk part from:
disk = [
'file:/xen/mymachine/mymachine-swap,sda1,w',
'file:/xen/mymachine/mymachine-disk,sda2,w',
]
to
disk = [
'phy:/dev/myvg/mymachine-swap,sda1,w',
'phy:/dev/myvg/mymachine-disk,sda2,w',
]
And use dd to write the disk to your new LVM filesystem:
dd if=/xen/mymachine/mymachine-disk of=/dev/myvg/mymachine-disk
dd if=/xen/mymachine/mymachine-swap of=/dev/myvg/mymachine-swap
Remembering that you can use killall -SIGUSR1 dd at any time to gain a status update on dd’s IO.
Once done, power up your VM again with xm create mymachine.cfg
When using XEN virtualization it's good practice to use LVM volumes as raw disk devices for the vm guests. The main advantage is that there is no file system for the Xen host to manage and the guest has direct access to the physical volume = better performance!
Another advantage is that you can leverage LVM snapshots adding a similar function to your Xen setup as known in VMWare.
One drawback when using LVM for your virtual guests is that the vm's disk is less portable. There are tools that can handle LVM imaging, but dd is the OSS tool giving you a 1:1 copy of your disk. It's free & it's proven.
dd's known drawback is that the dd dump files get big and time to backup/restore a LVM volume can be lengthy.
Here's how to speed things up and also save on space needed for your LVM images & backups by combining dd with gzip. On modern hardware you can get speeds up to ~90Mb/sec - meaning you can restore a template or image of 15 GB in 3 to 4 minutes.
NOTE: With big data partitions containing a small percentage of data (25% or less of the disk total), it's better to use traditional backup methods. Here dd will lose you precious time backing up parts that contain no real data.
To create an image from the LVM volume:
NOTE: Always make sure your guest is shutdown to ensure data integrity.
dd if=/dev/[lvmsystem]/[lvmpartition] bs=64k | gzip -c > /[path for your image file]/[machine_disk name].img.gz
This command tells dd to use your LVM volume as input using a block size of 64k, the pipe then hands this input stream over to gzip and that zips the stream to the given img.gz file.
* If your source LVM volume contains errors due to disk failure or other, you can tell dd to copy all parts of the disk it can acces. To do this add options conv=sync,noerror before the bs=64k statement.
Restore and Image / Template to an LVM volume:
*If necessary first create a LVM volume where you want the copy written back. It must be at lease the same size (or bigger) than the original LVM volume where the image was taken from.
gunzip -c /[path containing your image file]/[machine_disk name].img.gz | dd of=/dev/[lvmsystem]/[lvmpartition] bs=64k
1. Yes, you can have a seperate LV per Xen guest OS and you should of course.
2. LVM snapshots go something like this.
Snapshotting is a way to take a "point-in-time" image of a filesystem. What this allows you is to do is access files that would normally be locked so you can back them up. The process is as follows:
- Take the snapshot
- Mount the snapshot
- Take a backup of the snapshot
- Unmount and destroy the snapshot
When you take the snapshot, you're essentially creating a new LVM device that appears to be a duplicate of the "real" filesystem at a point in time. To do this we create another LVM device (using lvcreate) with an argument of -s to indicate we want a snapshot and the -n argument to name it. In this case LogVol00 is the original LV and LVsnap is the name of the snapshot. You can name them whatever you want.
lvcreate -l 500 -s -n LVsnap /dev/VolGroup00/LogVol00
Mounting the snapshot
Next, we mount the snapshot somewhere else, we use /media/snap. We also mount it read only.
mkdir /media/snap mount -o nouuid,ro /dev/VolGroup00/LVsnap /media/snap
Now, backup /media/LVsnap like you would any other directory:
Unmount and destroy the snapshot
Now we have to unmount the snapshot and destroy it. The reason we destroy it because any I/O that takes place on the device uses space to track the differences betweeen the real and the snapshot filesystem. Plus, we've done our job so there's no reason to keep it around.
unmount /media/LVsnap lvremove -f /dev/VolGroup/LVsnap
3. Migrating an LV depends some on whether you have to depend on a bootloader in the LV or not. You could do any of the following depending on your circumstances.
- Snapshot the old LV, create a new LV on the destination machine, export it with NFS and copy all files across using cp.
- Snapshot the old LV, create a new LV on the destination, export it with NFS and use dump and restore to dum the old LV to the new one.
dump 0 -f - /dev/VolGroup00/LogVol00 | (cd /dest; restore -rf - )
- Snapshot the old LV, create a new LV on the destination machine, and dd the snapshot and pipe it into ssh
dd if=/dev/VolGroup00/LVsnap | ssh -c arcfour 192.168.2.100 "dd of=/dev/VolGroup00/LogVol00"
I don't think I have to tell you to be VERY careful with the last one. If you get the destination Logical Volume screwed up you will toast the destination. I specified arcfour for the cipher because it's much faster than the default. You will probably want to mess with dd's blocksize too as you can double the speed in which dd will copy if the blocksize is larger. Another option would be to use ddrestore or dd_restore in place of dd. Make sure you look at the syntax difference first. Both of these are faster than stock dd but if you bump the blocksize dd will almost keep up. I assume you only keep the VM OS on the LV and not all data. If so then it won't take long to copy. It takes about 45 min per 80 GB here. If you're running a 10GB OS LV then you can figure about 5 minutes.
发表评论
-
扩大虚拟机硬盘空间的方法
2010-11-18 07:53 2107虚拟机是Xen,但同样适用于KVM. 虚拟机硬盘格式为raw. ... -
挂载虚拟机镜像文件里的 LVM 逻辑分区
2010-10-08 10:52 2267如果按照 “在 CentOS ... -
apache 设置中的两个指令 EnableMMAP/EnableSendfile
2010-06-29 21:18 13965apache 中的目录为 windows 共享文件夹时,出 ... -
squid server
2010-03-25 23:01 1510For fine control you may need t ... -
apache 的模块安装
2010-01-23 13:18 3673Apache HTTP服务器是一个模块化的软件,管理员可以通过 ... -
redmine & ruby 在ubuntu 上的安装笔记
2009-12-05 11:07 2477edmine & ruby 在ubuntu 上的安装笔 ... -
两台linux完美实现双机热备
2009-11-12 21:39 5820一直想做基于linux的双机热备,一直没有时间和机会。一直以 ... -
windows 无盘机,更新主机名.
2009-11-11 22:03 1341同用一个镜像的无盘机,开机后更新主机名. 写个run. ... -
如何用ssh挂载远程目录
2008-10-30 11:09 1618如何用ssh挂载远程目录 ... -
How to userspace l7 filter on Ubuntu
2008-10-23 08:00 2837How to userspace l7 filter on ... -
Ubuntu 中 apache2+tomcat+mod_jk
2008-09-05 07:45 23271. 分别下载jdk和tomcat, 不建议使用源里的包,因为 ... -
Virtual Hosting With Proftpd And MySQL (Incl. Quot
2008-07-07 17:48 1758This document describes how ... -
Differences Between NFS and iSCSI
2008-06-27 09:44 1378NFS and iSCSI provide funda ... -
Ssh 无密码登录的怪问题
2008-06-23 14:21 1782今天为做Oracle RAC 做ssh的免密码登陆,出现也这个 ... -
dovecot + postfix + postfixadmin 建立mail服务器中的几个事项
2008-05-27 22:48 13687我是新手! 第一次建 ... -
在UBUNTU里安装SquirrelMail邮件服务器
2008-05-27 10:24 2542我没有在UBUNTU里安装过S ... -
查看 apache2 安装了哪些模块
2008-05-26 15:23 5287root@ubuntu-idc:/# apache2ctl - ... -
使用mod_cband管理Apache 2带宽和流量
2008-02-28 22:24 1900About the module mod_cband is ... -
Apache 1.3 基于IP限制带宽
2008-02-28 14:17 1751安装步聚: /usr/local/apache/bin/ ... -
ruby on rails应用性能优化之道
2008-01-24 11:54 3549JavaEye网站从2006年9月11 ...
相关推荐
Oracle11g on AIX6.1 安装指南(RAC + LVMOracle11g on AIX6.1 安装指南(RAC + LVMOracle11g on AIX6.1 安装指南(RAC + LVMOracle11g on AIX6.1 安装指南(RAC + LVM
AIX LVM管理介绍 AIX LVM管理介绍 AIX LVM管理介绍 AIX LVM管理介绍
详细描述了lvm的使用,给出了具体lvm的操作命令等
Linux LVM硬盘管理及LVM扩容
lvm2离线安装包,亲测可用,直接执行install.sh
此资源包括lvm虚拟机指令集,lvm虚拟机VC2008源码,lasm(lvm 汇编程序汇编器)VC2008源代码 及一些相关的开发文档,说明文件! lvm2.0 为第一版本的升级版。里面还有obj文件说明,.lef文件说明,详细源码(运行时,...
教程名称:LVM动态磁盘逻辑卷讲解视频(11集)课程目录:【】1、LVM逻辑卷应用场景【】2、LVM逻辑卷扩展概念【】3、LVM逻辑卷快照概念【】4、LVM逻辑卷pv介绍【】5、LVM逻辑卷vg介绍【】6、LVM逻辑卷vg创建【】7、LVM...
lvm的基本命令的详细解读,对于初步学习linux的操作人员,lvm是必须掌握的基本命令。
HPUX的LVM基本流程
ListView Messages (LVM_)ListView控件类的消息常量常量
Linux LVM硬盘管理及LVM扩容管理,文章详细易懂,并附图片
linux 重装系统后 挂载原有LVM磁盘分区 linux 重装系统后 挂载原有LVM磁盘分
LVM(逻辑卷管理) 实例详解;
LVM简要操作说明;含创建和拓展实操例子。 LVM --logical volume manager 逻辑卷管理器。 LVM的优点是可以动态调整存储空间。 LVM由以下四部分组成: PE: physical extend 物理扩展块 属于逻辑概念 创建VG后自动生成...
lvm代码可以编译亲测可用,使用时可参考我的博客https://mp.csdn.net/console/editor/html/108409388
Docker使用LVM存储配置direct-lvm模式
LVM实验完全手册PDF文件下载 LVM实验完全手册PDF文件下载
Linux环境下LVM源码分析,介绍的很详细。
lvm-on-luks:lu用于在luks上使用lvm为Ubuntu提供完整分区加密(可选包括引导)的脚本,用于多次引导