Re: [Qemu-devel] help with understanding qcow2 file format

2016-01-29 Thread lspnet
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

[Qemu-devel] how to convert the file block using ext4 to the offset in the virtual disk

2016-01-29 Thread lspnet
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 file block(347008) 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