Commit 1f47a9223ebe3d0c9c779f72341afc10c206d574

Authored by bellard
1 parent 33e3963e

added disk image help


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@310 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 82 additions and 9 deletions
qemu-doc.texi
@@ -368,13 +368,13 @@ Use 'file' as initial ram disk. @@ -368,13 +368,13 @@ Use 'file' as initial ram disk.
368 368
369 @item -hda file 369 @item -hda file
370 @item -hdb file 370 @item -hdb file
371 -Use 'file' as hard disk 0 or 1 image. The disk images are simply raw  
372 -images of the hard disk. You can create them with the command:  
373 -@example  
374 -dd if=/dev/zero of=myimage bs=1024 count=mysize  
375 -@end example  
376 -where @var{myimage} is the image filename and @var{mysize} is its size  
377 -in kilobytes. 371 +Use 'file' as hard disk 0 or 1 image (@xref{disk_images}).
  372 +
  373 +@item -snapshot
  374 +
  375 +Write to temporary files instead of disk image files. In this case,
  376 +the raw disk image you use is not written back. You can however force
  377 +the write back by pressing @key{C-a s} (@xref{disk_images}).
378 378
379 @item -m megs 379 @item -m megs
380 Set virtual RAM size to @var{megs} megabytes. 380 Set virtual RAM size to @var{megs} megabytes.
@@ -402,12 +402,85 @@ During emulation, use @key{C-a h} to get terminal commands: @@ -402,12 +402,85 @@ During emulation, use @key{C-a h} to get terminal commands:
402 Print this help 402 Print this help
403 @item C-a x 403 @item C-a x
404 Exit emulatior 404 Exit emulatior
405 -@item C-a b 405 +@item C-a s
  406 +Save disk data back to file (if -snapshot)
  407 +@item C-a b
406 Send break (magic sysrq) 408 Send break (magic sysrq)
407 -@item C-a C-a 409 +@item C-a C-a
408 Send C-a 410 Send C-a
409 @end table 411 @end table
410 412
  413 +@node disk_images
  414 +@section Disk Images
  415 +
  416 +@subsection Raw disk images
  417 +
  418 +The disk images can simply be raw images of the hard disk. You can
  419 +create them with the command:
  420 +@example
  421 +dd if=/dev/zero of=myimage bs=1024 count=mysize
  422 +@end example
  423 +where @var{myimage} is the image filename and @var{mysize} is its size
  424 +in kilobytes.
  425 +
  426 +@subsection Snapshot mode
  427 +
  428 +If you use the option @option{-snapshot}, all disk images are
  429 +considered as read only. When sectors in written, they are written in
  430 +a temporary file created in @file{/tmp}. You can however force the
  431 +write back to the raw disk images by pressing @key{C-a s}.
  432 +
  433 +NOTE: The snapshot mode only works with raw disk images.
  434 +
  435 +@subsection Copy On Write disk images
  436 +
  437 +QEMU also supports user mode Linux
  438 +(@url{http://user-mode-linux.sourceforge.net/}) Copy On Write (COW)
  439 +disk images. The COW disk images are much smaller than normal images
  440 +as they store only modified sectors. They also permit the use of the
  441 +same disk image template for many users.
  442 +
  443 +To create a COW disk images, use the command:
  444 +
  445 +@example
  446 +vlmkcow -f myrawimage.bin mycowimage.cow
  447 +@end example
  448 +
  449 +@file{myrawimage.bin} is a raw image you want to use as original disk
  450 +image. It will never be written to.
  451 +
  452 +@file{mycowimage.cow} is the COW disk image which is created by
  453 +@code{vlmkcow}. You can use it directly with the @option{-hdx}
  454 +options. You must not modify the original raw disk image if you use
  455 +COW images, as COW images only store the modified sectors from the raw
  456 +disk image. QEMU stores the original raw disk image name and its
  457 +modified time in the COW disk image so that chances of mistakes are
  458 +reduced.
  459 +
  460 +If raw disk image is not read-only, by pressing @key{C-a s} you can
  461 +flush the COW disk image back into the raw disk image, as in snapshot
  462 +mode.
  463 +
  464 +COW disk images can also be created without a corresponding raw disk
  465 +image. It is useful to have a big initial virtual disk image without
  466 +using much disk space. Use:
  467 +
  468 +@example
  469 +vlmkcow mycowimage.cow 1024
  470 +@end example
  471 +
  472 +to create a 1 gigabyte empty COW disk image.
  473 +
  474 +NOTES:
  475 +@enumerate
  476 +@item
  477 +COW disk images must be created on file systems supporting
  478 +@emph{holes} such as ext2 or ext3.
  479 +@item
  480 +Since holes are used, the displayed size of the COW disk image is not
  481 +the real one. To know it, use the @code{ls -ls} command.
  482 +@end enumerate
  483 +
411 @section Kernel Compilation 484 @section Kernel Compilation
412 485
413 You can use any Linux kernel within QEMU provided it is mapped at 486 You can use any Linux kernel within QEMU provided it is mapped at