如何在Windows 10主机与Hyper-V Ubuntu 16.04虚拟机间共享文件夹?
Hey there, let’s get your 70GB Windows folder accessible in your Ubuntu 16.04 Hyper-V VM—since WinSCP and other tools aren’t cutting it, let’s lean on Hyper-V-native solutions that are built for this exact scenario:
This is the most straightforward way, as it lets you mount your Windows drives directly in Ubuntu without extra setup:
First, enable Enhanced Session Mode on your Windows host:
- Open Hyper-V Manager, right-click your host PC name > Hyper-V Settings
- Navigate to Enhanced Session Mode Policy and check "Allow enhanced session mode"
- Go to Enhanced Session Mode under User Settings and check "Use enhanced session mode"
- Hit OK to save changes
Now configure the Ubuntu VM to use this mode:
- Shut down the VM completely (don’t just pause it—full shutdown is key here)
- Right-click the VM > Settings > Integration Services
- Make sure "Guest services" is checked (this enables file sharing between host and guest)
- Start the VM, and when it boots, click the "Connect" button in Hyper-V Manager
- In the connection window, click Show Options > Local Resources > More...
- Under "Local devices and resources", expand Drives and check the drive where your 70GB folder lives
- Click OK, then connect to the VM
- In Ubuntu, your Windows drive will appear under
/mnt—you can find it via the file manager or by runningls /mntin the terminal
If Enhanced Session Mode doesn’t work for some reason, you can package your folder into a VHD and attach it directly to the VM:
On your Windows host:
- Open Disk Management (right-click Start > Disk Management)
- Click Action > Create VHD
- Pick a save location, set the size to at least 70GB (dynamic allocation saves space, fixed is faster), then click OK
- Initialize the new VHD: right-click the unallocated space > Initialize Disk, choose GPT or MBR (GPT is better for larger drives)
- Create a formatted volume: right-click the unallocated space > New Simple Volume, follow the wizard to format it with NTFS
- Copy your 70GB folder into this new VHD drive
Attach the VHD to your Ubuntu VM:
- Shut down the VM in Hyper-V Manager
- Right-click the VM > Settings > SCSI Controller > Hard Drive > Add
- Select Use an existing virtual hard disk and browse to the VHD you just created
- Start the VM, then install NTFS support in Ubuntu if you don’t have it:
sudo apt-get update && sudo apt-get install ntfs-3g - Create a mount point:
sudo mkdir /mnt/windows-folder - Find the disk path (run
sudo fdisk -l—look for a drive like/dev/sdb1that matches your VHD size) - Mount the drive:
sudo mount /dev/sdb1 /mnt/windows-folder - To make this mount permanent across reboots, add a line to
/etc/fstab(just make sure you test the mount command first to avoid boot issues)
This uses network file sharing to access the folder from Ubuntu—great if you need to access the folder from multiple VMs later:
On your Windows host:
- Right-click your 70GB folder > Properties > Sharing tab > Advanced Sharing
- Check "Share this folder", give it a simple share name (e.g.,
BigDataFolder) - Click Permissions, and make sure the Windows user account you’ll use has "Full Control", "Change", and "Read" permissions
- Head to the Security tab, and ensure the same user has the necessary permissions (you might need to add your user here if it’s not listed)
- Note your Windows host’s IPv4 address: open Command Prompt and run
ipconfig, look for the IPv4 address under your active network adapter
On your Ubuntu VM:
- Install SMB utilities:
sudo apt-get update && sudo apt-get install cifs-utils - Create a mount point:
sudo mkdir /mnt/smb-share - Mount the share (replace placeholders with your actual details):
sudo mount -t cifs //<YOUR-WINDOWS-IP>/BigDataFolder /mnt/smb-share -o username=<YOUR-WINDOWS-USER>,password=<YOUR-WINDOWS-PASS> - If you get permission or protocol errors, try specifying an older SMB version (Ubuntu 16.04 can have issues with newer SMB protocols):
sudo mount -t cifs //<YOUR-WINDOWS-IP>/BigDataFolder /mnt/smb-share -o username=<YOUR-WINDOWS-USER>,password=<YOUR-WINDOWS-PASS>,vers=1.0 - For permanent mounting, add a line to
/etc/fstab(test the mount command thoroughly first!)
- Install SMB utilities:
Start with Method 1—it’s the least hassle and usually works out of the box once Enhanced Session Mode is enabled. If you run into any specific errors with a step, let me know and I can help troubleshoot further.
内容的提问来源于stack exchange,提问作者1gentlemann

