问题原文
原帖链接 · Bilbo Bongo · CC BY-SA 4.0
I am trying to create a CentOS image template and my environment requires me to add a route file to the networking which would be different on each deployment.
Is there any way for me to inject a file from a Hyper-V host to a ext4 formatted Linux guest VHD?
Ideally I'd like to be able to write to script the creation of a VM in Powershell by copying the template VHD and injecting the route file to the VHD.
Is this possible?
已采纳解答
原帖链接 · ravikanth · CC BY-SA 4.0
There are multiple ways to perform this.
If you have Linux Integration Services (LIS) installed, you can use the Copy-VMFile Cmdlet on the Hyper-V host where the VM is running to copy the files into the Linux VM. On the VM settings, you need to enable Guest Services.
Once you have the LIS installed in Linux guest and Guest Services enabled in VM settings, ensure that the hypervfcopyd is running inside the guest. You can, then, use the Copy-VMFile cmdlet.
Copy-VMFile -Name centos001n -SourcePath 'C:\Scripts\myPytonLib.tar' -DestinationPath '/home/ravi/scripts' -FileSource Host
There are, of course, other methods if you have network connectivity.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
