All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] help with understanding qcow2 file format
@ 2015-09-16 10:56 Vasiliy Tolstov
  2015-09-16 11:04 ` Laszlo Ersek
  0 siblings, 1 reply; 8+ messages in thread
From: Vasiliy Tolstov @ 2015-09-16 10:56 UTC (permalink / raw
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 314 bytes --]

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.tolstov@selfip.ru

[-- Attachment #2: Type: text/html, Size: 497 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] help with understanding qcow2 file format
  2015-09-16 10:56 [Qemu-devel] help with understanding qcow2 file format Vasiliy Tolstov
@ 2015-09-16 11:04 ` Laszlo Ersek
  2015-09-16 11:15   ` Vasiliy Tolstov
  2015-09-16 13:46   ` Eric Blake
  0 siblings, 2 replies; 8+ messages in thread
From: Laszlo Ersek @ 2015-09-16 11:04 UTC (permalink / raw
  To: Vasiliy Tolstov; +Cc: qemu-devel

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] help with understanding qcow2 file format
  2015-09-16 11:04 ` Laszlo Ersek
@ 2015-09-16 11:15   ` Vasiliy Tolstov
  2015-09-16 11:58     ` Markus Armbruster
  2015-09-16 13:46   ` Eric Blake
  1 sibling, 1 reply; 8+ messages in thread
From: Vasiliy Tolstov @ 2015-09-16 11:15 UTC (permalink / raw
  To: Laszlo Ersek; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 241 bytes --]

2015-09-16 14:04 GMT+03:00 Laszlo Ersek <lersek@redhat.com>:

> 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.tolstov@selfip.ru

[-- Attachment #2: Type: text/html, Size: 802 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] help with understanding qcow2 file format
  2015-09-16 11:15   ` Vasiliy Tolstov
@ 2015-09-16 11:58     ` Markus Armbruster
  0 siblings, 0 replies; 8+ messages in thread
From: Markus Armbruster @ 2015-09-16 11:58 UTC (permalink / raw
  To: Vasiliy Tolstov; +Cc: Laszlo Ersek, qemu-devel

Vasiliy Tolstov <v.tolstov@selfip.ru> writes:

> 2015-09-16 14:04 GMT+03:00 Laszlo Ersek <lersek@redhat.com>:
>
>> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] help with understanding qcow2 file format
  2015-09-16 11:04 ` Laszlo Ersek
  2015-09-16 11:15   ` Vasiliy Tolstov
@ 2015-09-16 13:46   ` Eric Blake
  2015-09-17  7:07     ` Vasiliy Tolstov
  2016-01-29 14:40     ` lspnet
  1 sibling, 2 replies; 8+ messages in thread
From: Eric Blake @ 2015-09-16 13:46 UTC (permalink / raw
  To: Laszlo Ersek, Vasiliy Tolstov; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 920 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] help with understanding qcow2 file format
  2015-09-16 13:46   ` Eric Blake
@ 2015-09-17  7:07     ` Vasiliy Tolstov
  2015-09-17 14:38       ` Eric Blake
  2016-01-29 14:40     ` lspnet
  1 sibling, 1 reply; 8+ messages in thread
From: Vasiliy Tolstov @ 2015-09-17  7:07 UTC (permalink / raw
  To: Eric Blake; +Cc: Laszlo Ersek, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 675 bytes --]

2015-09-16 16:46 GMT+03:00 Eric Blake <eblake@redhat.com>:

> 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.tolstov@selfip.ru

[-- Attachment #2: Type: text/html, Size: 1698 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] help with understanding qcow2 file format
  2015-09-17  7:07     ` Vasiliy Tolstov
@ 2015-09-17 14:38       ` Eric Blake
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Blake @ 2015-09-17 14:38 UTC (permalink / raw
  To: Vasiliy Tolstov; +Cc: Laszlo Ersek, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 647 bytes --]

On 09/17/2015 01:07 AM, Vasiliy Tolstov wrote:
> 2015-09-16 16:46 GMT+03:00 Eric Blake <eblake@redhat.com>:
> 
>> 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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] help with understanding qcow2 file format
  2015-09-16 13:46   ` Eric Blake
  2015-09-17  7:07     ` Vasiliy Tolstov
@ 2016-01-29 14:40     ` lspnet
  1 sibling, 0 replies; 8+ messages in thread
From: lspnet @ 2016-01-29 14:40 UTC (permalink / raw
  To: qemu-devel

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: 0x000005f4

  Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    12582911     6290432   83  Linux
/dev/vda2        12584958    16775167     2095105    5  Extended
/dev/vda5        12584960    16775167     2095104   82  Linux swap 
/ Solaris

cloud@cloud-pc:$ dumpe2fs -h /dev/vad1
Filesystem volume name:   <none>
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 (<none>)
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:         0x00000dc8
Journal start:            18

cloud@cloud-pc:$ cat /etc/fstab
# /etc/fstab: static file system information.
# <file system> <mount point> <type><options><dump> <pass>
# / was on /dev/vda1 during installation
UUID=bbcbbb0e-a335-46fe-b829-b4bf7bef513b /    
           ext4    errors=remount-ro 0       1
# swap was on /dev/vda5 during installation
UUID=e2e3ec5c-dc4c-4f5d-a176-0f166b419785 none  swap  sw   0  0

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-01-29 14:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16 10:56 [Qemu-devel] help with understanding qcow2 file format Vasiliy Tolstov
2015-09-16 11:04 ` Laszlo Ersek
2015-09-16 11:15   ` Vasiliy Tolstov
2015-09-16 11:58     ` Markus Armbruster
2015-09-16 13:46   ` Eric Blake
2015-09-17  7:07     ` Vasiliy Tolstov
2015-09-17 14:38       ` Eric Blake
2016-01-29 14:40     ` lspnet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.