免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 886 | 回复: 0
打印 上一主题 下一主题

How to mount a xen image ? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-07-27 15:45 |只看该作者 |倒序浏览

1. First you need to find out the partitions and the startsector of partitions:[root@xen rruban]# file rheltest.img
rheltest.img: x86 boot sector, GRand Unified Bootloader (0.94);
partition 1: ID=0x83, active, starthead 1, startsector 63, 208782 sectors;
partition 2: ID=0x8e, starthead 0, startsector 208845, 3871665 sectors, code offset 0x48
There are 3 partitions inside the image file. The startsector of
each partition is also listed. Boot partition will have start sector 63.
2. Now you need to get the sector size:[root@xen]fdisk -lu rheltest.img
Disk rheltest.img: 0 MB, 0 bytes 255 heads, 63 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes        
Device Boot             Start         End      Blocks   Id  System
rheltest.img1   *          63      208844      104391   83  Linux
rheltest.img2          208845     4080509     1935832+  8e  Linux LVM
The above shows the sector byte size is 512 byte.
3. To calculating the offset: offset = start_sector x sector_byte_size.
The startsector is 63 for the first partition, therefore the first partition offset is: 63x512=32256
4. Finally, to mount the xen image, use: mount -o loop,offset=32256  test.img /foldername
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/22677/showart_2009138.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP