虚拟机镜像文件格式-raw
目前公司以raw作为虚拟机模板的储存方式,在部署虚拟机的时候,采用的是LV作为储存设备。这样的好处是可以用于局域网内的服务器共享,也方便在不同服务器上进行传输,单个服务器可以利用lv的快照特性来备份。
关于LVM的介绍,可以参考鸟哥的书关于逻辑卷管理的章节,非常的详细,讲的很清楚 http://vbird.dic.ksu.edu.tw/linux_basic/0420quota_3.php
创建及扩展raw文件
创建4G空的文件
dd if=/dev/zero of=4G.img bs=1024k count=4096
追加到原有的镜像之后
cat vm1.img 4G.img > vm1_new.img
挂在raw文件
在进行虚拟机故障排除的时候非常有用,下面是挂在方法:
[root@localhost ~]# fdisk -lu conpaas.img
last_lba(): I don't know how to handle files with mode 81a4
You must set cylinders.
You can do this from the extra functions menu.
Disk conpaas.img: 0 MB, 0 bytes
4 heads, 32 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
conpaas.img1 * 2048 4192256 2095104+ 83 Linux
Partition 1 has different physical/logical endings:
phys=(1023, 3, 32) logical=(32752, 0, 1)
查看到sectors单位和分区Start的位置,得到偏移量进行挂载
[root@localhost ~]# mount -o loop,offset=$[2048*512] conpaas.img /mnt
raw文件与lv转换
方式比较简单,直接dd就行了
dd if=/dev/vg/vm1 of=vm1.img bs=10m
dd if=vm1.img of=/dev/vg/vm1 bs=10m(必须先创建vm1逻辑卷,并且要比vm1.img文件大)
下面是virsh命令创建虚拟机用到的配置文件,‘disk’平常用的多的几种方式,以iso文件作为cdrom,raw和lv作为磁盘.
<domain type='xen'>
<name>conpaasimg2g</name>
<uuid>cab3ba1a-f7e9-4c02-8ba3-ca82abaa6312</uuid>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<vcpu>1</vcpu>
<os>
<type>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='localtime'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type='file' device='cdrom'>
<driver name='file'/>
<source file='/root/debian.iso'/>
<target dev='hdc' bus='ide'/>
</disk>
<disk type='file' device='disk'>
<driver name='file'/>
<source file='/root/debian.img'/>
<target dev='hda' bus='ide'/>
</disk>
<!--disk type='block' device='disk'>
<driver name='phy'/>
<source dev='/dev/vg/lvol30'/>
<target dev='hdb' bus='ide'/>
</disk-->
<interface type='bridge'>
<mac address='0e:27:1e:50:e4:ea'/>
<source bridge='brvlan121'/>
<script path='vif-bridge'/>
<target dev='vif-1.0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='6009' passwd='123456'/>
</devices>
</domain>
qcow2
下面有一篇关于qcow2简介的文章,收藏一下,先感谢这位作者
Qcow2文件格式简述
http://bbs.linuxtone.org/forum.php?mod=viewthread&tid=24268&fromuid=41256
另外最近研究的xtreemfs中有一个场景,
利用qcow2的快照特性以及xtreemfs的replication来快速部署大量虚拟机,再对xtreemfs熟悉一段时间后再总结。
虚拟机镜像文件格式-raw相关推荐
- 布谷鸟沙盒分析静态文件_【虚拟机镜像分析】
来源:iForensics ID:iForensics-2016 我们在工作中经常会接触到各种各样的虚拟机镜像,常见的镜像文件格式有:raw.qcow2.qed.qcow.luks.vdi.vmdk. ...
- ISO文件镜像部署至云(镜像文件格式转换)
由于阿里云需求,无法上传ISO镜像,需要将格式转化. 前两天文章有误,于此修改. 这两天测试下来以下方案对我来说较为简便. 一. 新建虚拟机并导入镜像 1. 下载并安装VirtualBox Oracl ...
- 各种虚拟化镜像文件格式
做虚拟化的朋友肯定对各种镜像文件格式比较熟悉了,下面就简单说说各大平台的镜像文件格式. 目前主要有那些格式来作为虚拟机的镜像: raw (default) the raw format is a pl ...
- vmdk文件怎么安装到虚拟机_【技术分享】虚拟机镜像解析
睿海微百科: 睿海微百科与您分享取证方案.技术经验,搜索关键词就能找到您想要的取证相关信息. 一.引言 计算机虚拟技术是通过软件来模拟计算机真实环境的技术 -- 在一台计算机上安装虚拟机后,可以模拟出 ...
- 虚拟机虚拟磁盘文件格式转换
虚拟机磁盘文件格式转换 vdi是VirtualBox出的文件格式,vmdk是VMWare出的文件格式,有个需求是将vdi文件转为vmdk文件,以至于VMWare能加载虚拟磁盘 cmd命令:D:\Ora ...
- Openstack虚拟机镜像深度实践
转载:http://geek.csdn.net/news/detail/52407?ref=myread 虚拟机镜像(以下简称镜像)是Openstack云计算平台不可或缺的一部分.利用各种定制化的镜像 ...
- 03 KVM虚拟机镜像制作
文章目录 03 KVM虚拟机镜像制作 3.1 概述 3.2 制作镜像 3.2.1 使用root用户安装qemu-img软件包 3.2.2 使用qemu-img工具的创建镜像文件 3.3 修改镜像磁盘空 ...
- qemu-img转换镜像文件格式
qemu-img转换镜像文件格式 qemu-img转换镜像文件格式 qemu-img转换镜像文件格式 命令: qemu-img convert -f qcow2 -O raw test.qcow2 t ...
- 刻录启动镜像之一:镜像文件格式详解
刻录启动镜像之一:镜像文件格式详解 Disk Image CD/DVD Live CD .iso .bin / .raw / .img .cue .dmg .nrg Disk Image 磁盘映像是包 ...
最新文章
- [ 搭建Redis本地服务器实践系列三 ] :图解Redis客户端工具连接Redis服务器
- Mac 下GitHub 访问慢解决方案
- 谷歌浏览器添加JSON-Handle插件
- 苹果计算机咋出记录,怎么查看Mac电脑的开机记录?
- PHP+Mysql实现协同办公OA系统源码演示下载
- [bbk3100]第7集 - Chapter 04 - 介绍RAC中CVU工具的使用
- 无法加载 DLL“SQLite.Interop.DLL”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)。...
- bash shell基础之二条件判断
- phpstorm 的下载、安装与激活
- PHP大转盘中奖概率算法实例
- [转载]JXTA技术与原型实现简介
- 远程桌面连接计算机下拉记录清除,Win7怎么删除远程桌面连接记录
- 稀疏矩阵乘法运算(C语言)
- 服务器拆装服务协议,在windows server 2012下安装SMB协议
- python公众号接口_用Python实现微信公众号API素材库图文消息抓取
- string的取值范围
- 内存模型系列(下)- 内存持久性模型(Memory Persistency)
- linux系统输入数字 求最大值,写函数,输入n个数字输出最大值和最小值
- 贝叶斯法则与虚假阳性的病例
- 硬盘10K和15K有什么区别?