1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
|
KVM: 0.780
other: 0.770
graphic: 0.767
assembly: 0.749
semantic: 0.739
instruction: 0.735
device: 0.733
mistranslation: 0.732
vnc: 0.712
boot: 0.701
network: 0.680
socket: 0.670
Large VHDX image size
We are trying to convert a VMDK image to VHDX image for deploy to HyperV Server ( SCVMM 2012 SP1) using qemu-img.
We tried converting the image using both 'fixed' as well as 'dynamic' format. We found that both the disks occupy the same size of 50GB. When the same is done with VHD image, we found that the dynamic disks are much lesser in size (5 GB) than the fixed disk (50GB).
Why is that the VHDX generates large sized images for both the formats?
The following commands were used to convert the vmdk image to VHDX format
1. qemu-img convert -p -o subformat=fixed -f vmdk -O vhdx Test.vmdk Test-fixed.vhdx
qemu-img info Test-fixed.vhdx
image: Test-fixed.vhdx
file format: vhdx
virtual size: 50G (53687091200 bytes)
disk size: 50G
cluster_size: 16777216
2. qemu-img convert -p -o subformat=dynamic -f vmdk -O vhdx Test.vmdk Test-dynamic.vhdx
qemu-img info Test-dynamic.vhdx
image: Test-dynamic.vhdx
file format: vhdx
virtual size: 50G (53687091200 bytes)
disk size: 50G
cluster_size: 16777216
We tried this with the following version of qemu
1. qemu-2.0.0
2. qemu-2.1.2
3. qemu-2.2.0-rc4
Please let us know how to create compact VHDX images using qemu-img.
Thank you
On Thu, Dec 04, 2014 at 01:31:38PM -0000, AMULYA L wrote:
> Public bug reported:
>
> We are trying to convert a VMDK image to VHDX image for deploy to HyperV Server ( SCVMM 2012 SP1) using qemu-img.
> We tried converting the image using both 'fixed' as well as 'dynamic' format. We found that both the disks occupy the same size of 50GB. When the same is done with VHD image, we found that the dynamic disks are much lesser in size (5 GB) than the fixed disk (50GB).
>
> Why is that the VHDX generates large sized images for both the formats?
>
> The following commands were used to convert the vmdk image to VHDX
> format
Jeff, did you fix this recently in commit
85b712c9d5b873562c864e72f69cbf0d87d2fe40 ("block: vhdx - set
.bdrv_has_zero_init to bdrv_has_zero_init_1")?
Stefan
On Wed, Jan 07, 2015 at 03:30:28PM +0000, Stefan Hajnoczi wrote:
> On Thu, Dec 04, 2014 at 01:31:38PM -0000, AMULYA L wrote:
> > Public bug reported:
> >
> > We are trying to convert a VMDK image to VHDX image for deploy to HyperV Server ( SCVMM 2012 SP1) using qemu-img.
> > We tried converting the image using both 'fixed' as well as 'dynamic' format. We found that both the disks occupy the same size of 50GB. When the same is done with VHD image, we found that the dynamic disks are much lesser in size (5 GB) than the fixed disk (50GB).
> >
> > Why is that the VHDX generates large sized images for both the formats?
> >
> > The following commands were used to convert the vmdk image to VHDX
> > format
>
> Jeff, did you fix this recently in commit
> 85b712c9d5b873562c864e72f69cbf0d87d2fe40 ("block: vhdx - set
> .bdrv_has_zero_init to bdrv_has_zero_init_1")?
>
> Stefan
Yes, although there has been a report that there are issues in the
resulting vhdx image in a MS server, after this patch. I am going to
test and fix (if confirmed) once my MSDN subscription is renewed (in
process now, I expect it anytime).
Jeff
Please find comments inline
-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Jeff Cody
Sent: Wednesday, January 07, 2015 9:11 PM
To: Lokesha, Amulya
Subject: Re: [Qemu-devel] [Bug 1399191] [NEW] Large VHDX image size
On Wed, Jan 07, 2015 at 03:30:28PM +0000, Stefan Hajnoczi wrote:
> On Thu, Dec 04, 2014 at 01:31:38PM -0000, AMULYA L wrote:
> > Public bug reported:
> >
> > We are trying to convert a VMDK image to VHDX image for deploy to HyperV Server ( SCVMM 2012 SP1) using qemu-img.
> > We tried converting the image using both 'fixed' as well as 'dynamic' format. We found that both the disks occupy the same size of 50GB. When the same is done with VHD image, we found that the dynamic disks are much lesser in size (5 GB) than the fixed disk (50GB).
> >
> > Why is that the VHDX generates large sized images for both the formats?
> >
> > The following commands were used to convert the vmdk image to VHDX
> > format
>
> Jeff, did you fix this recently in commit
> 85b712c9d5b873562c864e72f69cbf0d87d2fe40 ("block: vhdx - set
> .bdrv_has_zero_init to bdrv_has_zero_init_1")?
>
> Stefan
Yes, although there has been a report that there are issues in the resulting vhdx image in a MS server, after this patch. I am going to test and fix (if confirmed) once my MSDN subscription is renewed (in process now, I expect it anytime).
Jeff
--
Hi Jeff,
Could you please give us a possible timeline of when fix will be available. Our customers are waiting on this as we are blocked with the image creation.
Thanks,
Amulya
You received this bug notification because you are subscribed to the bug report.
https://bugs.launchpad.net/bugs/1399191
Title:
Large VHDX image size
Status in QEMU:
New
Bug description:
We are trying to convert a VMDK image to VHDX image for deploy to HyperV Server ( SCVMM 2012 SP1) using qemu-img.
We tried converting the image using both 'fixed' as well as 'dynamic' format. We found that both the disks occupy the same size of 50GB. When the same is done with VHD image, we found that the dynamic disks are much lesser in size (5 GB) than the fixed disk (50GB).
Why is that the VHDX generates large sized images for both the
formats?
The following commands were used to convert the vmdk image to VHDX
format
1. qemu-img convert -p -o subformat=fixed -f vmdk -O vhdx Test.vmdk
Test-fixed.vhdx
qemu-img info Test-fixed.vhdx
image: Test-fixed.vhdx
file format: vhdx
virtual size: 50G (53687091200 bytes)
disk size: 50G
cluster_size: 16777216
2. qemu-img convert -p -o subformat=dynamic -f vmdk -O vhdx Test.vmdk Test-dynamic.vhdx
qemu-img info Test-dynamic.vhdx
image: Test-dynamic.vhdx
file format: vhdx
virtual size: 50G (53687091200 bytes)
disk size: 50G
cluster_size: 16777216
We tried this with the following version of qemu
1. qemu-2.0.0
2. qemu-2.1.2
3. qemu-2.2.0-rc4
Please let us know how to create compact VHDX images using qemu-img.
Thank you
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1399191/+subscriptions
On Sun, Jan 11, 2015 at 11:33:31PM -0500, Lokesha, Amulya wrote:
> Please find comments inline
>
> -----Original Message-----
> From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Jeff Cody
> Sent: Wednesday, January 07, 2015 9:11 PM
> To: Lokesha, Amulya
> Subject: Re: [Qemu-devel] [Bug 1399191] [NEW] Large VHDX image size
>
> On Wed, Jan 07, 2015 at 03:30:28PM +0000, Stefan Hajnoczi wrote:
> > On Thu, Dec 04, 2014 at 01:31:38PM -0000, AMULYA L wrote:
> > > Public bug reported:
> > >
> > > We are trying to convert a VMDK image to VHDX image for deploy
> > > to HyperV Server ( SCVMM 2012 SP1) using qemu-img. We tried
> > > converting the image using both 'fixed' as well as 'dynamic'
> > > format. We found that both the disks occupy the same size of
> > > 50GB. When the same is done with VHD image, we found that the
> > > dynamic disks are much lesser in size (5 GB) than the fixed disk
> > > (50GB).
> > >
> > > Why is that the VHDX generates large sized images for both the
> > > formats?
> > >
> > > The following commands were used to convert the vmdk image to
> > > VHDX format
> >
> > Jeff, did you fix this recently in commit
> > 85b712c9d5b873562c864e72f69cbf0d87d2fe40 ("block: vhdx - set
> > .bdrv_has_zero_init to bdrv_has_zero_init_1")?
> >
> > Stefan
>
>
> Yes, although there has been a report that there are issues in the
> resulting vhdx image in a MS server, after this patch. I am going
> to test and fix (if confirmed) once my MSDN subscription is renewed
> (in process now, I expect it anytime).
>
> Jeff
>
> --
>
> Hi Jeff,
>
> Could you please give us a possible timeline of when fix will be
> available. Our customers are waiting on this as we are blocked with
> the image creation.
>
> Thanks, Amulya
Hi Amulya,
I have my MSDN stuff sorted out now, so give me a day or two get my
test machine up and running & testing.
-Jeff
>
>
> You received this bug notification because you are subscribed to the bug report.
> https://bugs.launchpad.net/bugs/1399191
>
> Title:
> Large VHDX image size
>
> Status in QEMU:
> New
>
> Bug description:
> We are trying to convert a VMDK image to VHDX image for deploy to HyperV Server ( SCVMM 2012 SP1) using qemu-img.
> We tried converting the image using both 'fixed' as well as 'dynamic' format. We found that both the disks occupy the same size of 50GB. When the same is done with VHD image, we found that the dynamic disks are much lesser in size (5 GB) than the fixed disk (50GB).
>
> Why is that the VHDX generates large sized images for both the
> formats?
>
> The following commands were used to convert the vmdk image to VHDX
> format
>
> 1. qemu-img convert -p -o subformat=fixed -f vmdk -O vhdx Test.vmdk
> Test-fixed.vhdx
>
> qemu-img info Test-fixed.vhdx
> image: Test-fixed.vhdx
> file format: vhdx
> virtual size: 50G (53687091200 bytes)
> disk size: 50G
> cluster_size: 16777216
>
>
>
> 2. qemu-img convert -p -o subformat=dynamic -f vmdk -O vhdx Test.vmdk Test-dynamic.vhdx
>
> qemu-img info Test-dynamic.vhdx
> image: Test-dynamic.vhdx
> file format: vhdx
> virtual size: 50G (53687091200 bytes)
> disk size: 50G
> cluster_size: 16777216
>
>
> We tried this with the following version of qemu
> 1. qemu-2.0.0
> 2. qemu-2.1.2
> 3. qemu-2.2.0-rc4
>
>
> Please let us know how to create compact VHDX images using qemu-img.
> Thank you
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qemu/+bug/1399191/+subscriptions
-----Original Message-----
From: Jeff Cody [mailto:<email address hidden>]
Sent: Tuesday, January 13, 2015 9:18 AM
To: Lokesha, Amulya
Cc: Bug 1399191; Geoffroy, Daniel
Subject: Re: [Qemu-devel] [Bug 1399191] [NEW] Large VHDX image size
On Sun, Jan 11, 2015 at 11:33:31PM -0500, Lokesha, Amulya wrote:
> Please find comments inline
>
> -----Original Message-----
> From: <email address hidden> [mailto:<email address hidden>] On Behalf
> Of Jeff Cody
> Sent: Wednesday, January 07, 2015 9:11 PM
> To: Lokesha, Amulya
> Subject: Re: [Qemu-devel] [Bug 1399191] [NEW] Large VHDX image size
>
> On Wed, Jan 07, 2015 at 03:30:28PM +0000, Stefan Hajnoczi wrote:
> > On Thu, Dec 04, 2014 at 01:31:38PM -0000, AMULYA L wrote:
> > > Public bug reported:
> > >
> > > We are trying to convert a VMDK image to VHDX image for deploy to
> > > HyperV Server ( SCVMM 2012 SP1) using qemu-img. We tried
> > > converting the image using both 'fixed' as well as 'dynamic'
> > > format. We found that both the disks occupy the same size of 50GB.
> > > When the same is done with VHD image, we found that the dynamic
> > > disks are much lesser in size (5 GB) than the fixed disk (50GB).
> > >
> > > Why is that the VHDX generates large sized images for both the
> > > formats?
> > >
> > > The following commands were used to convert the vmdk image to VHDX
> > > format
> >
> > Jeff, did you fix this recently in commit
> > 85b712c9d5b873562c864e72f69cbf0d87d2fe40 ("block: vhdx - set
> > .bdrv_has_zero_init to bdrv_has_zero_init_1")?
> >
> > Stefan
>
>
> Yes, although there has been a report that there are issues in the
> resulting vhdx image in a MS server, after this patch. I am going to
> test and fix (if confirmed) once my MSDN subscription is renewed (in
> process now, I expect it anytime).
>
> Jeff
>
> --
>
> Hi Jeff,
>
> Could you please give us a possible timeline of when fix will be
> available. Our customers are waiting on this as we are blocked with
> the image creation.
>
> Thanks, Amulya
Hi Amulya,
I have my MSDN stuff sorted out now, so give me a day or two get my test machine up and running & testing.
-Jeff
Hi Jeff,
Any updates on this? Where you able to get it tested
Thanks,
-Amulya
>
>
> You received this bug notification because you are subscribed to the bug report.
> https://bugs.launchpad.net/bugs/1399191
>
> Title:
> Large VHDX image size
>
> Status in QEMU:
> New
>
> Bug description:
> We are trying to convert a VMDK image to VHDX image for deploy to HyperV Server ( SCVMM 2012 SP1) using qemu-img.
> We tried converting the image using both 'fixed' as well as 'dynamic' format. We found that both the disks occupy the same size of 50GB. When the same is done with VHD image, we found that the dynamic disks are much lesser in size (5 GB) than the fixed disk (50GB).
>
> Why is that the VHDX generates large sized images for both the
> formats?
>
> The following commands were used to convert the vmdk image to VHDX
> format
>
> 1. qemu-img convert -p -o subformat=fixed -f vmdk -O vhdx Test.vmdk
> Test-fixed.vhdx
>
> qemu-img info Test-fixed.vhdx
> image: Test-fixed.vhdx
> file format: vhdx
> virtual size: 50G (53687091200 bytes)
> disk size: 50G
> cluster_size: 16777216
>
>
>
> 2. qemu-img convert -p -o subformat=dynamic -f vmdk -O vhdx
> Test.vmdk Test-dynamic.vhdx
>
> qemu-img info Test-dynamic.vhdx
> image: Test-dynamic.vhdx
> file format: vhdx
> virtual size: 50G (53687091200 bytes)
> disk size: 50G
> cluster_size: 16777216
>
>
> We tried this with the following version of qemu
> 1. qemu-2.0.0
> 2. qemu-2.1.2
> 3. qemu-2.2.0-rc4
>
>
> Please let us know how to create compact VHDX images using qemu-img.
> Thank you
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qemu/+bug/1399191/+subscriptions
On Mon, Jan 19, 2015 at 03:19:05PM +0000, Lokesha, Amulya wrote:
>
>
> -----Original Message-----
> From: Jeff Cody [mailto:<email address hidden>]
> Sent: Tuesday, January 13, 2015 9:18 AM
> To: Lokesha, Amulya
> Cc: Bug 1399191; Geoffroy, Daniel
> Subject: Re: [Qemu-devel] [Bug 1399191] [NEW] Large VHDX image size
>
> On Sun, Jan 11, 2015 at 11:33:31PM -0500, Lokesha, Amulya wrote:
> > Please find comments inline
> >
> > -----Original Message-----
> > From: <email address hidden> [mailto:<email address hidden>] On Behalf
> > Of Jeff Cody
> > Sent: Wednesday, January 07, 2015 9:11 PM
> > To: Lokesha, Amulya
> > Subject: Re: [Qemu-devel] [Bug 1399191] [NEW] Large VHDX image size
> >
> > On Wed, Jan 07, 2015 at 03:30:28PM +0000, Stefan Hajnoczi wrote:
> > > On Thu, Dec 04, 2014 at 01:31:38PM -0000, AMULYA L wrote:
> > > > Public bug reported:
> > > >
> > > > We are trying to convert a VMDK image to VHDX image for deploy to
> > > > HyperV Server ( SCVMM 2012 SP1) using qemu-img. We tried
> > > > converting the image using both 'fixed' as well as 'dynamic'
> > > > format. We found that both the disks occupy the same size of 50GB.
> > > > When the same is done with VHD image, we found that the dynamic
> > > > disks are much lesser in size (5 GB) than the fixed disk (50GB).
> > > >
> > > > Why is that the VHDX generates large sized images for both the
> > > > formats?
> > > >
> > > > The following commands were used to convert the vmdk image to VHDX
> > > > format
> > >
> > > Jeff, did you fix this recently in commit
> > > 85b712c9d5b873562c864e72f69cbf0d87d2fe40 ("block: vhdx - set
> > > .bdrv_has_zero_init to bdrv_has_zero_init_1")?
> > >
> > > Stefan
> >
> >
> > Yes, although there has been a report that there are issues in the
> > resulting vhdx image in a MS server, after this patch. I am going to
> > test and fix (if confirmed) once my MSDN subscription is renewed (in
> > process now, I expect it anytime).
> >
> > Jeff
> >
> > --
> >
> > Hi Jeff,
> >
> > Could you please give us a possible timeline of when fix will be
> > available. Our customers are waiting on this as we are blocked with
> > the image creation.
> >
> > Thanks, Amulya
>
> Hi Amulya,
>
> I have my MSDN stuff sorted out now, so give me a day or two get my test machine up and running & testing.
>
> -Jeff
>
>
> Hi Jeff,
>
> Any updates on this? Where you able to get it tested
>
> Thanks,
> -Amulya
>
Yes, I have sent a patch that I believe fixes the issue (I cc'ed you
on the patch). If you wouldn't mind testing, and verifying that it
fixes your particular issue, that would be great. I tested on Windows
Server 2012 w/Hyper-V, and I was able to verify the original problem
and the fix.
On what the issue was:
The v1.0.0 spec for VHDX denotes that the FileOffsetMB portion of the
block state field is 'reserved' for blocks in the state
PAYLOAD_BLOCK_ZERO. Before, we just went ahead and wrote the file
offset value for that block into the field, and just ignored it during
reads.
If we force the FileOffsetMB field to be zero, then Hyper-V is able to
read the images. Furthermore, inspecting images converted by
Hyper-V shows that Hyper-V writes '0' for the FileOffsetMB
field in BAT entries that are in the PAYLOAD_BLOCK_ZERO state.
The patch I sent mimics that behavior, and forces any BAT writes of
PAYLOAD_BLOCK_ZERO state to have a FileOffsetMB value of 0.
> >
> >
> > You received this bug notification because you are subscribed to the bug report.
> > https://bugs.launchpad.net/bugs/1399191
> >
> > Title:
> > Large VHDX image size
> >
> > Status in QEMU:
> > New
> >
> > Bug description:
> > We are trying to convert a VMDK image to VHDX image for deploy to HyperV Server ( SCVMM 2012 SP1) using qemu-img.
> > We tried converting the image using both 'fixed' as well as 'dynamic' format. We found that both the disks occupy the same size of 50GB. When the same is done with VHD image, we found that the dynamic disks are much lesser in size (5 GB) than the fixed disk (50GB).
> >
> > Why is that the VHDX generates large sized images for both the
> > formats?
> >
> > The following commands were used to convert the vmdk image to VHDX
> > format
> >
> > 1. qemu-img convert -p -o subformat=fixed -f vmdk -O vhdx Test.vmdk
> > Test-fixed.vhdx
> >
> > qemu-img info Test-fixed.vhdx
> > image: Test-fixed.vhdx
> > file format: vhdx
> > virtual size: 50G (53687091200 bytes)
> > disk size: 50G
> > cluster_size: 16777216
> >
> >
> >
> > 2. qemu-img convert -p -o subformat=dynamic -f vmdk -O vhdx
> > Test.vmdk Test-dynamic.vhdx
> >
> > qemu-img info Test-dynamic.vhdx
> > image: Test-dynamic.vhdx
> > file format: vhdx
> > virtual size: 50G (53687091200 bytes)
> > disk size: 50G
> > cluster_size: 16777216
> >
> >
> > We tried this with the following version of qemu
> > 1. qemu-2.0.0
> > 2. qemu-2.1.2
> > 3. qemu-2.2.0-rc4
> >
> >
> > Please let us know how to create compact VHDX images using qemu-img.
> > Thank you
> >
> > To manage notifications about this bug go to:
> > https://bugs.launchpad.net/qemu/+bug/1399191/+subscriptions
-----Original Message-----
From: Jeff Cody [mailto:<email address hidden>]
Sent: Wednesday, January 21, 2015 2:41 AM
To: Lokesha, Amulya
Cc: Bug 1399191; Geoffroy, Daniel
Subject: Re: [Qemu-devel] [Bug 1399191] [NEW] Large VHDX image size
On Mon, Jan 19, 2015 at 03:19:05PM +0000, Lokesha, Amulya wrote:
>
>
> -----Original Message-----
> From: Jeff Cody [mailto:<email address hidden>]
> Sent: Tuesday, January 13, 2015 9:18 AM
> To: Lokesha, Amulya
> Cc: Bug 1399191; Geoffroy, Daniel
> Subject: Re: [Qemu-devel] [Bug 1399191] [NEW] Large VHDX image size
>
> On Sun, Jan 11, 2015 at 11:33:31PM -0500, Lokesha, Amulya wrote:
> > Please find comments inline
> >
> > -----Original Message-----
> > From: <email address hidden><mailto:<email address hidden>> [mailto:<email address hidden>] On Behalf
> > Of Jeff Cody
> > Sent: Wednesday, January 07, 2015 9:11 PM
> > To: Lokesha, Amulya
> > Subject: Re: [Qemu-devel] [Bug 1399191] [NEW] Large VHDX image size
> >
> > On Wed, Jan 07, 2015 at 03:30:28PM +0000, Stefan Hajnoczi wrote:
> > > On Thu, Dec 04, 2014 at 01:31:38PM -0000, AMULYA L wrote:
> > > > Public bug reported:
> > > >
> > > > We are trying to convert a VMDK image to VHDX image for deploy
> > > > to HyperV Server ( SCVMM 2012 SP1) using qemu-img. We tried
> > > > converting the image using both 'fixed' as well as 'dynamic'
> > > > format. We found that both the disks occupy the same size of 50GB.
> > > > When the same is done with VHD image, we found that the dynamic
> > > > disks are much lesser in size (5 GB) than the fixed disk (50GB).
> > > >
> > > > Why is that the VHDX generates large sized images for both the
> > > > formats?
> > > >
> > > > The following commands were used to convert the vmdk image to
> > > > VHDX format
> > >
> > > Jeff, did you fix this recently in commit
> > > 85b712c9d5b873562c864e72f69cbf0d87d2fe40 ("block: vhdx - set
> > > .bdrv_has_zero_init to bdrv_has_zero_init_1")?
> > >
> > > Stefan
> >
> >
> > Yes, although there has been a report that there are issues in the
> > resulting vhdx image in a MS server, after this patch. I am going
> > to test and fix (if confirmed) once my MSDN subscription is renewed
> > (in process now, I expect it anytime).
> >
> > Jeff
> >
> > --
> >
> > Hi Jeff,
> >
> > Could you please give us a possible timeline of when fix will be
> > available. Our customers are waiting on this as we are blocked with
> > the image creation.
> >
> > Thanks, Amulya
>
> Hi Amulya,
>
> I have my MSDN stuff sorted out now, so give me a day or two get my test machine up and running & testing.
>
> -Jeff
>
>
> Hi Jeff,
>
> Any updates on this? Where you able to get it tested
>
> Thanks,
> -Amulya
>
Yes, I have sent a patch that I believe fixes the issue (I cc'ed you on the patch). If you wouldn't mind testing, and verifying that it fixes your particular issue, that would be great. I tested on Windows Server 2012 w/Hyper-V, and I was able to verify the original problem and the fix.
On what the issue was:
The v1.0.0 spec for VHDX denotes that the FileOffsetMB portion of the block state field is 'reserved' for blocks in the state PAYLOAD_BLOCK_ZERO. Before, we just went ahead and wrote the file offset value for that block into the field, and just ignored it during reads.
If we force the FileOffsetMB field to be zero, then Hyper-V is able to read the images. Furthermore, inspecting images converted by Hyper-V shows that Hyper-V writes '0' for the FileOffsetMB field in BAT entries that are in the PAYLOAD_BLOCK_ZERO state.
The patch I sent mimics that behavior, and forces any BAT writes of PAYLOAD_BLOCK_ZERO state to have a FileOffsetMB value of 0.
Hi Jeff,
Thanks a lot for the fix. We tested the VHDX creation with the new patch fix and were able to get it deployed successfully into our Windows HyperV Server 2012.
However we have one more issue and were hoping if we could get any help. We have a vmdk image (size 13MB) with a 500 GB data disk size. After conversion of vmdk image to vhdx format, the image size is 126 GB.
# qemu-img info Test.vmdk
image: Test.vmdk
file format: vmdk
virtual size: 500G (536870912000 bytes)
disk size: 13M
cluster_size: 65536
Format specific information:
cid: 4124953209
parent cid: 4294967295
create type: streamOptimized
extents:
[0]:
compressed: true
virtual size: 536870912000
filename: Test.vmdk
cluster size: 65536
format:
qemu conversion to vhdx done as below
# qemu-img convert -p -o subformat=dynamic -f vmdk -O vhdx Test.vmdk Test.vhdx
(100.00/100%)
# ls -ltrh
total 69M
-rw-r--r-- 1 root root 13M Jan 21 21:42 Test.vmdk
-rw-r--r-- 1 root root 126G Jan 22 05:03 Test.vhdx
# qemu-img info Test.vhdx
image: Test.vhdx
file format: vhdx
virtual size: 500G (536870912000 bytes)
disk size: 56M
cluster_size: 33554432
When we tried to copy this to the SCVMM manager server (Windows OS) it failed due to disk limitation. Windows does think it is a 126 GB file. Can anything be done to fix this issue?
Thanks,
Amulya
> >
> >
> > You received this bug notification because you are subscribed to the bug report.
> > https://bugs.launchpad.net/bugs/1399191
> >
> > Title:
> > Large VHDX image size
> >
> > Status in QEMU:
> > New
> >
> > Bug description:
> > We are trying to convert a VMDK image to VHDX image for deploy to HyperV Server ( SCVMM 2012 SP1) using qemu-img.
> > We tried converting the image using both 'fixed' as well as 'dynamic' format. We found that both the disks occupy the same size of 50GB. When the same is done with VHD image, we found that the dynamic disks are much lesser in size (5 GB) than the fixed disk (50GB).
> >
> > Why is that the VHDX generates large sized images for both the
> > formats?
> >
> > The following commands were used to convert the vmdk image to VHDX
> > format
> >
> > 1. qemu-img convert -p -o subformat=fixed -f vmdk -O vhdx Test.vmdk
> > Test-fixed.vhdx
> >
> > qemu-img info Test-fixed.vhdx
> > image: Test-fixed.vhdx
> > file format: vhdx
> > virtual size: 50G (53687091200 bytes)
> > disk size: 50G
> > cluster_size: 16777216
> >
> >
> >
> > 2. qemu-img convert -p -o subformat=dynamic -f vmdk -O vhdx
> > Test.vmdk Test-dynamic.vhdx
> >
> > qemu-img info Test-dynamic.vhdx
> > image: Test-dynamic.vhdx
> > file format: vhdx
> > virtual size: 50G (53687091200 bytes)
> > disk size: 50G
> > cluster_size: 16777216
> >
> >
> > We tried this with the following version of qemu
> > 1. qemu-2.0.0
> > 2. qemu-2.1.2
> > 3. qemu-2.2.0-rc4
> >
> >
> > Please let us know how to create compact VHDX images using qemu-img.
> > Thank you
> >
> > To manage notifications about this bug go to:
> > https://bugs.launchpad.net/qemu/+bug/1399191/+subscriptions
On Thu, Jan 22, 2015 at 05:20:20AM +0000, Lokesha, Amulya wrote:
>
>
[...]
>
>> Yes, I have sent a patch that I believe fixes the issue (I cc'ed you on
>> the patch). If you wouldn't mind testing, and verifying that it fixes
>> your particular issue, that would be great. I tested on Windows Server
>> 2012 w/Hyper-V, and I was able to verify the original problem and the fix.
>>
>> On what the issue was:
>>
>> The v1.0.0 spec for VHDX denotes that the FileOffsetMB portion of the
>> block state field is 'reserved' for blocks in the state
>> PAYLOAD_BLOCK_ZERO. Before, we just went ahead and wrote the file offset
>> value for that block into the field, and just ignored it during reads.
>>
>> If we force the FileOffsetMB field to be zero, then Hyper-V is able to
>> read the images. Furthermore, inspecting images converted by Hyper-V
>> shows that Hyper-V writes '0' for the FileOffsetMB field in BAT entries
>> that are in the PAYLOAD_BLOCK_ZERO state.
>>
>> The patch I sent mimics that behavior, and forces any BAT writes of
>> PAYLOAD_BLOCK_ZERO state to have a FileOffsetMB value of 0.
>
>
> Hi Jeff,
>
> Thanks a lot for the fix. We tested the VHDX creation with the new patch
> fix and were able to get it deployed successfully into our Windows HyperV
> Server 2012.
>
You're welcome!
> However we have one more issue and were hoping if we could get any help.
> We have a vmdk image (size 13MB) with a 500 GB data disk size. After
> conversion of vmdk image to vhdx format, the image size is 126 GB.
>
> # qemu-img info Test.vmdk
> image: Test.vmdk
> file format: vmdk
> virtual size: 500G (536870912000 bytes)
> disk size: 13M
> cluster_size: 65536
> Format specific information:
> cid: 4124953209
> parent cid: 4294967295
> create type: streamOptimized
> extents:
> [0]:
> compressed: true
> virtual size: 536870912000
> filename: Test.vmdk
> cluster size: 65536
> format:
>
> qemu conversion to vhdx done as below
> # qemu-img convert -p -o subformat=dynamic -f vmdk -O vhdx Test.vmdk
> Test.vhdx
> (100.00/100%)
>
> # ls -ltrh
> total 69M
> -rw-r--r-- 1 root root 13M Jan 21 21:42 Test.vmdk
> -rw-r--r-- 1 root root 126G Jan 22 05:03 Test.vhdx
>
> # qemu-img info Test.vhdx
> image: Test.vhdx
> file format: vhdx
> virtual size: 500G (536870912000 bytes)
> disk size: 56M
> cluster_size: 33554432
>
>
> When we tried to copy this to the SCVMM manager server (Windows OS) it
> failed due to disk limitation. Windows does think it is a 126 GB file. Can
> anything be done to fix this issue?
>
> Thanks,
> Amulya
It sounds like a 126G sparse image was created (reported size 126G, on
disk size 55M), and QEMU still recognizes it as a 500G image (file
size sounds large, but nothing indicates yet the vhdx image isn't
valid, at least).
I am not sure what your disk limitation limit was under Windows, can
you elaborate?
I tried to reproduce it here, and could not:
# ./qemu-img create -f vmdk test-500G.vmdk 500G
# ./qemu-img convert -p -o subformat=dynamic -f vmdk -O vhdx test-500G.vmdk test-500G.vhdx
# ls -lhs test-500G*
1.3M -rw-r--r--. 1 jcody jcody 8.0M Jan 22 10:25 test-500G.vhdx
136K -rw-r--r--. 1 jcody jcody 63M Jan 22 10:25 test-500G.vmdk
I was also able to inspect test.vhdx on Windows Server 2012, using
Hyper-V Manager, and it reported that it was a vhdx dynamic disk, with
a maximum size of 500G.
Can you place your source vmdk image someplace for me to download and
test with, if it does not contain sensitive data? You can send me the
link offlist, if you like.
Thanks,
Jeff
> > >
> > >
> > > You received this bug notification because you are subscribed to the
> bug report.
> > > [5]https://bugs.launchpad.net/bugs/1399191
> > >
[...]
On Thu, Jan 22, 2015 at 04:24:45PM +0000, Lokesha, Amulya wrote:
>
> -----Original Message-----
> From: Jeff Cody [mailto:<email address hidden>]
> Sent: Thursday, January 22, 2015 9:33 PM
> To: Lokesha, Amulya
> Cc: Bug 1399191; Geoffroy, Daniel
> Subject: Re: [Qemu-devel] [Bug 1399191] [NEW] Large VHDX image size
>
> On Thu, Jan 22, 2015 at 05:20:20AM +0000, Lokesha, Amulya wrote:
> >
> >
>
> [...]
>
>>>
>>>> Yes, I have sent a patch that I believe fixes the issue (I cc'ed you on
>>>> the patch). If you wouldn't mind testing, and verifying that it fixes
>>>> your particular issue, that would be great. I tested on Windows Server
>>>> 2012 w/Hyper-V, and I was able to verify the original problem and the fix.
>>>>
>>>> On what the issue was:
>>>>
>>>> The v1.0.0 spec for VHDX denotes that the FileOffsetMB portion of the
>>>> block state field is 'reserved' for blocks in the state
>>>> PAYLOAD_BLOCK_ZERO. Before, we just went ahead and wrote the file offset
>>>> value for that block into the field, and just ignored it during reads.
>>>>
>>>> If we force the FileOffsetMB field to be zero, then Hyper-V is able to
>>>> read the images. Furthermore, inspecting images converted by Hyper-V
>>>> shows that Hyper-V writes '0' for the FileOffsetMB field in BAT entries
>>>> that are in the PAYLOAD_BLOCK_ZERO state.
>>>>
>>>> The patch I sent mimics that behavior, and forces any BAT writes of
>>>> PAYLOAD_BLOCK_ZERO state to have a FileOffsetMB value of 0.
>>>
>>>
>>> Hi Jeff,
>>>
>>> Thanks a lot for the fix. We tested the VHDX creation with the new patch
>>> fix and were able to get it deployed successfully into our Windows HyperV
>>> Server 2012.
>>>
>>
>>You're welcome!
>>
>>> However we have one more issue and were hoping if we could get any help.
>>> We have a vmdk image (size 13MB) with a 500 GB data disk size. After
>>> conversion of vmdk image to vhdx format, the image size is 126 GB.
>>>
>>> # qemu-img info Test.vmdk
>>> image: Test.vmdk
>>> file format: vmdk
>>> virtual size: 500G (536870912000 bytes)
>>> disk size: 13M
>>> cluster_size: 65536
>>> Format specific information:
>>> cid: 4124953209
>>> parent cid: 4294967295
>>> create type: streamOptimized
>>> extents:
>>> [0]:
>>> compressed: true
>>> virtual size: 536870912000
>>> filename: Test.vmdk
>>> cluster size: 65536
>>> format:
>>>
>>> qemu conversion to vhdx done as below
>>> # qemu-img convert -p -o subformat=dynamic -f vmdk -O vhdx Test.vmdk
>>> Test.vhdx
>>> (100.00/100%)
>>>
>>> # ls -ltrh
>>> total 69M
>>> -rw-r--r-- 1 root root 13M Jan 21 21:42 Test.vmdk
>>> -rw-r--r-- 1 root root 126G Jan 22 05:03 Test.vhdx
>>>
>>> # qemu-img info Test.vhdx
>>> image: Test.vhdx
>>> file format: vhdx
>>> virtual size: 500G (536870912000 bytes)
>>> disk size: 56M
>>> cluster_size: 33554432
>>>
>>>
>>> When we tried to copy this to the SCVMM manager server (Windows OS) it
>>> failed due to disk limitation. Windows does think it is a 126 GB file. Can
>>> anything be done to fix this issue?
>>>
>>> Thanks,
>>> Amulya
>>
>> It sounds like a 126G sparse image was created (reported size 126G,
>> on disk size 55M), and QEMU still recognizes it as a 500G image
>> (file size sounds large, but nothing indicates yet the vhdx image
>> isn't valid, at least).
>>
>>
>> I tried to reproduce it here, and could not:
>>
>> # ./qemu-img create -f vmdk test-500G.vmdk 500G
>>
>> # ./qemu-img convert -p -o subformat=dynamic -f vmdk -O vhdx
>> test-500G.vmdk test-500G.vhdx
>>
>> # ls -lhs test-500G*
>> 1.3M -rw-r--r--. 1 jcody jcody 8.0M Jan 22 10:25 test-500G.vhdx
>> 136K -rw-r--r--. 1 jcody jcody 63M Jan 22 10:25 test-500G.vmdk
>>
>> I was also able to inspect test.vhdx on Windows Server 2012, using
>> Hyper-V Manager, and it reported that it was a vhdx dynamic disk,
>> with a maximum size of 500G.
>>
>> Can you place your source vmdk image someplace for me to download
>> and test with, if it does not contain sensitive data? You can send
>> me the link offlist, if you like.
>>
>
> Hi Jeff,
>
> The disk limitation which I mentioned above was just about the free
> space available on Windows hyperV Server. I am sending the sample
> Test.vmdk attached in zip format which we used for converting to
> vhdx format. Please let me know if you are able to download this zip
> file.
>
> Thanks, Amulya
>
>
Hi Amulya,
(I added the bug tracker back on the cc list)
I was able to download the VMDK image fine to test. What is going
on is due to the nature of the VHDX image format, due to its
relatively large block size (1MB min, 256 MB max).
Brief background:
In the VHDX image format, data is broken up into blocks. Those blocks
may take various states, such as a 'ZERO' state, and a 'PRESENT'
state.
When an entire block is zeroes, the state stays in the 'ZERO' state,
which is now the default state for new VHDX dynamic image files.
There is no data written to disk for these zeros, so the file size
stays small.
However, if we write even 1 byte to a block that is the ZERO state, it
is now in the 'PRESENT' state, and that block data must be written to
disk (complete with the surrounding zeroes in that block).
Block sizes for VHDX images range from 1MB - 256MB. The larger the
block size, the larger the image may be on disk for partially filled
blocks.
The qemu vhdx driver does take advantage of underlying file system
sparseness, however, and just extends the file out and only writes the
requested sectors on a write.
What is going on in your VMDK image:
You VMDK image as a lot of (repetitive) data spread out far enough
apart that it hits a lot of different blocks [1]. If you run hexdump on
the resulting vhdx image, this will be apparent (hexdump will elide
excessively duplicate data, so the output is manageable).
The resulting image with the default block size then becomes ~126G,
but as it is quite sparse, the on disk usage is only 41M. If you play
with the block size parameter during conversion, you can get file size
down to around 4G (with a block_size of 1MB).
I am not sure the best way to copy a sparse file over to Windows
2012 Server, but it would probably be nice to preserve any sparseness
if possible.
I think we can close the BZ, as it seems the posted patch solves
the original issue.
[1] Example of data from the converted VHDX image:
7f000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
7f000040 0003 0000 0000 0000 0000 0000 0000 0000
7f000050 0000 0000 0000 0000 0000 0000 0000 0000
*
7f001400 ffff ffff ffff ffff ffff ffff ffff ffff
*
7f002000 0000 0000 0000 0000 0000 0000 0000 0000
*
7f100000 ffff ffff ffff ffff ffff ffff ffff ffff
*
7f100040 0003 0000 0000 0000 0000 0000 0000 0000
7f100050 0000 0000 0000 0000 0000 0000 0000 0000
*
7f101400 ffff ffff ffff ffff ffff ffff ffff ffff
*
7f102000 0000 0000 0000 0000 0000 0000 0000 0000
The default block size for a 500G vhdx image created by QEMU is 32M.
In the above, you can see that most of the data is 0, but still within
one block-sized chunk.
(I am assuming that the data was converted correctly, of course).
When I tested with a qcow2 output format, using a 1MB cluster size in
qcow2, I get roughly similar results as when using a block size of 1M
with vhdx (Test.qcow2 and Test.vhdx were then both ~4G).
-Jeff
>>> > >
>>> > >
>>> > > You received this bug notification because you are subscribed to the
>>> bug report.
>>> > > https://bugs.launchpad.net/bugs/1399191
>>> > >
>>
>>
>>[...]
We have encountered the same problem.
We have a 1.4 GB size vmdk image and after converting it to vhdx, its size is 62GB. But qemu-img info show the size is 2.9 G.
===========
$ qemu-img info dd_test.vmdk
image: dd_test.vmdk
file format: vmdk
virtual size: 250G (268435456000 bytes)
disk size: 1.4G
$ qemu-img convert -p -f vmdk dd_test.vmdk -O vhdx t.vhdx
(98.02/100%)
$ qemu-img info t.vhdx
image: t.vhdx
file format: vhdx
virtual size: 250G (268435456000 bytes)
disk size: 2.9G
$ ls -ltrh t.vhdx
-rw-r--r-- 1 wangj85 wangj85 62G Dec 28 2015 t.vhdx
qemu-img version is 1.5.3. I also use newer version to do the conversion, it has the same result.
If your image contains an ext4 partition it may be worth viewing the advice MS gives about Dynamic VHDX blocksizes: https://technet.microsoft.com/en-GB/library/dn720239.aspx .
Hi Jan,
ls -l returns the length of the file; qemu-img info prints the size of the file (just like du does). Those are not necessarily the same, as you can see. On modern filesystems, files can have holes in them which do contribute to the file length, but which do not use any space on disk and thus do not contribute to file size.
Besides using qemu-img, you can obtain the actual disk usage (the file size) by using du or ls --size (-s for short).
Max
Sorry.
Please ignore above change. I just find that I change the status of this bug
https://bugs.launchpad.net/qemu/+bug/1490611
I really don't know I have privilege to modify that.
Sorry again.
Triaging old bug tickets... can you still reproduce this issue with the latest version of QEMU? Or could we close this ticket nowadays?
[Expired for QEMU because there has been no activity for 60 days.]
|