每次我将东西复制到 U 盘时,写入的数据都是 0 字节。
步骤如下:
$ dmesg | tail
... as sdb1 ...
$ mount /dev/sdb1 /mnt
$ mount | grep /dev/sdb1
/dev/sdb1 on /mnt type vfat rw,relatime,fmask=0022,dmask=0022,codepage=437, iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
$ cp /path/to/file /mnt
(1-2 seconds pause)
此后,提示符再次出现,表明命令已完成。
但:
$ df -h
(All my mounts EXCEPT /dev/sdb1)
$ umount /dev/sdb1
Special device /dev/sdb1 not found
(Unplugging the drive and reconnecting it)
$ dmesg | tail
... as sdc1 ...
$ mount /dev/sdc1 /mnt
$ ls -al /mnt/file
rwxrwxrwx user group 0 file
为什么它只复制索引,而不复制文件?30 分钟后也没有任何变化。
顺便提一下,每个非 root 用户在尝试写入任何内容时都会收到“权限被拒绝”的提示。可能相关。
添加1:
[ 3505.951652] FAT-fs (sdb1): Directory bread(block 7488) failed
[ 3505.951658] FAT-fs (sdb1): Directory bread(block 7489) failed
[ 3505.951662] FAT-fs (sdb1): Directory bread(block 7490) failed
[ 3505.951666] FAT-fs (sdb1): Directory bread(block 7491) failed
[ 3505.951671] FAT-fs (sdb1): Directory bread(block 7492) failed
[ 3505.951675] FAT-fs (sdb1): Directory bread(block 7493) failed
[ 3505.951679] FAT-fs (sdb1): Directory bread(block 7494) failed
[ 3505.951683] FAT-fs (sdb1): Directory bread(block 7495) failed
[ 3505.951687] FAT-fs (sdb1): Directory bread(block 7496) failed
[ 3505.951691] FAT-fs (sdb1): Directory bread(block 7497) failed
[ 3505.952401] FAT-fs (sdb1): FAT read failed (blocknr 203)
[ 3536.704292] fat__get_entry: 246 callbacks suppressed
将文件复制到设备后发生这种情况。我试过几个 U 盘。
添加 2:以用户身份执行 rsync -av 日志
sending incremental file list
file
rsync: mkstemp "/mnt/.file.09oDMm" failed: Permission denied (13)
sent 303,348,282 bytes received 119 bytes 86,670,971.71 bytes/sec
total size is 303,274,124 speedup is 1.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1189) [sender=3.1.3]
与root操作相同:
sending incremental file list
file
rsync: mkstemp "/mnt/.file.tVJ2Th" failed: Input/output error (5)
sent 303,348,282 bytes received 119 bytes 202,232,267.33 bytes/sec
total size is 303,274,124 speedup is 1.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1189) [sender=3.1.3]
添加 3:在驱动器处于清洁状态后对其进行 rsync 操作,然后对其进行 fsck
$ fsck /dev/sdb1
fsck from util-linux 2.33
fsck.fat 4.1 (2017-01-24)
/file
Contains a free cluster (6032). Assuming EOF.
/file
File size is 303274124 bytes, cluster chain length is 0 bytes.
Truncating file to 0 bytes.
Reclaimed 9256 unused clusters (303300608 bytes).
Free cluster summary wrong (457661 vs. really 466917)
1) Correct
2) Don't correct
? 1
Perform changes ? (y/n) y
/dev/sdb1: 2066 files, 6534/473451 clusters
这肯定是我的 pendrive 出了问题,因为另一个 pendrive(NTFS)工作正常……
答案1
最后再来结束这个问题:我的 USB 驱动器确实坏了。两次。再也不会购买 SiliconMotion 控制器了。