Detailed Guide: Sharing VMDK Between Virtual Machines [2 Methods]
Sharing VMDKs between virtual machines is a common use case in virtualized environments where you need different virtual machines to access the same disks or data as a way to enjoy the benefits of sharing VMDKs between virtual machines.
VMware Workstation has a useful feature for sharing virtual disk files (VMDKs) between multiple virtual machines. This feature is often useful in these situations, including: sharing data between different virtual machines, enabling multiple virtual machines to access the same storage, and reducing storage overhead using a single disk file between different virtual machines. This article will focus on the various ways of sharing VMDK between virtual machines.
Why Share a VMDK Between Virtual Machine
VMDK makes the file format that VMware uses to store virtual disk data. When you create a new virtual machine, VMware generates a VMDK file for the virtual hard disk of that virtual machine. There are several benefits to sharing a VMDK among multiple virtual machines:
✔Data Sharing: Shared data is stored on a single virtual disk for access by multiple virtual machines.
✔Simplified management: Sharing a VMDK avoids data duplication and reduces storage overhead when multiple virtual machines need to work on the same virtual disk.
✔Centralized storage: By sharing a single VMDK, storage can be centralized for easy management and backup.
How to Share VMDK Between Virtual Machine
The following provides two methods to share VMDK between virtual machine.
Using VMware Workstation’s Shared Folders (For Data Sharing)
It is impossible to share VMDK files directly between two running virtual machines, but VMware Workstation provides a feature called Shared Folders, an efficient way to share data. This method step shares the actual VMDK, but instead shares files on the host between virtual machines.
Step 1. Create a folder on the host system that is shared with the virtual machine.
Step 2. Open the VMware Workstation and select the virtual machine you want to configure. Click VM in the top menu and select Settings.
Step 3. In the Settings window, go to the Options tab. Select Shared Folders in the left pane, and then click Always Enable or Enable Until Next Power off. And click Add and select the folder you want to share on the host computer.
Step 4. On Windows systems, you can usually find it in the \\vmware-host\Shared Folders directory.
📌Note: This method is ideal if you need to share data between virtual machines, but it does not involve directly sharing the VMDK files.
Share VMDK Disk between VMs on VMware ESXi
Sharing a VMDK between virtual machines (VMs) on VMware ESXi using a SCSI controller is a common practice for advanced configurations, the following section will demonstrate how to share a VMDK disk between multiple VMs using a SCSI controller in VMware ESXi.
Step 1. If virtual machines are running, power them off before configuring.
Step 2. In the vSphere Client or vCenter, right-click a virtual machine and choose Edit Settings.
Step 3. If the virtual machine is not already configured with a SCSI controller for shared access, click Add New Device and select SCSI Controller.
Step 4. Ensure that you are using a shared SCSI controller. Typically, an LSI Logical Parallel or VMware Paravirtual SCSI controller is used. Remember to create a new SCSI controller, don’t use a default SCSI 0 controller.
Step 5. Set up bus sharing for SCSI controllers, for Bus Sharing Mode, set to Virtual Machine or Physical. These settings allow multiple virtual machines to share access to the disk.
Step 6. Go to Edit Settings > Add Hard Disk > New standard hard disk to add a new virtual disk to the first VM. Follow the configuration below:
- VM Storage Policy: optional
- Location: select a shared datastore name that will store the VMDK file.
- Disk Provisioning: select Thick provisioned eager zeroed.
- Sharing: multi-writer
- Virtual Device Node: select the SCSI controller created earlier.
- Disk mode: Independent – Persistent
Step 7. In the Hardware tab, click Add New Device and select Existing Hard Disk to edit the settings for each virtual machine.
Step 8. You can start the virtual machine after attaching the VMDK to the virtual machine and ensuring that the SCSI bus share is properly configured.
How to Secure VMDK Files Secure using Backup Software
Sharing VMDK files between virtual machines does bring some benefits, but you need to be aware that VMDK files are more prone to corruption, which can lead to virtual machine data loss. So, you need backup software that can backup VMware datastores or all virtual machines in VMware.
AOMEI Cyber Backup is a professional backup software that provides security insurance for your virtual machines. It offers more features.
🎯Centralized Management: You can manage all backups from a single interface.
🔆Schedule Backup: You can create an automatic task to back up VMs daily, weekly, and monthly.
✨Agentless Backup: You can create full, standalone image-level backups for entire VMware virtual machines without installing agents on each VM.
🔰Instant Recovery: You can quickly restore deleted VMDK files to minimize downtime and data loss.
Easy steps to backup and restore VMDK files
Step 1. Navigate to Source Device > VMware > + Add VMware Device to add a VMware host. Then enter Device Information and User Information, and click Confirm.
Step 2. Navigate to Backup Task > + Create New Task, and select VMware ESXi Backup as the Backup Type. Then set the Task Name, Device, Target, Archive, Schedule, and Cleanup according to your needs.
- Archive: You can enable archiving backup versions to Amazon S3 and click Select to choose the added Amazon S3.
- Schedule: You can schedule the backup as full, incremental, or differential backup and specify the time to run the backup.
- Cleanup: You can configure a retention policy to auto-delete files and save storage space.
Step 3. Click Start Backup and select to Add the schedule and start backup now, or Add the schedule only.
Step 4. Navigate to Backup Task, and click … > Restore to start restoring VM from the backup.
- Select the restored content from your VM backups, and click OK. You are allowed to restore the entire virtual machine from any selected backup version.
- Select Restore to original/new location saving the trouble of re-configuring the new VM.
Conclusion
Sharing VMDK files between virtual machines in VMware Workstation needs to be carefully configured to avoid issues such as data corruption or file locking. However, sharing VMDK between virtual machines can also offer several benefits, which you can implement using the two methods provided in this article.