如何拯救 USB 驱动器?

如何拯救 USB 驱动器?

CentOS 7 上的一个dd命令失败,现在/dev/sdf无法写入我的 USB 磁盘 ()。

这些是我得到的输出:

$ lsblk /dev/sdf
lsblk: /dev/sdf: not a block device

$ lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE   MOUNTPOINT
sda             8:0    0 232.9G  0 disk   
├─sda1          8:1    0   200M  0 part   /boot/efi
├─sda2          8:2    0     1G  0 part   /boot
└─sda3          8:3    0 231.7G  0 part   
  ├─rhel-root 253:0    0    50G  0 lvm    /
  ├─rhel-swap 253:1    0  15.7G  0 lvm    [SWAP]
  └─rhel-home 253:2    0   166G  0 lvm    /home
sdb             8:16   0   2.7T  0 disk   
└─sdb1          8:17   0   2.7T  0 part   
  └─md0         9:0    0   5.5T  0 raid10 /local/raid0
sdc             8:32   0   2.7T  0 disk   
└─sdc1          8:33   0   2.7T  0 part   
  └─md0         9:0    0   5.5T  0 raid10 /local/raid0
sdd             8:48   0   2.7T  0 disk   
└─sdd1          8:49   0   2.7T  0 part   
  └─md0         9:0    0   5.5T  0 raid10 /local/raid0
sde             8:64   0   2.7T  0 disk   
└─sde1          8:65   0   2.7T  0 part   
  └─md0         9:0    0   5.5T  0 raid10 /local/raid0
sdf             8:80   1   7.5G  0 disk   
└─sdf1          8:81   1   7.5G  0 part  

$ sudo dd if=/dev/zero  of=/dev/sdf
dd: writing to ‘/dev/sdf’: No space left on device
1+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000159246 s, 0.0 kB/s

$ hdparm -Tt /dev/sdf1

/dev/sdf1:
mlock() failed on timing buf: Cannot allocate memory
 BLKGETSIZE failed: Inappropriate ioctl for device
mlock() failed on timing buf: Cannot allocate memory
BLKFLSBUF failed: Inappropriate ioctl for device
$ hdparm -Tt /dev/sdf

/dev/sdf:
mlock() failed on timing buf: Cannot allocate memory
 BLKGETSIZE failed: Inappropriate ioctl for device
mlock() failed on timing buf: Cannot allocate memory
BLKFLSBUF failed: Inappropriate ioctl for device

$ sudo dd if=/dev/zero of=/dev/sdf bs=512 count=1
dd: error writing ‘/dev/sdf’: No space left on device
1+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000144288 s, 0.0 kB/s

$ sudo fdisk /dev/sdf
fdisk: cannot open /dev/sdf: Inappropriate ioctl for device

$ sudo mount /dev/sdf1 /mnt/usbstick/
mount: /dev/sdf1 is not a block device (maybe try `-o loop'?)
$ sudo mount /dev/sdf /mnt/usbstick/
mount: /dev/sdf is not a block device (maybe try `-o loop'?)

有什么方法可以恢复 USB 记忆棒吗(我有几个相同状态的 USB 记忆棒)。

答案1

事实证明,在某个时候,常规文件(不是特殊的块设备)是为创建的/dev/sdf
一旦 USB 盘被弹出,并且常规文件被删除,插入 USB 盘后,一切正常。

相关内容