How to add files to Hyper-V virtual machine?

Are you looking for a way to add files to your hyper v virtual machine? If so, you’ve come to the right place! This blog post will show you how to add files to Hyper-V virtual machine.

How to add files to Hyper-V virtual machine:

How to add files to Hyper-V virtual machine

If you need to add files to your virtual machine, you can use the Hyper-V Manager. To add files to a virtual machine:

  • Start the Hyper-V Manager and connect to the server that hosts the virtual machine.
  • In the left pane, select the virtual machine.
  • In the right-hand pane, click Settings.
  • Click Add Hardware, and then click Add IDE Hard Disk.
  • In the Add IDE Hard Disk dialogue box, choose whether you want to create a new virtual hard disk or use an existing one, and then click Next.
  • If you are creating a new hard disk, enter a name for the disk and specify its size, and then click Next. If you are using an existing hard disk
  • Select a location for the virtual hard disk file and click Next.
  • On the Specify Disk Format page, choose whether you want to use a thick or thin provisioned disk, then click Next.

How to add files to Hyper-V virtual machine:

We will use two methods: Share folder and transfer files via command line.

Method 1: Share folders between host and guest VM

The first method is creating a shared folder on the host machine and copying files into this folder from the guest VM. Using this method, you can also share an entire drive with a guest VM. Here are the steps:

  • Go to “Edit Disk” of your guest VM in Hyper-V Manager.
  • Select “Share a Folder“.
  • Enter the path of the folder you want to share with the guest VM. For example, we have a folder named “test” in our host machine (the name of our host machine is “WIN-11“). The path of this folder is “C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\test“. So, we will enter this path in the “Folder path” text box.
  • Now, go to your guest VM and open Windows Explorer. You will see the shared folder under “Network Locations“.

Method 2: Transfer files from the host to the guest via command line

The second method is transferring files from the host machine to the guest via a command line interface (CLI). For this purpose, you need to install the OpenSSH server in your Linux guest VM and WinSCP in your Windows host machine. Then follow these steps:

  • Install the OpenSSH server in Linux guest VM by opening a terminal and entering the following command:
sudo apt-get install OpenSSH-server
  • Start the ssh service by entering the following command in the terminal:
sudo service ssh start

How do I access the local drive-in Hyper-V?

To access a local drive-in Hyper-V, you’ll need to do the following:

  • Shutdown the virtual machine
  • Go to Settings for the virtual machine
  • Click on “Add Hardware”
  • Select “SCSI Controller”
  • Add the SCSI controller
  • Shutdown the virtual machine
  • Right-click on the virtual machine and select “Edit Disk.
  • Add the existing disk that you wish to access

How do I access my hard drive from a virtual machine?

There are two ways to access your hard drive from a virtual machine: the hypervisor or the virtual machine’s operating system.

You’ll need to use a tool like VMware vCenter Converter or Microsoft Hyper-V Manager to access your hard drive through the hypervisor. With these tools, you can mount your hard drive as a virtual disk and access it from the hypervisor.

If you want to access your hard drive through the virtual machine’s operating system, you’ll need to use a tool like VMware Workstation or Microsoft Virtual PC.

With these tools, you can add your hard drive as a physical disk to the virtual machine and access it from within the operating system.

How do I mount a hard drive in Hyper-V?

Microsoft Hyper-V does not automatically mount other hard drives. This task must be completed manually, and the process is different depending on the version of Microsoft Windows you’re running the virtual machine on.

For older versions of Windows, you’ll need to use Diskpart.exe to add the new drive. For newer versions, you can use the built-in Disk Management tool.

Once you’ve added the drive, you’ll need to format it before you can start using it. This can also be done in Disk Management or with the Format command in the Disk part.

How do I get a local machine on a virtual machine?

There are two ways to get files from your local machine onto a Hyper-V virtual machine (VM) and two ways to get files from a VM back onto your local machine.

One set of methods uses the Copy and Paste commands, and the other set uses drag and drop.

How do I share files from the local machine to a virtual machine?

You’ll need to set up a shared folder to share files between your local machine and a virtual machine.

  • To do this, open the Hyper-V Manager and select the virtual machine you want to share files with. In the Settings section, select “Enable integration services.” This will install the necessary drivers for shared folders.
  • Next, open the Virtual Machine Connection for your virtual machine. In the Action menu, select “Settings.” Go to the “Shared Folders” section and click “Add Folder.” Find the folder you want to share and click “OK.”
  • Now, open File Explorer on your virtual machine. The shared folder should be visible under “Network Locations.” You can access it just like any other folder on your local machine.

How to add files to Hyper-V virtual machine: Enable copy-paste

There are two ways to enable copy and pasting from the host to the virtual machine. The first is to use the menu at the top of the window, and the second is to use the right-click menu.

  • To use the menu at the top of the window, click “Edit” and “Copy.” The paste is then available under “Edit” or by pressing CTRL + V.
  • To use the right-click menu, right-click on the text or object you want to copy and select “Copy.” The paste is then available by selecting “Paste” from the right-click menu or pressing CTRL+V.

Windows 11 Hyper-V copy files from host to guest:

To copy files from the host machine to a guest machine in Hyper-V, follow these steps:

  • Open the Hyper-V Manager.
  • In the left pane, select the host machine on which the guest machine runs.
  • Select the guest machine to which you want to copy files in the middle pane.
  • In the Actions pane, click Settings.
  • In the settings dialogue box for the guest machine, select the Integrations tab.
  • Under Guest services, check the box next to File copy (this will enable file sharing between the host and guest machines).
  • Click OK to save your changes and close the dialogue box.
  • Now that file sharing is enabled, you can copy files from the host machine to the guest machine by using any of the following methods:

From File Explorer on your host machine, open a new window and type \\VIRTUALMACHINEIPADDRESS\ into the address bar (replacing VIRTUALMACHINEIPADDRESS with the actual IP address of your guest machine).

  • This will open a window showing all the files and folders on your guest machine that are shared with your host machine (these will be located in C:\Users\Public\Documents by default).
  • You can access these shared files and folders from your guest machine by opening File Explorer and selecting This PC from the left sidebar.
  • Under Network locations, you should see your host machine listed (you may need to click the expand arrow next to Network locations to see it).
  • Double-clicking on your host machine name will open a window showing all of the files and folders on your host machine that are shared with your guest machine

How to add files to Hyper-V virtual machine: local machine to a virtual machine

There are a few ways to copy files from your local machine to a Hyper-V virtual machine (VM). One way is to use the Hyper-V Manager itself.

With the Hyper-V Manager open, select the desired VM in the left-hand pane, then click ‘Copy Files’ in the Actions pane on the right.

End Note:

We have tried to cover all possible options on how we can copy files and resolve how to add files to Hyper-V virtual machine as a whole, do let us know which method you liked and used to add files.

English