Chinaunix首页 | 论坛 | 博客
  • 博客访问: 160375
  • 博文数量: 31
  • 博客积分: 1720
  • 博客等级: 上尉
  • 技术积分: 305
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-13 13:47
文章分类

全部博文(31)

文章存档

2014年(3)

2013年(1)

2012年(10)

2011年(1)

2010年(3)

2009年(13)

分类: LINUX

2012-07-14 17:44:43

When we use qemu-img to create one image, if we want to copy some files to this image,
we can mount the image file to one directory.

We may think of one command line as the following to mount this image:
#mount -o loop fedora.img /mount/dir
But we always encountered one problem, as the following:

[root@localhost]# mount -o loop fedora.img mountdir
mount: you must specify the filesystem type

What I am doing is as the following:
1. check the system of the image

[root@localhost kvm-test]# fdisk -lu fedora2.img

Disk fedora2.img: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa0690800

      Device Boot      Start         End      Blocks   Id  System
fedora2.img1   *        2048       10239        4096   41  PPC PReP Boot
fedora2.img2           10240     1034239      512000   83  Linux
fedora2.img3         1034240    62914559    30940160   8e  Linux LVM

2. Now, according to this information, we know can see the block size is 512 bytes.
So we need to calculate the offset of the image.
My image it equals 10240*512

Then with the following command to mount the second partition
#mount -o loop,offset=$((10240*512)) fedora.img /mount/dir

Then you can see the system under /mount/dir

[root@localhost mountdir]# ls
config-3.1.0-0.rc9.git0.2.fc16.kh.ppc64  initramfs-3.1.0-0.rc9.git0.2.fc16.kh.ppc64.img
efika.forth                              lost+found
etc                                      System.map-3.1.0-0.rc9.git0.2.fc16.kh.ppc64
grub                                     vmlinuz-3.1.0-0.rc9.git0.2.fc16.kh.ppc64

3. When we trying to mount the third parition, it will always complain this error:
[root@ltckvmopal2 kvm-test]# mount -o loop,offset=$((1034240*512)) /dev/loop0 mountdir
mount: unknown filesystem type 'LVM2_member'

Continue to fix this problem...


阅读(1522) | 评论(0) | 转发(0) |
0

上一篇:fedora iso download

下一篇:ubuntu mirrors

给主人留下些什么吧!~~