当我使用 dd 命令时,它不会将数据写入 USB 驱动器

当我使用 dd 命令时,它不会将数据写入 USB 驱动器

谁能帮我解决这个问题?

有时当我dd向 USB 棒执行命令时,它很快就完成了,而实际上并没有将数据写入 USB。我发现/dev/sdb在这种情况下,它实际上是在写入文件而不是设备,而fdisk输出仅指向/dev/sdb

root@localhost:/sys/bus/pci/drivers/xhci_hcd# lsblk
NAME                              MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                                 8:0    0 119.2G  0 disk
|-sda1                              8:1    0 189.8M  0 part /boot/efi
|-sda2                              8:2    0 976.6M  0 part /boot
|-sda3                              8:3    0   1.9M  0 part /app_disk
|-sda4                              8:4    0   1.4G  0 part /
|-sda5                              8:5    0   5.7G  0 part /var
|-sda6                              8:6    0 104.2G  0 part
| |-vg0_vjunos-lv_junos           252:0    0    10G  0 lvm  /junos
| `-vg0_vjunos-lv_var_third_party 252:1    0  94.2G  0 lvm  /third-party
`-sda7                              8:7    0   1.2G  0 part [SWAP]
sdb                                 8:16   1   7.2G  0 disk
`-sdb1                              8:17   1   1.8G  0 part
root@localhost:/sys/bus/pci/drivers/xhci_hcd# sudo dd if=/var/third-party/install-media-host-usb-nfx-3-20170106_0834_sushilkd.img of=/dev/sdb bs=1M
1799+0 records in
1799+0 records out
1886388224 bytes (1.9 GB) copied, 1.04298 s, 1.8 GB/s
root@localhost:/sys/bus/pci/drivers/xhci_hcd# sudo dd if=/var/third-party/install-media-host-usb-nfx-3-20170106_0834_sushilkd.img of=/dev/sdb bs=1M ^C
root@localhost:/sys/bus/pci/drivers/xhci_hcd# sudo dd if=/var/third-party/install-media-host-usb-nfx-3-20170106_0834_sushilkd.img of=/dev/sdb conv=fsync
3684352+0 records in
3684352+0 records out
1886388224 bytes (1.9 GB) copied, 4.25185 s, 444 MB/s

root@localhost:/sys/bus/pci/drivers/xhci_hcd# fdisk -l

Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: E38875B6-7CE2-4115-A28B-87BE8974DDF2

Device           Start          End   Size Type
/dev/sda1         1953       390625 189.8M EFI System
/dev/sda2       390626      2390625 976.6M Microsoft basic data
/dev/sda3      2390626      2394531   1.9M Microsoft basic data
/dev/sda4      2394532      5394531   1.4G Microsoft basic data
/dev/sda5      5394532     17394531   5.7G Microsoft basic data
/dev/sda6     17394532    235984375 104.2G Microsoft basic data
/dev/sda7    235984376    238484375   1.2G Microsoft basic data


Disk /dev/mapper/<XXXX>: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/<XXXX>: 94.2 GiB, 101179195392 bytes, 197615616 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdb: 1.8 GiB, 1886388224 bytes, 3684352 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd87c498e

Device    Boot Start       End  Blocks  Id System
/dev/sdb1 *     2048   3684351 1841152   e W95 FAT16 (LBA)

答案1

我已经遇到了这个问题,我这样做了(无需重启):在同步命令之后,移除你的 USB 记忆棒,删除设备文件,在本例中为 sudo rm /dev/sdb 。重新插入你的 USB 记忆棒后,你就可以再次写入了。

相关内容