Azure错误:没有这样的文件或目录,stat'C:\ WINDOWS \ system32 \''

问题描述:

我试图上传一个VHD文件到Azure存储(经典)。在CMD,我在执行这个命令:Azure错误:没有这样的文件或目录,stat'C: WINDOWS system32 ''

C:\WINDOWS\system32>azure vm image create boot2dockerhyperv ` --blob-url https://URL.blob.core.windows.net/vhds/boot2dockerhyperv.vhd ` --os Linux "C:\Users\USERNAME\Desktop\boot2dockerhyperv.vhd"` 

而且我发现了以下错误:

info: Executing command vm image create 
error: ENOENT: no such file or directory, stat 'C:\WINDOWS\system32\`' 
error: Error information has been recorded to C:\Users\USERNAME\.azure\azure.err 

这是azure.err

2016-11-17T09:25:34.903Z: 
{ [Error: ENOENT: no such file or directory, stat 'C:\WINDOWS\system32\`'] 
errno: -4058, 
code: 'ENOENT', 
syscall: 'stat', 
path: 'C:\\WINDOWS\\system32\\`' } 
Error: ENOENT: no such file or directory, stat 'C:\WINDOWS\system32\`' 
at Error (native) 
at Object.fs.statSync (fs.js:844:18) 
at uploadPageBlobFromBlobService (C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\lib\commands\asm\iaas\upload\pageBlob.js:278:17) 
at Object.uploadPageBlob (C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\lib\commands\asm\iaas\upload\pageBlob.js:221:3) 
at C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\lib\commands\asm\iaas\upload\uploadVMImage.js:83:16 
at C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\lib\commands\asm\iaas\upload\uploadVMImage.js:65:5 
at callbacks.(anonymous function) (C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\lib\util\callbackAggregator.js:81:30) 
at C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\node_modules\azure-asm-storage\lib\storageManagementClient.js:1419:14 
at C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\lib\util\logging.js:339:7 
at handleRedirect (C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\lib\util\utils.js:564:9) 

的内容时,在PowerShell中执行,我得到不同的错误

info: Executing command vm image create 
info: VHD size : 20 GB 
info: Uploading 59392.5 KB 
error: body.outputStream.on is not a function 
error: Error information has been recorded to C:\Users\USERNAME\.azure\azure.err 

UPDATE:

文件似乎出现在Azure的门户网站即使有错误,但我吓坏了,因为它显示出大小19.53GiB

enter image description here

+0

你是否像D:\ VHDimage之类的普通文件夹试过。也许powershell没有权限到system32文件夹。 – Aravind

+0

@Aravind我把文件移动到了'D:\ boot2dockerhyperv',但是我得到了相同的PowerShell错误。但是,当我查看门户时,我可以看到该文件。但为什么它会出现19.53GB?请参阅更新:) – jmc

+0

如果你遵循正确的步骤,我不确定PowerShell错误。就VHD文件大小而言,它必须与您使用机器的大小(使用sysprep创建的大小)相同。 https://docs.microsoft.com/en-in/azure/virtual-machines/virtual-machines-windows-upload-image?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json – Aravind

error: body.outputStream.on is not a function error: Error information has been recorded to C:\Users\USERNAME.azure\azure.err

根据你的描述,我可以在我身边重现这个错误。我发现了一个相关的问题:https://github.com/Azure/azure-xplat-cli/issues/2230

在本官方document提到:

Azure does not support uploading dynamic VHDs, so you need to convert such disks to static VHDs before uploading. You can use tools such as Azure VHD Utilities for GO to convert dynamic disks during the process of uploading to Azure.

而且,我已经试过我的VHD上传到Blob存储如下:

请尝试按照我提到的文件和c检查了Aravind提供的链接。