Utilizando las siguientes herramientas:
- vmware-mount
- vmware-vdiskmanager
- losetup
- fdisk
# vmware-mount -p <maquina_virtual>.vmdk
# vmware-mount -p <virt_machine>.vmdk
Nr Start Size Type Id Sytem
-- ---------- ---------- ---- -- ------------------------
1 63 401562 BIOS 83 Linux
2 401625 10072755 BIOS 8E Unknown
En el listado podemos observar que la partición que estamos buscando es la número 2, ya que es la que tiene marcada el Id 8E (8E stands for Linux LVM) . El siguiente paso será montar la imagen vmware, para ello ejecutaremos el siguiente comando:
# vmware-mount -f <maquina_virtual>.vmdk <mountpoint>
# ls <mountpoint>
flat
Nota: Si nos diera error de que el archivo está dañado o corructo, con un error por ejemplo 16006. Debemos reparar la imagen ejecutando la siguiente línea de comando:
# vmware-vdiskmanager -R <maquina_virtual>.vmdk
Sobre el archivo flat ejecutaremos fdisk para inspeccionar su contenido.
# fdisk -lu <mountpoint>/flat
You must set cylinders.
You can do this from the extra functions menu.
Disk <mountpoint>/flat: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x0006a266
Device Boot Start End Blocks Id System
<mountpoint>/flat1 * 63 401624 200781 83 Linux
<mountpoint>/flat2 401625 10474379 5036377+ 8e Linux LVM
echo $(( 401625 * 512 ))
205632000
losetup -o 205632000 /dev/loop0 <mountpoint>/flat
# pvdisplay /dev/loop0
--- Physical volume ---
PV Name /dev/loop0
VG Name VolGroup00
PV Size 4,80 GB / not usable 22,34 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 153
Free PE 1
Allocated PE 152
PV UUID MUKx5v-ukpq-fJis-GjpB-Z7dE-nIsI-Xr4bYd
# lvscan
ACTIVE '/dev/vg1/isos' [111,79 GB] inherit
ACTIVE '/dev/vg0/root' [10,00 GB] inherit
ACTIVE '/dev/vg0/swap' [8,00 GB] inherit
ACTIVE '/dev/vg0/home' [50,00 GB] inherit
ACTIVE '/dev/vg0/data' [164,41 GB] inherit
inactive '/dev/VolGroup00/LogVol00' [4,00 GB] inherit
inactive '/dev/VolGroup00/LogVol01' [768,00 MB] inherit
lvchange -ay /dev/VolGroup00/LogVol00
mount /dev/VolGroup00/LogVol00 <mountpoint>
umount <mountpoint> # Desmontamos la unidad
lvchange -an /dev/VolGroup00/LogVol00 # Desactivamos el volumen lógico
losetup -d /dev/loop0 # Desmontamos el loop
vmware-mount -d <mountpoint> # Desmontamos la imagen de Disco de vmdk