Skip to content
/ hvcp Public

File copy tool between Hyper-V host and Linux guests

License

Notifications You must be signed in to change notification settings

YaSuenag/hvcp

Repository files navigation

hvcp CI CodeQL

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.

hvcp performance

Environment:

  • File to transmit
    • 4 GB generated by dd if=/dev/urandom of=dummy-4gb.dat bs=1M count=4096 status=progress
  • 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
  • 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

How to use

1. Start server on Linux

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

2. Copy files

You need to run hvcp.exe with Administrator privilege. So sudo or the terminal on Administrator is required.

2-1. Copy file to Linux guest from Hyper-V host

sudo hvcp path\to\file\on\host <username@>[VM Name]:/path/to/file/on/guest

2-2. Copy file to Hyper-V host from Linux 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.

Build

Note

hvcp uses simdjson. Single header code has been copied into dll/simdjson.

Linux

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.

Windows

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.

License

Apache 2.0

About

File copy tool between Hyper-V host and Linux guests

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages