I'm having a Windows 10 host with Hyper-V Linux VM having IOT EdgeAgent and EdgeHub modules installed. I have provided storageFolder mount to EdgeAgent & Hub to store offline files at var/iotedge/storage location in EdgeHub container.
I would like to run docker command to copy this nested VM container files with host Windows local C:/TempEdge folder.
Step 1: Using "connect-eflowVM" command to connect to IotEdge VM Step 2: sudo docker cp EdgeHub:/var/iotedge/storage "c:/TempEdge"
But it's treating 'c' as another container and throwing cannot copy between container error.
I have tried replacing "c:/TempEdge" with "//c/TempEdge" and "c/TempEdge"
But then it throws no such file directory error.
What will be the correct format or way to run this query in EflowVM (hyper-V) and copy data to host Windows C drive
Edit: Adding message for No such file or directory error
PS C:\Windows\system32> Copy-EflowVmFile -fromFile "C:\Users\XXXXXXX\TempEdge" -toFile "blobStorage" scp failed to execute [scp: C:/Users/XXXXXXX/TempEdge: No such file or directory] At C:\Program Files\WindowsPowerShell\Modules\AzureEFLOW\AzureEFLOW.psm1:4349 char:9
+throw "$command $arguments failed to execute [$err]" +CategoryInfo : OperationStopped: (scp failed to ...e or directory]:String) [], RuntimeException +FullyQualifiedErrorId : scp failed to execute [scp:C:/Users/XXXXXXX/TempEdge: No such file or directory
I followed this link to Use PowerShell functions for Azure IoT Edge for Linux on Windows with Copy-EflowVmFile.
Prerequisites:
The commands mentioned in the article are included in the AzureEFLOW.psm1
file. You can locate this file in the WindowsPowerShell directory at C:\Program Files\WindowsPowerShell\Modules\AzureEFLOW
on your system.
If the AzureEflow
folder is missing from your PowerShell directory, you must download and install Azure IoT Edge for Linux on Windows by following these steps:
Start-Process
command to install IoT Edge for Linux on Windows on your device.AllSigned
using the Set-ExecutionPolicy
PowerShell command.The Copy-EflowVmFile
command is a function designed to copy files to or from a virtual machine utilizing the Secure Copy Protocol (SCP).
Copy-EflowVmFile:
Copy-EflowVmFile -fromFile "localpathtosource/file.txt" -toFile "remotepathonvm/file.txt" -pushFile
-fromFile
: Defines the local file path from which you want to copy.-toFile
: Defines the remote file path on the virtual machine to which you want to copy the file.-pushFile
: This flag determines the copy direction. If included, it signifies that you are transferring the file to the virtual machine. If omitted, it signifies that you are retrieving the file from the virtual machine.For detailed information about the command, use the Get-Help
command:
Get-Help Copy-EflowVMFile -Full
The Connect-EflowVm command establishes an SSH connection to the virtual machine.
Connect-EflowVm
Ensure that you create the folder in EFlow prior to executing the Copy-EflowVmFile
command.
mkdir Folder