Re: [Qemu-devel] help with understanding qcow2 file format
hi,I have read 2015-qcow2-expanded.pdf and qcow2.txt, so I understand how to convert the offset in the virtual disk to the offset into the image file(qcow2). but I wish to know how to convert the block using ext4 to the offset in the virtual disk. Please help me. the file block information is below: cloud@cloud-pc:$ sudo debugfs /dev/vda1 debugfs: blocks /home/cloud/test 347008 cloud@cloud-pc:$ stat /home/cloud/test File: /home/cloud/test size:8 Blocks:8 IO Block:4096 regular file Device: fd01h/64769d Inode:131601 Links:1 OS' file system information is below: (ubuntu 14.04, ext4) cloud@cloud-pc:$ fdisk -l Disk /dev/vda: 8589 MB, 8589934592 bytes 16 heads, 63 sectors/track, 16644 cylinders, total 16777216 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: 0x05f4 Device Boot Start End Blocks Id System /dev/vda1 *204812582911 6290432 83 Linux /dev/vda21258495816775167 20951055 Extended /dev/vda51258496016775167 2095104 82 Linux swap / Solaris cloud@cloud-pc:$ dumpe2fs -h /dev/vad1 Filesystem volume name: Last mounted on: / Filesystem UUID: bbcbbb0e-a335-46fe-b829-b4bf7bef513b Filesystem magic number: 0xEF53 Filesystem revision #:1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options:user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 393216 Block count: 1572608 Reserved block count: 78630 Free blocks: 716304 Free inodes: 215296 First block: 0 Block size: 4096 Fragment size:4096 Reserved GDT blocks: 383 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512 Flex block group size:16 Filesystem created: Thu Jan 21 14:42:55 2016 Last mount time: Fri Jan 29 21:25:03 2016 Last write time: Fri Jan 29 21:25:03 2016 Mount count: 7 Maximum mount count: -1 Last checked: Thu Jan 21 14:42:55 2016 Check interval: 0 () Lifetime writes: 4221 MB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode:8 First orphan inode: 131699 Default directory hash: half_md4 Directory Hash Seed: 475ee556-9a7f-4c7b-93c3-21249906efea Journal backup: inode blocks Journal features: journal_incompat_revoke Journal size: 128M Journal length: 32768 Journal sequence: 0x0dc8 Journal start:18 cloud@cloud-pc:$ cat /etc/fstab # /etc/fstab: static file system information. # # / was on /dev/vda1 during installation UUID=bbcbbb0e-a335-46fe-b829-b4bf7bef513b / ext4errors=remount-ro 0 1 # swap was on /dev/vda5 during installation UUID=e2e3ec5c-dc4c-4f5d-a176-0f166b419785 none swap sw 0 0
Re: [Qemu-devel] help with understanding qcow2 file format
2015-09-16 16:46 GMT+03:00 Eric Blake: > qemu-img map file.qcow2 > > Offset Length Mapped to File qemu-img: File contains external, encrypted or compressed clusters. > is a great way to learn which physical host offsets hold the data at > which guest offsets. > > As for coding interactions with qcow2, see the source under block/qcow2.c. > > You may also be interested in the visual representation of qcow2 in my > KVM Forum slides, part 1: > > > http://events.linuxfoundation.org/sites/events/files/slides/2015-qcow2-expanded.pdf > Thanks for slides, they are very useful. -- Vasiliy Tolstov, e-mail: v.tols...@selfip.ru
Re: [Qemu-devel] help with understanding qcow2 file format
On 09/17/2015 01:07 AM, Vasiliy Tolstov wrote: > 2015-09-16 16:46 GMT+03:00 Eric Blake: > >> qemu-img map file.qcow2 >> >> > Offset Length Mapped to File > qemu-img: File contains external, encrypted or compressed clusters. qemu-img map --output=json file.qcow2 gives you a lot more information, although it still can't tell you how to directly read compressed or encrypted clusters. (And we highly recommend against using qcow2 encryption, because it is insecure by design) -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature
Re: [Qemu-devel] help with understanding qcow2 file format
2015-09-16 14:04 GMT+03:00 Laszlo Ersek: > All I can say is, "docs/specs/qcow2.txt". > Thanks! Can you provide me ordered steps that i need to do to get file contents? -- Vasiliy Tolstov, e-mail: v.tols...@selfip.ru
[Qemu-devel] help with understanding qcow2 file format
Hi, I'm need help to understand qcow2 file format, can somebody explain to me, for example if i need to read 1K from offset 512? As i'm understand i need to calculate offset in qcow2 file using some things from header, can somebody explains my how can i do that? -- Vasiliy Tolstov, e-mail: v.tols...@selfip.ru
Re: [Qemu-devel] help with understanding qcow2 file format
On 09/16/15 12:56, Vasiliy Tolstov wrote: > Hi, I'm need help to understand qcow2 file format, can somebody explain > to me, for example if i need to read 1K from offset 512? > > As i'm understand i need to calculate offset in qcow2 file using some > things from header, can somebody explains my how can i do that? All I can say is, "docs/specs/qcow2.txt". Laszlo
Re: [Qemu-devel] help with understanding qcow2 file format
Vasiliy Tolstovwrites: > 2015-09-16 14:04 GMT+03:00 Laszlo Ersek : > >> All I can say is, "docs/specs/qcow2.txt". >> > > Thanks! Can you provide me ordered steps that i need to do to get file > contents? http://git.qemu-project.org/?p=qemu.git;a=blob;f=docs/specs/qcow2.txt;h=f236d8c6d9fd55a4ae9242a10efd1e68213cbc99;hb=619622424dba749feef752d76d79ef2569f7f250
Re: [Qemu-devel] help with understanding qcow2 file format
On 09/16/2015 05:04 AM, Laszlo Ersek wrote: > On 09/16/15 12:56, Vasiliy Tolstov wrote: >> Hi, I'm need help to understand qcow2 file format, can somebody explain >> to me, for example if i need to read 1K from offset 512? >> >> As i'm understand i need to calculate offset in qcow2 file using some >> things from header, can somebody explains my how can i do that? > > All I can say is, "docs/specs/qcow2.txt". qemu-img map file.qcow2 is a great way to learn which physical host offsets hold the data at which guest offsets. As for coding interactions with qcow2, see the source under block/qcow2.c. You may also be interested in the visual representation of qcow2 in my KVM Forum slides, part 1: http://events.linuxfoundation.org/sites/events/files/slides/2015-qcow2-expanded.pdf -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature