Revision acd935ef qemu-doc.texi
b/qemu-doc.texi | ||
---|---|---|
584 | 584 |
@node disk_images |
585 | 585 |
@section Disk Images |
586 | 586 |
|
587 |
@subsection Raw disk images |
|
587 |
Since version 0.6.1, QEMU supports many disk image formats, including |
|
588 |
growable disk images (their size increase as non empty sectors are |
|
589 |
written), compressed and encrypted disk images. |
|
588 | 590 |
|
589 |
The disk images can simply be raw images of the hard disk. You can |
|
590 |
create them with the command: |
|
591 |
@subsection Quick start for disk image creation |
|
592 |
|
|
593 |
You can create a disk image with the command: |
|
591 | 594 |
@example |
592 |
dd of=myimage bs=1024 seek=mysize count=0
|
|
595 |
qemu-img create myimage.img mysize
|
|
593 | 596 |
@end example |
594 |
where @var{myimage} is the image filename and @var{mysize} is its size |
|
595 |
in kilobytes. |
|
597 |
where @var{myimage.img} is the disk image filename and @var{mysize} is its |
|
598 |
size in kilobytes. You can add an @code{M} suffix to give the size in |
|
599 |
megabytes and a @code{G} suffix for gigabytes. |
|
600 |
|
|
601 |
@xref{qemu_img_invocation} for more information. |
|
596 | 602 |
|
597 | 603 |
@subsection Snapshot mode |
598 | 604 |
|
599 | 605 |
If you use the option @option{-snapshot}, all disk images are |
600 | 606 |
considered as read only. When sectors in written, they are written in |
601 | 607 |
a temporary file created in @file{/tmp}. You can however force the |
602 |
write back to the raw disk images by pressing @key{C-a s}. |
|
603 |
|
|
604 |
NOTE: The snapshot mode only works with raw disk images. |
|
605 |
|
|
606 |
@subsection Copy On Write disk images |
|
607 |
|
|
608 |
QEMU also supports user mode Linux |
|
609 |
(@url{http://user-mode-linux.sourceforge.net/}) Copy On Write (COW) |
|
610 |
disk images. The COW disk images are much smaller than normal images |
|
611 |
as they store only modified sectors. They also permit the use of the |
|
612 |
same disk image template for many users. |
|
613 |
|
|
614 |
To create a COW disk images, use the command: |
|
615 |
|
|
616 |
@example |
|
617 |
qemu-mkcow -f myrawimage.bin mycowimage.cow |
|
618 |
@end example |
|
619 |
|
|
620 |
@file{myrawimage.bin} is a raw image you want to use as original disk |
|
621 |
image. It will never be written to. |
|
622 |
|
|
623 |
@file{mycowimage.cow} is the COW disk image which is created by |
|
624 |
@code{qemu-mkcow}. You can use it directly with the @option{-hdx} |
|
625 |
options. You must not modify the original raw disk image if you use |
|
626 |
COW images, as COW images only store the modified sectors from the raw |
|
627 |
disk image. QEMU stores the original raw disk image name and its |
|
628 |
modified time in the COW disk image so that chances of mistakes are |
|
629 |
reduced. |
|
630 |
|
|
631 |
If the raw disk image is not read-only, by pressing @key{C-a s} you |
|
632 |
can flush the COW disk image back into the raw disk image, as in |
|
633 |
snapshot mode. |
|
608 |
write back to the raw disk images by using the @code{commit} monitor |
|
609 |
command (or @key{C-a s} in the serial console). |
|
634 | 610 |
|
635 |
COW disk images can also be created without a corresponding raw disk |
|
636 |
image. It is useful to have a big initial virtual disk image without |
|
637 |
using much disk space. Use: |
|
611 |
@node qemu_img_invocation |
|
612 |
@subsection @code{qemu-img} Invocation |
|
638 | 613 |
|
639 |
@example |
|
640 |
qemu-mkcow mycowimage.cow 1024 |
|
641 |
@end example |
|
642 |
|
|
643 |
to create a 1 gigabyte empty COW disk image. |
|
644 |
|
|
645 |
NOTES: |
|
646 |
@enumerate |
|
647 |
@item |
|
648 |
COW disk images must be created on file systems supporting |
|
649 |
@emph{holes} such as ext2 or ext3. |
|
650 |
@item |
|
651 |
Since holes are used, the displayed size of the COW disk image is not |
|
652 |
the real one. To know it, use the @code{ls -ls} command. |
|
653 |
@end enumerate |
|
654 |
|
|
655 |
@subsection Convert VMware disk images to raw disk images |
|
656 |
|
|
657 |
You can use the tool @file{vmdk2raw} to convert VMware disk images to |
|
658 |
raw disk images directly usable by QEMU. The syntax is: |
|
659 |
@example |
|
660 |
vmdk2raw vmware_image output_image |
|
661 |
@end example |
|
614 |
@include qemu-img.texi |
|
662 | 615 |
|
663 | 616 |
@section Network emulation |
664 | 617 |
|
Also available in: Unified diff