Chinaunix首页 | 论坛 | 博客
  • 博客访问: 491059
  • 博文数量: 484
  • 博客积分: 10145
  • 博客等级: 上将
  • 技术积分: 5805
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-27 18:34
文章分类

全部博文(484)

文章存档

2011年(52)

2010年(107)

2009年(287)

2008年(38)

我的朋友

分类: LINUX

2010-01-10 13:15:35

修复xen虚拟机方法


来源: ChinaUnix博客  日期: 2009.12.01 19:46 (共有2条评论) 我要评论

修复xen虚拟机方法
[email=root@virt]root@virt[/email]
rruban]# file rheltest.img
fdisk -lu rheltest.img
mount -o loop,offset=32256 test.img /foldername


红帽官方解决方法:



How do I mount the image of a virtual guest using Red Hat Virtualization?
文章 ID: 15367 - 创建于: 2008-11-18 上午5:37 - 最后修改: 2009-4-3 上午7:55

Release Found: Red Hat Enterprise Linux 5


Problem

You want to mount the image of a virtual guest to access its filesystems from another system.


Solution

1. First you need to find out the partitions and the startsector of partitions of the virtual guest:
[root@virt 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



Shown above, there are three partitions inside the image file. The startsector of each partition is also listed. Boot partition will have startsector of 63.



2. Next, you need to get the sector size:
[root@virt]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 startsector byte size is 512 bytes.



3. You then must calculate the offset. To do this, use: 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 image, use:
mount -o loop,offset=32256 test.img /foldername


阅读(276) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~