Using a virtual machine can improve your productivity considerably. But there’s often a sticking point: copying text or files from the host PC to the guest, or vice-versa.
The thing is, it’s not as difficult as it initially seems. Here’s how to transfer files between your VM guest operating system and host PC, using VirtualBox or VMware.
How You Can Share Data Between Your Host PC and a Virtual Machine
A virtual machine is a software environment that emulates the hardware required to install an operating system (OS). In very general terms, this lets you install an operating system on an existing OS much like an app.
Our guide to virtual machines explains this in more detail.
You won’t be surprised by the options for sharing data between a host PC an any guest operating system running in a virtual machine. What may surprise you is how tricky they can be to set up. Your options are:
- Copy and paste
- USB drive
- Network share
Clearly, each option is best for a specific type of data. For example, copy and paste is best for sharing text and small files, such as copying code from a browser on your host PC into a terminal session in the guest OS.
Below, we’ll look at sharing data using these three methods on virtual machines running on Oracle VirtualBox and VMware Workstation Player.
Copy and Paste Data
The simplest option is to copy the data from your host PC and paste it into the window of the guest VM. Or copy from the guest VM and into an open file browser on the host. But is it as simple as it sounds?
Thankfully, yes, it is.
Copy and Paste Data in VirtualBox
If you’re using VirtualBox, with your virtual machine running, select Devices > Drag and Drop. Here, you can choose from Host to Guest, Guest to Host, and Bidirectional. There’s also the default option, Disabled. For the best results, use Bidirectional.
That’s all there is to it.
How to Copy and Paste Data in VMware
For VMware users, you’ll need to first install the VMware Tools package, which brings additional features. You can commence this via VM > Install VMware Tools. If you haven’t already downloaded VMware Tools, instructions for doing so will be given.
You can then enable copy and paste in VM > Settings > Options. Select Guest Isolation, then Enable copy and paste and confirm with OK.
Sharing data between the guest and host operating systems in this way is best suited for smaller files. You might also share text strings, URLs, that sort of thing. Steer clear of large files though—you have other options for those.
USB Stick
Using a USB stick to transfer data between two physical machines is a time-honored tradition. USB flash drives essentially replaced 3.5-inch floppy disks in the early 2000s.
But how can you use a USB drive to share data between a virtual machine and your host PC?
Share Files From a USB Stick in VirtualBox
To be able to access USB devices from within VirtualBox, you’ll need to enable USB access. For this, the VirtualBox Extension Pack is required from www.virtualbox.org/wiki/Downloads.
Once you’ve done that, insert the USB device you wish to use. Next, open VirtualBox and click File > Preferences, then Extensions and click +. Browse to the downloaded Extension Pack, click Open, then when prompted, Install. Follow the prompts to complete the process. You can then check to confirm USB is enabled in Settings > USB.
With the USB support added, you’ll need to enable it. In the main VirtualBox window, right click the VM you want to use and select Settings > USB. Click + then browse for the USB device. It will be available when you launch the VM. Additional drives can be added in the same way.
Copy Files from USB in VMware
With VMware, when a USB device is connected and the VM is the active window, the device is detected. However, it will not be detected by the host PC in this scenario. For this to happen, remove the drive, minimize the VM, then reconnect.
It’s simple but can get messy if you forget which operating system the USB stick is connected to.
This option is best for large files. Of course, you’re limited by the capacity of the USB device, so keep that in mind. Whatever VM software you use, safe ejection of USB devices is recommended on both host and guest virtual machines.
Create a Shared Drive
Your third option is to set up a network share on your host PC that the guest VM can access. This means designating a portion of your PC’s hard disk drive as accessible over the local network. With this set up, the VM can then connect to the network and access the drive.
Although physically all on the same computer, this adds higher capacity to your virtual machine data sharing.
Create a Share in VirtualBox
You should have already downloaded VirtualBox Guest Additions. This should be installed via Devices > Install Guest Additions, where you should browse for the appropriate EXE file. Follow the steps to the end, choosing the default options, then Finish.
Launch VirtualBox and open Devices > Shared Folders > Shared Folders Settings. Click +, then in Folder Path click the arrow and select Other. Browse (the host OS) for the folder you’re using as a share, highlight it, then Select Folder.
In the Add Share window, give the share a name (keeping the same name in the guest OS as in the host OS is wise). Check Auto-mount and Make permanent, then OK.
From the guest OS you’ll find the share set up in the usual location for network shares. For example in Windows 10, this will be under Network Locations in Windows Explorer.
Share a Network Drive in VMWare
Sharing data via a drive is enabled by default in VMware. All you need to do is follow the usual OS-specific steps to set up a network share. For example, if you were running Windows as a host and Linux as a guest OS, follow these steps to share files between Windows and Linux.
This will work for Windows, Linux, and BSD.
Note that folder sharing is not available in the free VMware Player.
While this is the most complicated option to set up, you will be able to effortlessly share larger files. These might include installers, disk image files, and hi-res videos.
Share Data to Maximize Virtual Machine Productivity
Not everyone needs to use a virtual machine, but those of us who do almost always need to share data. If you’re not copying files from the host to the guest OS, there’s reason to copy data from the VM. This is typically when you’re about to destroy the VM and want to back up your data.
Learning how to share data between a VM and host OS will help super-charge your VM use. These tips to improve virtual machine performance will also help.
Read the full article: How to Transfer Files Between a Virtual Machine Guest and Host PC
Read Full Article
No comments:
Post a Comment