• # kpartx

    Posté par . En réponse au message extraire le contenu d'une image d'une clé ou disque. Évalué à 2.

    J'espère que ça va faire ton bonheur.
    Un bon exemple (sous FC5) :
    [root@here vmware]# file Windows\ XP\ Professional-flat.vmdk
    Windows XP Professional-flat.vmdk: x86 boot sector, Microsoft Windows XP MBR, Serial 0x4ee24ee2; partition 1: ID=0x7, active, starthead 1, startsector 63, 16755732 sectors
    [root@here vmware]# yum install device-mapper-multipath
    [blabla...]
    [root@here vmware]# losetup -f Windows\ XP\ Professional-flat.vmdk
    [root@here vmware]# losetup -a | grep Windows
    /dev/loop5: [1601]:4593227 (Windows XP Professional-flat.vmdk)
    [root@here vmware]# fdisk -l /dev/loop5

    Disk /dev/loop5: 8589 MB, 8589934592 bytes
    255 heads, 63 sectors/track, 1044 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/loop5p1 * 1 1043 8377866 7 HPFS/NTFS
    [root@here vmware]# ll /dev/loop5p1
    ls: /dev/loop5p1: Aucun fichier ou répertoire de ce type
    [root@here vmware]# kpartx -v -a /dev/loop5
    add map loop5p1 : 0 16755732 linear /dev/loop5 63
    [root@here vmware]# ll /dev/mapper/
    total 0
    crw------- 1 root root 10, 63 août 16 07:09 control
    brw-rw---- 1 root disk 253, 0 août 18 19:06 loop5p1
    [root@here vmware]# head /dev/mapper/loop5p1 > head.tmp
    [root@here vmware]# file head.tmp
    head.tmp: x86 boot sector, code offset 0x52, OEM-ID "NTFS ", sectors/cluster 8, reserved sectors 0, Media descriptor 0xf8, heads 255, hidden sectors 63, dos < 4.0 BootSector (0x80)
    [root@here vmware]# mount -t auto -o ro /dev/mapper/loop5p1 mount_point
    [root@here vmware]# df mount_point/
    Sys. de fich. 1K-blocs Occupé Disponible Capacité Monté sur
    /dev/mapper/loop5p1 8377864 2302160 6075704 28% mount_point
    [root@here vmware]# umount mount_point