월간 인기 게시물

게시물 1,372건
   
Mounting raw and qcow2 VM disk images
글쓴이 : 최고관리자 날짜 : 2012-04-02 (월) 10:16 조회 : 8577
글주소 :
                                

Mounting a partition from raw image is pretty simple:
losetup /dev/loop0 image.img
kpartx -a /dev/loop0
mount /dev/mapper/loop0p1 /mnt/image

If kernel parameter (as loop in compiled into Fedora’s kernel) like loop.max_part=63 added it is even simplier:
losetup /dev/loop0 image.img
mount /dev/loop0p1 /mnt/image

Alternative way is to specify direct offset to partition:
mount image.img /mnt/image -o loop,offset=32256


To mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:
modprobe nbd max_part=63
qemu-nbd -c /dev/nbd0 image.img
mount /dev/nbd0p1 /mnt/image


If LVM is present on image it could be initialized with:
vgscan
vgchange -ay
mount /dev/VolGroupName/LogVolName /mnt/image


Finishing is done with (depending on how it was initalized):
umount /mnt/image
vgchange -an VolGroupName
killall qemu-nbd
kpartx -d /dev/loop0
losetup -d /dev/loop0


이름 패스워드
비밀글 (체크하면 글쓴이만 내용을 확인할 수 있습니다.)
왼쪽의 글자를 입력하세요.
   

 



 
사이트명 : 모지리네 | 대표 : 이경현 | 개인커뮤니티 : 랭키닷컴 운영체제(OS) | 경기도 성남시 분당구 | 전자우편 : mojily골뱅이chonnom.com Copyright ⓒ www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.