Bry*_*and 7 powershell dd windows-subsystem-for-linux wsl-2
我是一名狂热的 Linux 用户,但在工作中被迫使用 Windows。我被允许在工作计算机上安装 WSL2 和 Ubuntu。我想在 WSL2 中使用 dd 刻录可启动 USB,但无法弄清楚如何获取该设备,因为 lsblk 不提供连接到计算机的外部块设备。我知道我可以在 Rufus 之类的东西上做到这一点,但由于它是一台工作计算机,所以我不允许在计算机上获取类似的东西。
StackOverflow上只有一个这样的问题,但它已关闭并且没有给出答案。然而,它确实为我开始寻找物理设备名称提供了线索。利用这条线索,我找到了这个问题的答案,并想分享它,因为我不仅在 StackOverflow 上找不到答案,而且在互联网上的其他任何地方都找不到答案。
电源外壳:
# I ran this command to get the DeviceID of my USB Thumbdrive (Mine came out to be
# \.\\PHYSICALDRIVE 5, but yours may vary)
Get-WmiObject Win32_diskdrive | Select Caption,DeviceID,InterfaceType,Size | Where-Object {$_.InterfaceType -eq "USB"}
Run Code Online (Sandbox Code Playgroud)
Ubuntu 20.04 终端:
# After I got the physical drive number from powershell (as I would do using lsblk in Linux) I
# formatted the drive using mkfs to ensure it would work before trying to use dd.
sudo mkfs.vfat -I \\.\PHYSICALDRIVE5
# After a successful format, I was able to run dd as normal
sudo dd if=path/to/my/file.iso of=\\.\PHYSICALDRIVE5 status=progress
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8828 次 |
| 最近记录: |