我是一个狂热的 Linux 用户,他被要求使用 Windows 工作。我被允许在工作计算机上安装 WSL2 和 Ubuntu。我想在 WSL2 中使用 dd 刻录可启动 USB,但一直无法弄清楚如何获取设备,因为 lsblk 不提供连接到计算机的外部块设备。我知道我可以在 Rufus 之类的东西中做到这一点,但由于它是一台工作计算机,我不允许在计算机上获得类似的东西。
StackOverflow上只有一个这样的问题,但它已关闭并且没有给出答案。但是,它确实为我提供了开始寻找物理设备名称的线索。使用这条线索,我找到了这个问题的答案并想分享它,因为我不仅在 StackOverflow 上找不到答案,而且在互联网上的任何其他地方都找不到答案。
最佳答案
电源 shell :
# 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"}
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
关于powershell - 如何在 wsl2 上使用 linux dd 命令来刻录可启动的 USB?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64683871/