- 浏览: 1318461 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (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 2141虚拟机是Xen,但同样适用于KVM. 虚拟机硬盘格式为raw. ... -
挂载虚拟机镜像文件里的 LVM 逻辑分区
2010-10-08 10:52 2325如果按照 “在 CentOS ... -
apache 设置中的两个指令 EnableMMAP/EnableSendfile
2010-06-29 21:18 14021apache 中的目录为 windows 共享文件夹时,出 ... -
squid server
2010-03-25 23:01 1544For fine control you may need t ... -
apache 的模块安装
2010-01-23 13:18 3706Apache HTTP服务器是一个模块化的软件,管理员可以通过 ... -
redmine & ruby 在ubuntu 上的安装笔记
2009-12-05 11:07 2509edmine & ruby 在ubuntu 上的安装笔 ... -
两台linux完美实现双机热备
2009-11-12 21:39 5869一直想做基于linux的双机热备,一直没有时间和机会。一直以 ... -
windows 无盘机,更新主机名.
2009-11-11 22:03 1369同用一个镜像的无盘机,开机后更新主机名. 写个run. ... -
如何用ssh挂载远程目录
2008-10-30 11:09 1652如何用ssh挂载远程目录 ... -
How to userspace l7 filter on Ubuntu
2008-10-23 08:00 2872How to userspace l7 filter on ... -
Ubuntu 中 apache2+tomcat+mod_jk
2008-09-05 07:45 23571. 分别下载jdk和tomcat, 不建议使用源里的包,因为 ... -
Virtual Hosting With Proftpd And MySQL (Incl. Quot
2008-07-07 17:48 1798This document describes how ... -
Differences Between NFS and iSCSI
2008-06-27 09:44 1405NFS and iSCSI provide funda ... -
Ssh 无密码登录的怪问题
2008-06-23 14:21 1801今天为做Oracle RAC 做ssh的免密码登陆,出现也这个 ... -
dovecot + postfix + postfixadmin 建立mail服务器中的几个事项
2008-05-27 22:48 13725我是新手! 第一次建 ... -
在UBUNTU里安装SquirrelMail邮件服务器
2008-05-27 10:24 2577我没有在UBUNTU里安装过S ... -
查看 apache2 安装了哪些模块
2008-05-26 15:23 5325root@ubuntu-idc:/# apache2ctl - ... -
使用mod_cband管理Apache 2带宽和流量
2008-02-28 22:24 1930About the module mod_cband is ... -
Apache 1.3 基于IP限制带宽
2008-02-28 14:17 1779安装步聚: /usr/local/apache/bin/ ... -
ruby on rails应用性能优化之道
2008-01-24 11:54 3598JavaEye网站从2006年9月11 ...
相关推荐
Oracle11g on AIX6.1 安装指南(RAC + LVMOracle11g on AIX6.1 安装指南(RAC + LVMOracle11g on AIX6.1 安装指南(RAC + LVMOracle11g on AIX6.1 安装指南(RAC + LVM
5. **配置存储**:根据需求配置存储选项,如使用LVM、RAID等。 #### 四、启动Xen虚拟机 启动Xen虚拟机主要包括以下几个步骤: 1. **创建虚拟硬盘**:使用工具如`qemu-img`创建虚拟硬盘镜像。 2. **配置虚拟机**:...
- **代码示例**:`Public Const LVM_GETITEM = (LVM_FIRST + 5)` - **应用场景**:当需要获取列表中的某一项的具体信息时,如项的状态、文本等,可以使用该消息。 ##### 2. **LVM_SETITEM** - **定义**:用于...
lvm 基本命令详解 LVM(Logical Volume Manager)是一种逻辑卷管理器,用于管理磁盘分区和文件系统之间的逻辑层。它提供了一个抽象的盘卷,在盘卷上建立文件系统。 LVM 的基本术语包括: * 物理存储介质(The ...
离线安装LVM2-CentOS分区工具是一个针对CentOS操作系统的实用工具包,它包含了LVM2(Logical Volume Manager version 2)的核心组件。LVM2是Linux系统中广泛使用的磁盘管理工具,能够帮助管理员高效地管理和调整磁盘...
**LVM2(Logical Volume Manager 2)**是Linux操作系统中的一个高级磁盘管理工具,它允许用户在物理硬盘上创建逻辑卷,从而提供更大的灵活性和扩展性。LVM2比传统的分区方式更加灵活,因为它可以跨越多个硬盘,动态...
LVM(Logical Volume Manager)是Linux系统中一种高级的存储管理技术,它允许管理员将物理硬盘组织成逻辑卷,提供更灵活的磁盘管理和扩展能力。LVM2是其第二代版本,相较于第一代,它增加了更多的功能和优化,提高了...
LVM 使用手册 LVM(Logical Volume Manager,逻辑卷管理)是一种高级的磁盘存储管理技术,旨在提供更高层次的磁盘存储解决方案。它使系统管理员可以更方便地为应用程序和用户分配存储空间。在 LVM 管理下的存储卷...
"Linux LVM硬盘管理及LVM扩容" 根据提供的文件信息,以下是相关的知识点: 一、LVM简介 LVM(Logical Volume Manager)是一种逻辑卷管理系统,由Heinz Mauelshagen在Linux 2.4内核上实现。LVM可以将一个或多个...
**LVM(逻辑卷管理)**是Linux操作系统中一种先进的磁盘管理技术,它允许管理员在物理硬盘之上创建逻辑存储单元,以实现更灵活的磁盘空间管理和数据存储。LVM将物理硬盘组织成卷组(Volume Group),然后在卷组上...
Linux LVM,全称为Logical Volume Manager,是Linux操作系统下的一种磁盘管理工具,它提供了一种灵活、可扩展的方式来管理磁盘存储空间。LVM允许系统管理员创建和管理逻辑卷,这些逻辑卷可以跨越多个物理硬盘,从而...
- **LVM支持的VBD**:利用逻辑卷管理(LVM)创建虚拟磁盘。 - **NFS根目录**:通过网络文件系统(NFS)挂载虚拟机的根文件系统。 ### CPU管理 Xen支持动态调整虚拟机的CPU资源,允许用户根据实际需求调整分配给各个...
Linux 7 扩容根分区(LVM+非 LVM) Linux 7 扩容根分区是指在 Linux 7 操作系统中扩展根分区的大小,以满足存储需求。在本文中,我们将介绍使用 LVM(Logical Volume Manager)和非 LVM 两种方法来扩容根分区。 使用...
Linux LVM 硬盘管理 Linux LVM 硬盘管理是指通过 Logical Volume Manager(逻辑卷管理)来管理硬盘的存储空间。LVM 将一个或多个硬盘的分区在逻辑上集合,相当于一个大硬盘来使用。当硬盘的空间不够使用的时候,...
CentOS6.9 数据库服务器扩容手册(LVM+非LVM) 本文档旨在指导用户在 CentOS6.9 环境下扩容数据库服务器,涵盖了 LVM 和非 LVM 两种情况。该手册将分为四个部分:准备工作、LVM 扩容、非 LVM 扩容和总结。 准备...
# parted /dev/sdb set 1 lvm on ``` 修改完成后,执行`partprobe`命令更新内核分区表缓存,确保系统识别到分区类型的更改。 ```bash # partprobe ``` ### 二、创建PV、VG、LV #### 1. 使用`pvcreate`创建PV 创建...
Linux LVM(Logical Volume Manager,逻辑卷管理)是Linux操作系统中一种高级的磁盘管理工具,它提供了一种灵活的方式来组织存储空间,使得磁盘管理更为便捷和高效。本资料包整合了关于LVM管理的各种知识,涵盖了从...
3. **Logical Volume Manager (LVM)**:结合LVM可以在多个物理硬盘上创建逻辑卷,实现存储的动态扩展和备份。 4. **Xen Storage Domains (SDs)**:SDs是Xen的存储抽象,允许在不同的物理存储设备之间迁移虚拟机。 ...
### AIX LVM管理介绍 逻辑卷管理器(Logical Volume Manager, LVM)是IBM AIX操作系统中的一个重要组件,用于简化存储管理和提高数据可用性。本文将深入探讨AIX LVM的基本概念、管理方法以及一些实用技巧。 #### 1...