Transfer files between Hyper-V host and Linux guest OSes.
You can download Windows installer from release page, but need to build server daemon by yourself for Linux.
Important
hvcp use port 50500 with VSOCK address family on Linux. And also GUID 0000c544-facb-11e6-bd58-64006a7986d3 is used on Windows.
According to Microsoft Learn, GUID for Linux guest is templated. It means port 50500 is reserved by hvcp.
hvcp is the fastest than scp and Copy-VMFile on my PC.
Environment:
- File to transmit
- 4 GB generated by
dd if=/dev/urandom of=dummy-4gb.dat bs=1M count=4096 status=progress
- 4 GB generated by
- Host
- Hardware
- CPU: AMD Ryzen 3 3300X
- Memory: 16 GB
- Windows 11 Professional (version 10.0.26100 build 26100)
- OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
- Hardware
- Guest
- Hyper-V Gen 2 guest
- 4 vCPU
- 8192 MB memory
- Arch Linux
- linux 6.16.3.arch1-1
- glibc 2.42+r17+gd7274d718e6f-1
- openssh 10.0p1-4
- hyperv 6.16-1
- Hyper-V Gen 2 guest
Install hvcp on your Linux guest. You can install it via dnf.
sudo dnf install [hvcp RPM URL on GitHub Release]
Then you start hvcp-server on the console or systemd.
Console:
hvcp-server
Systemd:
sudo systemctl start hvcp
You need to run hvcp.exe with Administrator privilege. So sudo or the terminal on Administrator is required.
sudo hvcp path\to\file\on\host <username@>[VM Name]:/path/to/file/on/guest
sudo hvcp [VM Name]:/path/to/file/on/guest path\to\file\on\host
Note
The file on Linux guest should be accessed by the user who runs hvcp-server.
Basically all files can be accessed when hvcp-server runs via systemd because it would be run as root.
Note
hvcp uses simdjson. Single header code has been copied into dll/simdjson.
linux is server daemon which is run on Linux guest.
cd linux
make
sudo make install
make install installs server daemon (hvcp-server) to /usr/local/bin, and also systemd unit file (hvcp.service) is copied into /usr/lib/systemd/system. You can enable it via sudo systemd enable hvcp.
You can create hvcp-server RPM with SPEC file in rpm. Container would be help to build.
mkdir /tmp/hvcp-rpms
podman run -it --rm -v /path/to/hvcp/gitrepo:/usr/src/hvcp:Z -v /tmp/hvcp-rpms:/out:Z fedora:latest /usr/src/hvcp/rpm/rpmbuild.sh
Caution
Source directory of hvcp ( /path/to/hvcp/gitrepo in above) should be git repository because rpmbuild.sh would access it with git.
dll is an engine of hvcp (Windows side), used by cli which is command line tool for Windows. installer is a project for WiX to generate MSI package.
You can build both CLI and DLL when you build dll project. installer depends both CLI and DLL, it means all of projects would be built.
Apache 2.0
