Red Hat ENTERPRISE LINUX 5 - VIRTUALIZATION GUIDE Guida di Installazione Pagina 257

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
Vedere la pagina 256
Accessing data from a guest disk image
247
`- 9:0:0:7 sdbo 68:32 active ready running
28.3. Accessing data from a guest disk image
There are various methods for accessing the data from guest image files. One common method is to
use the kpartx tool, covered by this section, to mount the guest file system as a loop device which
can then be accessed.
The kpartx command creates device maps from partition tables. Each guest storage image has a
partition table embedded in the file.
The li/jointfilesconvert/340954/bguestfs and guestfish packages, available from the EPEL
1
repository, allow advanced
modification and access to guest file systems. The li/jointfilesconvert/340954/bguestfs and guestfish packages are not covered
in this section at this time.
Warning
Guests must be offline before their files can be read. Editing or reading files of an active guest is
not possible and may cause data loss or damage.
Procedure 28.1. Accessing guest image data
1. Install the kpartx package.
# yum install kpartx
2. Use kpartx to list partition device mappings attached to a file-based storage image. This example
uses a image file named guest1.img.
# kpartx -l /var/lib/libvirt/images/guest1.img
loop0p1 : 0 409600 /dev/loop0 63
loop0p2 : 0 10064717 /dev/loop0 409663
guest1 is a Linux guest. The first partition is the boot partition and the second partition is an
EXT3 containing the root partition.
3. Add the partition mappings to the recognized devices in /dev/mapper/.
# kpartx -a /var/lib/libvirt/images/guest1.img
Test that the partition mapping worked. There should be new devices in the /dev/mapper/
directory
# ls /dev/mapper/
loop0p1
loop0p2
The mappings for the image are named in the format loopXpY.
1
http://fedoraproject.org/wiki/EPEL
Vedere la pagina 256
1 2 ... 252 253 254 255 256 257 258 259 260 261 262 ... 329 330

Commenti su questo manuale

Nessun commento