How To Clean Up Orphaned Vmdk Files
How to Extract Content from VMDK Files: A Step-By-Footstep Guide
Sometimes a VM cannot exist started, however y'all may demand to access the data stored on a virtual disk used by a VM. This situation can happen after the unsuccessful installation of some applications, updates for an operating arrangement, malware attacks, accidental file deletion, etc. There are a number of methods that permit you to access the content of VMDK virtual deejay files. Today'due south blog post covers the methods that can be used if a VMDK virtual disk is not encrypted or corrupted. If a VMDK file is encrypted or corrupted, another technique must be applied. The following sections of the web log post about how to open VMDK files are included in this article:
- How Data is Stored in VMDK Files
- Methods that need powering on a VM
- Using Live DVD even if an OS on a VM is dead (a legacy method)
- Example: Opening VMDK files on ESXi
- How to mountain a VMDK file as a virtual disk to a good for you VM on VMware ESXi, Workstation or Role player
- Case one: Mounting a virtual deejay to a VM running on ESXi
- Instance two: Mounting a virtual disk to a VM running on VMware Player or VMware Workstation
- Using Live DVD even if an OS on a VM is dead (a legacy method)
- Methods that don't need powering on a VM
- Mounting VMDK files in a host OS with VMware Workstation
- Example 1: Mounting VMDK on a Linux host
- Example two: How to mountain VMDK on a Windows host
- Mounting VMDK files in a host OS with VMware Workstation
- Using 7-zip to extract content from VMDK files
- How to open VMDK files with 7-zero on Linux
- How to open up VMDK files with 7-cipher on Windows
- Other methods to open VMDK files in Linux
- How to mount VMDK files past using /dev/loop
- How to mountain VMDK files with kpartx
How the Data is Stored in VMDK Files
VMDK is a virtual automobile disk file format, which is the open format developed by VMware. This virtual disk format has the .vmdk extension of files and is used past VMware and VirtualBox virtual machines. However, virtual machines residing on ESXi servers apply a slightly different format of vmdk virtual disks – a virtual disk descriptor and virtual disk extent that contains raw data of the virtual disk are two separate files on the ESXi datastore. The pattern of a virtual disk descriptor name is diskname.vmdk and the pattern of a virtual disk extent name that contains all raw information is diskname-apartment.vmdk, accordingly. Every bit for virtual disks of the VMware Workstation format, a virtual disk is represented as a single diskname.vmdk file (monolithic thin) which is an extent information file that contains an embedded virtual deejay descriptor. A virtual disk descriptor defines the construction of the virtual disk, virtual disk geometry, virtual hardware version, and IDs.
A virtual deejay descriptor is represented as plain text. On the left side of the screenshot below, you tin see a virtual disk descriptor of the ESXi format (a vmdk file that tin can exist opened with any text editor). On the correct side of the screenshot, you lot can set eyes on the data of the virtual deejay descriptor that is embedded into a single vmdk file of the VMware Workstation format. The vmdk file is opened in HEX editor.
Equally you tin can run across, the embedded disk descriptor data is written to the monolithic vmdk file of the Workstation format from the 0x200 address, which is the number of the commencement byte. If yous transform the 200 HEX value to a binary and decimal format, y'all will go:
200 HEX = 1000000000 Binary = 512 Decimal
This means that if you lot want to extract the embedded descriptor from the vmdk file, you should extract a portion of data starting from the 512th byte. VMware virtual disk descriptor files were reviewed in the blog post about converting VMware VMs to Hyper-V VMs. Read the abovementioned blog mail to see how to extract, edit and import an embedded virtual disk descriptor.
On the screenshot below, accept a look at two virtual disk files opened in HEX editor. The same operating system is installed on both virtual disks (the starting time partitioning used for installing the OS was created and formatted with a born Windows disk utility). On the left side of the screenshot a -flat.vmdk file is displayed (ESXi format). The raw data is written from 0x00000000 on this virtual deejay -flat.vmdk file. On the correct side of the screenshot, the virtual disk of the Workstation format is displayed and the same data is written from 0x00150000 (byte number 5376) which is not the first of the vmdk file.
Now, subsequently familiarizing yourself with the theory, information technology'due south time to focus on the practical function. Before you continue, information technology is recommended that yous back up your data to foreclose whatsoever possible virtual disk damage. Perform operations with your disks at your ain responsibility and risk.
Methods That Need Powering on a VM
Starting time, let's consider the methods of opening virtual disk images past using existing VMs. The advantages of these methods are simplicity and universality. At the same time, nevertheless, you demand a hypervisor (VMware ESXi, VMware Workstation, VMware Player or Oracle VirtualBox) to be installed on your physical computer.
Using a Live DVD even if an OS on a VM is dead (a legacy method)
The idea behind this method is that you have a VM and can boot from a DVD disc. The ISO disk image can exist used as the DVD disc inserted into a virtual DVD drive of the VM. After booting an operating system from a DVD media, you lot can mount the partitions of your virtual disk and copy files from the virtual disk to a USB hard disk attached to the VM or to your host motorcar, or to any other machine via the network. Some Live DVD distributions mount disks (partitions) automatically.
This method can be called a legacy method because the principle is similar to copying files from physical disks of physical computers when the installed operating organisation cannot boot. This method can be used to extract data from VMDK disks of VMs running on VMware ESXi and VMware Player/Workstation.
Exist aware that the operating organisation booted from Alive DVD must recognize file systems of partitions of your virtual deejay whose files you want to admission. For example, Windows cannot work with Linux file systems such as EXT3, EXT4, ReiserFS, etc. by default. Using boosted tools on Windows may help to resolve this effect. In turn, modern Linux recognizes Windows file systems such as NTFS and FAT32, hence yous can utilise Linux-based Live DVD discs to re-create files stored on virtual disks used by your Windows VM that cannot boot.
Example: Opening VMDK files on ESXi
Allow's consider using this method on an case: when you have a VM with Windows Server 2022 on an ESXi host and the Bone on the VM cannot boot, but you need to become the files recorded on the VMDK virtual disk. At that place are two NTFS partitions on the virtual disk – one is the boot system sectionalization and the 2nd is disk C. The official Ubuntu 18 installation ISO image is used in the electric current case. The Ubuntu installation media tin be used as Live DVD. Upload the ISO paradigm to the datastore that is accessible for the ESXi host on which the VM is residing.
Open VMware vSphere Client, get to Hosts and Clusters, select your VM, and click Edit Settings.
In the VM settings window, become to CD/DVD drive options. Select the Datastore ISO File option if y'all have the necessary ISO file on the datastore accessible by the ESXi host. Then, for the CD/DVD Media option, click Scan and select the appropriate ISO file on the datastore. The file proper noun is ubuntu-eighteen.04.1-desktop-amd64.iso in this case.
Start the VM, boot from the ISO paradigm and select Endeavour Ubuntu Without Installing. In one case Ubuntu has booted from the Live DVD media, open console (Last).
Get the root privileges
sudo -i
Listing available hard deejay devices
ls -al /dev/sd*
There are 2 partitions - /dev/sda1 and /dev/sda2.
Make directories to be used as mount points for each sectionalisation.
mkdir /mnt/win-disk1
mkdir /mnt/win-disk2
Mount the partitions of the virtual deejay to the appropriate directories.
mount /dev/sda1 /mnt/win-disk1/
mount /dev/sda2 /mnt/win-disk2/
Then list files and directories of the mounted partitions.
ls -al /mnt/win-disk2/
ls -al /mnt/win-disk1/
Every bit yous can come across on the screenshot in a higher place, the segmentation mounted to /mnt/win-disk2 is the partition used as disk C: in Windows.
Now you can attach a USB hard disk drive drive (HDD) to the USB port of your ESXi host and connect this HDD to the virtual machine with the USB pass-through feature for copying the necessary files stored on the VMDK file used as a virtual disk by a virtual auto. Another way is to employ an SMB (CIFS) share and copy the contents of the virtual disk (i.east., the VMDK file) to some other location via the network. In our instance, copying data to the SMB share will be explained. The SMB share has been created on the host whose IP address is 192.168.17.125, the share name is \\192.168.17.125\share, and user10 has write permissions for this share. Don't forget that Linux, unlike Windows, uses the right slash when connecting to the share.
Let's mount the SMB (CIFS) share on Linux loaded from the live DVD. First, create a directory to be used as the mount indicate.
mkdir /mnt/smb-share
Then mount the SMB (CIFS) share to this directory:
mount -t cifs -o user=user10 //192.168.17.125/share /mnt/smb-share
Enter the countersign of the user.
Now your Linux system is connected to the SMB share, and you can copy the necessary contents stored within the VMDK file to the SMB share over the network. Allow's go to the directory to which the SMB share is mounted and re-create the bootmgr file from the mounted partition of the virtual disk (the VMDK file on the ESXi datastore) to the current directory (SMB share).
cd /mnt/smb-share
cp /mnt/win-disk-two/bootmgr .
Then make sure that the necessary files have been copied, and check the contents of your SMB share.
ls -al /mnt/smb-share
As you can see on the screenshot above, the bootmgr file used in this example has been copied successfully. Now yous know the first method of copying the contents of the VMDK file to another location when an operating system installed on a VM cannot boot. The logics of using this method on VMware Player or VMware Workstation is the same.
How to mountain a VMDK file as a virtual deejay to a healthy VM (ESXi/Workstation/Thespian)
This method is similar to the previous one, but a VMDK virtual deejay should be attached to an existing virtual machine that has a functioning operating organization. You lot tin can attach a VMDK file as an boosted virtual disk to an existing VM running on an ESXi host, VMware Workstation and VMware Player. If y'all want to open a VMDK file of the ESXi VM on VMware Workstation or Player, you should copy both the virtual deejay and its descriptor (vmdk and -flat.vmdk files) to a physical disk that is attainable for your calculator where VMware Workstation or Histrion is installed. If snapshots have been taken for the VM, and changes have been made with VM disks after that, don't forget to re-create the VMDK files of delta (differencing) virtual disks in improver to the parent VMDK files.
Let'southward consider two examples – how to open a VMDK virtual disk of one VM by using another VM on an ESXi host (both are registered on an ESXi host) and how to extract content from a VMDK virtual deejay of an ESXi VM by attaching the virtual disk to a VM of the VMware Workstation format.
Keep in listen that the functioning operating system on the offset (good for you) VM must be uniform with file systems used on a virtual disk of the second VM that has a non-bootable operating system (a VM whose VMDK file you lot want to attach equally an boosted virtual disk to extract files).
Example ane: Mounting a virtual disk to a VM running on ESXi
Power off the VM that uses a virtual deejay from which files you desire to excerpt. Observe this virtual disk in the ESXi datastore. Copy the virtual disk to another directory on the aforementioned datastore or some other datastore to prevent an error caused by virtual deejay lock. In our case, we will show how to open a VMDK file whose name is Win-test2.vmdk (this is a virtual disk of the Win-test2 Windows virtual motorcar in our instance). The ESXi host is managed by vCenter. If yous use a standalone ESXi host without vCenter, you can use the logics explained in this instance – the differences are only in the user interface.
Open VMware vSphere Client, go to Storage and select the datastore on which the necessary VMDK file is located. Select the VMDK file and click Copy to.
Notation: If you lot take a standalone ESXi host and don't have vCenter, open up VMware Host Client past inbound the IP address of your ESXi host in the spider web browser, so become to Storage > [Your datastore proper name] > Datastore Browser, select your VMDK file and hit Copy. Select destination and hit the Copy push button to ostend. Recollect, that virtual disks are displayed equally VMDK files in the spider web interface of VMware vSphere Customer and VMware Host Client, only a virtual disk consists of the -apartment.vmdk and vmdk files (a virtual deejay and its descriptor). Yous tin also open the ESXi console directly on the server or past connecting via SSH to copy the files.
In the opened window, select the destination. Yous tin can re-create the VMDK file to some location on the aforementioned datastore or to another datastore. Permit's copy the VMDK file to the root directory of the same datastore for this sit-in. Both vmdk and -flat.vmdk files are copied in this case.
Now you need to attach the VMDK virtual disk to another healthy VM whose operating system is working properly. In this example, a VM running Windows Server 2022 on the same ESXi host is used (the VM name is WinServer2016). A virtual deejay tin be fastened to this healthy VM while the VM is running. In vSphere Client, go to Hosts and Clusters, select the healthy VM, right click the VM and hit Edit Settings.
In the window that appears, hitting Add together New Device and select Existing Hard Disk.
Select the copy of your VMDK file that y'all accept made previously. In the current case, the re-create of Win-test2.vmdk located in the root directory of the datastore has been selected.
Power on the salubrious VM to which y'all have fastened the virtual disk you are interested in, if the VM has not been powered on however. A virtual deejay is added on the wing for a running Windows Server 2022 VM. In the guest Windows OS, go to Estimator Direction > Disk Management (or run diskmgmt.msc in the command line) and notice your virtual disk attached. By default, the new fastened disk is offline. Right click the disk and hit Online. A disk letter should be assigned automatically for partitions on the added disk. If a disk letter has not been assigned for a partition, right click the partition and hit Change Drive Letter of the alphabet and Paths.
Now you have full (read/write) access to files and directories of the VMDK virtual deejay. Just open the mounted disk in Windows Explorer and copy the necessary content of the VMDK file mounted to the healthy VM. You can also delete unnecessary data from the attached VMDK virtual disk (for instance, if in that location are any files that were created by viruses), but exist careful and don't damage a virtual disk if in that location are related snapshots for the mounted VMDK disk.
Example ii: Mounting a virtual disk to a VM running on VMware Player or Workstation
This case is similar to the previous ane, but a VM running on VMware Workstation is used to open VMDK files of the ESXi VM. This method can be used when there is no free disk space on the ESXi datastore to re-create a virtual disk, for instance. A virtual deejay of the Win-test2 VM that was mentioned in the previous example will be mounted to a VMware Workstation VM to extract its content.
In VMware vSphere Client, go to Storage > [Your datastore name] > Files, select your VMDK file and hitting Download.
Every bit you call up, a virtual deejay of the ESXi format consists of vmdk and -flat.vmdk files. You need to download both files to your machine where VMware Workstation or VMware Player is installed. When you download a virtual deejay from the ESXi datastore with VMware HTML5 vSphere Client, these ii files are packed into a one zip annal.
As an culling, you can enable SSH access to your ESXi host, go to the datastore directory and copy both virtual disk files to your computer manually by using an SCP client, for instance, WinSCP.
Be aware that when you lot download a thin provisioned virtual disk from an ESXi datastore that has the VMFS file system to your calculator, you volition become a lightweight vmdk file and a -apartment.vmdk file whose size volition be equal to the maximum provisioned size of the virtual disk (as you lot would practise when downloading a thick provisioned virtual disk). This is because sparse provisioning can be considered every bit a VMFS file system characteristic.
Now you lot can see two files of the ESXi-format virtual disk that take been downloaded in a Naught archive. The size of the thin provisioned virtual disk on the VMFS datastore is near 2GB now (see the screenshot above) and the size of the aforementioned disk downloaded to a workstation machine is about 8GB (see the screenshot beneath). Unzip the two files from the archive. Past default, the files are extracted to the Win-test2.vmdk directory whose name is the same as the archive proper name without a file extension.
For performing the next footstep, you should have a good for you VM with a functional operating system on your car with VMware Workstation of Player installed. While in the previous instance, the VM running Windows Server 2022 was used, a salubrious VM running Windows Server 2008 is used in the current case.
Open VMware Workstation or VMware Role player, select your healthy VM and edit virtual machine settings.
In the Hardware tab, hit the Add button.
The Add Hardware Wizard is open. Select Hard disk as the hardware type. Then, select a blazon of deejay (you may leave the recommended value). On the Select a Disk screen, select the Employ an existing virtual disk selection.
Select the vmdk file (non -apartment.vmdk) you accept extracted from the ZIP archive. You tin can browse the file or enter the unabridged path to the file manually.
In the electric current example, ESXi 6.five and VMware Workstation 15 are existence used. The VMware Workstation VM running Windows Server 2008 in our case has the Workstation 12 hardware version (VM version 12). The ESXi VM whose virtual disk we want to attach has the VM version 7.
VMware Workstation says that the virtual disk copied from the ESXi host is not compatible with this virtual machine:
The selected virtual disk is incompatible with this Workstation 12.x virtual machine. Adding this disk would make this virtual motorcar incompatible with older VMware products.
This error can be fixed past editing the disk descriptor file (the lightweight vmdk file in the case of virtual disks of ESXi VMs). Open your VMDK file in the text editor and edit the number in the Ddb.virtualHWVersion string. In our case, 13 gets inverse to 12.
Annotation: Call up that for virtual disks of VMware Workstation VMs, a virtual disk descriptor is built in the virtual disk VMDK file (in that location is no divide descriptor file every bit for virtual disks of ESXi VMs).
After this manipulation, the virtual deejay has been successfully added to the existing VM.
Ability on the VM if information technology has non been powered on yet
Open up the Disk Management in Windows, change your virtual deejay status to online, assign a drive letter to a sectionalization and scan the files.
Methods that Don't Need Powering on a VM
The methods that don't require you lot to configure and power on a virtual machine take their own advantages. Some of these methods don't require installing a hypervisor. You tin mount VMDK files directly to your host operating system in a short period of time.
Mounting VMDK files in a host OS with VMware Workstation
This method requires y'all to have VMware Workstation installed on a Windows or Linux operating system running on your physical reckoner. VMware Workstation provides a squeamish feature that allows you to mount VMDK files to your host operating system. Virtual disks of the ESXi format and delta disks related to VM snapshots are supported. Similarly to all previous methods considered in this weblog mail service, your operating arrangement must support file systems of virtual disk partitions.
If you have snapshots of your virtual machine, the delta virtual disks are created subsequently creating each snapshot. You should have a parent virtual disk and delta disks available if you want to open a virtual disk country the moment after taking one or another snapshot. In this example, yous should mount the advisable delta virtual disk to your host operating system. Dependencies related to the parent virtual disk will be resolved automatically.
If you accept snapshots but wish to open a parent virtual deejay, please open the parent virtual disk in the read-only style because making changes on the parent virtual deejay can cause problems with damaging snapshots or linked clones created from a parent virtual motorcar with the parent virtual deejay. The read-only mode prevents you from writing data on a virtual disk later mounting the disk to the host OS. You lot can mount VMDK virtual disk files if a VM that uses this virtual deejay is powered off, or if a particular VM isn't using this virtual deejay.
Let's consider how to mountain a VMDK virtual disk of the VMware Workstation VM that has snapshots. At that place is Windows installed on one NTFS partition on a virtual disk of the VM. After taking the first snapshot, the Snapshot1.txt file was created in the root directory of the deejay C: and, similarly, after taking the second snapshot, the Snapshot2.txt file was created in that location. The first example is for Linux and the 2nd example is for Windows. Virtual disk files of the old Windows XP VM are used in the electric current example.
Example one: Mounting VMDK on the Linux host
Open VMware Workstation for Linux and get to File > Mount Virtual Disks.
Hitting Mount Disk, the pop-up window is opened after that. Click Browse and select the virtual disk VMDK file.
Permit's select the VMDK file of the 2d differential virtual disk created after taking the second VM snapshot. The name of this file appears as VM_name-000002.vmdk in such cases (WinXP-examination-000002.vmdk is used in this example).
Create the directory on your Linux file system for mounting a virtual disk of the VMDK format to that directory. Let'southward create the /mnt/vmdk/ directory in the Linux console.
mkdir /mnt/vmdk/
Set permissions for your user (the user name is user1 and it is a fellow member of group1 in the electric current case):
chown -R user1:group1 /mnt/vmdk/
chmod -R 0775 /mnt/vmdk/
At present, select the directory you accept created as the target directory, check the "Mount in read-only mode" checkbox and click Mount.
At present you are able open the /mnt/vmdk/ directory in your Linux file explorer and browse files and directories located on the VMDK virtual disk. You can see Snapshot1.txt and Snapshot2.txt files which were created later creating the first and second snapshots in this example. Each of these 2 files is located on the separate delta VMDK virtual deejay.
Don't forget to unmount the VMDK virtual deejay from the directory (mount signal) on your host Linux arrangement after finishing operations with the virtual disk content.
Mounting VMDK on the Linux host in panel
If you prefer using the panel interface, you tin mountain VMDK deejay images with this command:
vmware-mount /media/user1/vms/vm_name/vm_disk_name-000002.vmdk /mnt/vmdk
Where:
vm_name is the proper noun of the virtual machine that is the same as the VM directory proper noun in this instance. WinXP-test is the VM proper noun in our example.
vm_disk_name is the proper name of the virtual disk (WinXP-test.vmdk is used in this example)
vm_disk_name-000001.vmdk is the name of the get-go delta (differencing) disk created later taking the first VM snapshot (WinXP-test-000001.vmdk in this case)
vm_disk_name-000002.vmdk is the name of the second delta disk created after taking the second VM snapshot accordingly (WinXP-test-000002.vmdk in this case)
Mount a virtual deejay. By default, the virtual deejay is mounted in the read/write mode. Yous can utilise the -r central in the command line to mount a disk in read-only mode.
vmware-mount /media/user1/vms/vm_name/vm_disk_name-000002.vmdk /mnt/vmdk
List all mounted VMDK virtual disks:
vmware-mount -50
Before finishing working with mounted VMDK virtual disks, unmount all virtual disks:
vmware-mountain -x
Instance ii: How to mount VMDK on the Windows host
The idea of how to mountain VMDK files in Windows is like. In addition to the File > Map Virtual Disks pick in the graphical user interface (GUI) of VMware Workstation, y'all can simply right click the VMDK file in Windows Explorer and in the context carte du jour, hit the Map Virtual Disk option. Let'due south mount the VMDK file of the first differential virtual deejay created subsequently taking the starting time VM snapshot. The proper name of this VMDK file has the following format: VM_name-000001.vmdk (WinXP-exam-000001.vmdk is opened in this tutorial).
It is recommended that you open up the VMDK file in read-only mode to preclude any possible damage of virtual disks that belong to the snapshot concatenation after writing data. The default drive letter is Z: in this case and the drive is opened in Windows Explorer automatically after mapping if the advisable checkbox is ticked. Hit OK to proceed.
Now the virtual disk is mounted as disk Z: in Windows. On the screenshot below, you can see the Snapshot1.txt file created after taking the first snapshot. The Snapshot2.txt file is missing considering information technology was created afterward taking the second VM snapshot, and we have opened a delta virtual deejay related to the commencement VM snapshot.
When you have finished working with the mapped VMDK virtual disk, don't forget to disconnect the disk. Right click the appropriate VMDK file and hit Disconnect Virtual Disk. Afterward disconnecting the virtual deejay, you tin power on a VM that uses this virtual disk.
Using vii-aught to extract content from VMDK files
If you are looking for how to open VMDK files without running virtual machines, y'all tin can install seven-zip and extract content from virtual disk images. 7-zip is a complimentary tool intended to annal files and unpack files from archives and other images. This tool tin exist used on Linux and Windows machines.
7-zip can open vmdk and -flat.vmdk files (this utility can open a unmarried -flat.vmdk file if the descriptor vmdk file is missing) – it is actually for virtual disks of the ESXi format. 7-zero cannot open delta VMDK files created after taking VM snapshots.
How to open VMDK files with vii-zero on Linux
Install a full pack of seven-nada on your Linux machine. Ubuntu is used in this example.
apt-get install p7zip-full
List contents of the vmdk file with 7zip
7z l vm_name.vmdk
Let's discover the files that contain "boot." in their names, for instance.
7z l /media/user1/vms/WinXP-test/WinXP-test.vmdk | grep boot[.]
Where user1 is the name of our Linux user, 50 – listing.
Permit'due south extract (e) the boot.ini file from the VMDK epitome:
7z e /media/user1/vms/WinXP-examination/WinXP-test.vmdk boot.ini
Excerpt other files and directories from the VMDK file similarly.
How to open VMDK files with 7-null on Windows
Download the compatible version of 7-zippo from the official spider web site and install the application on your Windows machine. Apply the EXE installer for more than convenience. After installing vii-zip on Windows, new 7-zip options are added to the context menu when you right click any file or folder in Windows Explorer (come across the screenshot). Employ these options to open a VMDK file every bit an archive or extract files correct at present.
On the screenshot below, the content of the standalone Win-test2-flat.vmdk file is displayed in the GUI of seven-zip used in Windows.
Other Methods to Open VMDK Files in Linux
One of the most powerful capabilities of Linux is the power to perform the highest number of operations in the console even with congenital-in tools. These tools will help you to mount VMDK files and access the content stored on virtual disks. Ubuntu Linux is used in the provided examples.
How to mount VMDK files past using /dev/loop
Loop devices are pseudo-devices in Linux that make files accessible as cake devices and tin can exist used to mount deejay images that comprise file systems. Loop devices are named as /dev/loopX where X is the number of the loop device. This method is good to mount -flat.vmdk files even without a virtual disk descriptor.
Let's explore how to mount a VMDK file in Linux to admission the files of the virtual disk equally an example. In that location is a virtual disk of the ESXi format that contains 1 partition; a descriptor file is missing. A long time ago, Windows XP was installed on that virtual disk.
- Utilize 1 of the two commands to check the number of existing loop devices on your Linux system.
fdisk -l | grep /dev/loop
df -h | grep /dev/loop
- In our instance, devices with numbers 1 to 21 already be (/dev/loop1 - /dev/loop21). Thus, let's create the loop device number 30 – this number is free. We will associate this device with the -flat.vmdk file.
losetup /dev/loop30 /vms/Win-test2-flat.vmdk
- Fix the offset:
losetup -o 32256 /dev/loop31 /dev/loop30
Where 32256 is the kickoff that is 63*512 for a deejay formatted in Windows XP/Server 2003 and older Windows versions (63 is the number of the first sector of the segmentation and 512 bytes is the sector size). For Windows 7/Server 2008 and newer Windows versions, try the offset 105906176.
Yous can retrieve information about the sector size, and the first sector used for the kicking start with the command:
fdisk -l /dev/loop30 /vms/Win-test2-flat.vmdk
Equally an alternative, for virtual disks that contains multiple partitions, yous tin can utilize parted to decide the start and the end of each partitioning:
parted /dev/loop30
In the parted panel, enter the following commands.
unit
B
- Create a directory to be used as the mount point for the VMDK paradigm:
mkdir /mnt/vmdk-epitome
- Mount the loopback device associated with the VMDK image to the created directory:
mount /dev/loop31 /mnt/vmdk-epitome
- List the content of the mounted image:
ls -al /mnt/vmdk-image
- Later on finishing working with the content of the virtual disk, unmount the paradigm and disconnect the loop device.
umount /mnt/vmdk-image
losetup -d /dev/loop31
How to mount VMDK files with kpartx
Kpartx is a tool that tin mount partitions within paradigm files to the directories of your existent Linux file system. This tool tin exist used to set up device mappings for partitions of block devices. This method is likewise nice for mounting -flat.vmdk images used on ESXi servers. Allow'southward see how to mountain the -apartment.vmdk file used in the previous instance.
- Install kpartx:
apt-get install kpartx
- Add the division mapping for the VMDK image in the verbose operating manner:
kpartx -av /vms/Win-test2-flat.vmdk
- Mountain a partition to the /mnt/vmdk-image directory prepared before:
mount /dev/mapper/loop30p1 /mnt/vmdk-image/
Where loop30 is the number of the loop device and p1 is the number of the partition inside the epitome (the first sectionalization on the disk prototype).
- Listing the content of the virtual disk partition you accept mounted:
ls -al /mnt/vmdk-image/
- When yous take finished operations with files of the VMDK image, unmount the VMDK virtual disk image.
umount /mnt/vmdk-image
kpartx -d /vms/Win-test2-flat.vmdk
Conclusion
Today's blog post has covered different methods of getting data from VMDK files which are usually used as virtual disks. VMDK files can be opened with or without powering on a VM, and can too be mounted in Linux and Windows as virtual disk images. Hopefully, this data will help you find a suitable method for resolving your tasks.
Agreement how to open vmdk files and extract content from VMDK files is important if something goes wrong with a virtual machine. Knowing multiple methods of extracting VMDK content gives y'all the power of selection considering the different methods can each be the best option in sure situations. Moreover, it is even better to have backups of your VMs in addition to that knowledge.
NAKIVO Backup & Replication can back up and restore VMs running in VMware vSphere in the all-time way. If you have VMware backups made with NAKIVO Backup & Replication, you can recover the entire VM, the particular virtual deejay or separate files from the VMware backup to a custom location by using Universal Object Recovery, Instant File Recovery to Source, Flash VM Boot, and other features. The product tin can be installed on Linux, Windows and different supported NAS devices. Download NAKIVO Backup & Replication today and endeavor the product in your own environment.
Source: https://www.nakivo.com/blog/extract-content-vmdk-files-step-step-guide/
Posted by: yohowatiod1959.blogspot.com

0 Response to "How To Clean Up Orphaned Vmdk Files"
Post a Comment