rm 没有这样的文件或目录

rm 没有这样的文件或目录

我不明白这里发生了什么:

# ls -la
ls: cannot access '1181781909'$'\016''2844_1.fresh:2,': No such file or directory
total 124
drwx------ 2 s2 s2 122880 Jan 31 20:57  .
drwx------ 3 s2 s2   4096 Jan 31 20:57  ..
-????????? ? ?  ?       ?            ? '1181781909'$'\016''2844_1.fresh:2,'
# rm 1181781909^N2844_1.fresh\:2\, 
rm: cannot remove '1181781909'$'\016''2844_1.fresh:2,': No such file or directory
# 

该文件在那里,但它没有权限,没有大小,并且 rm 无法统计它。是什么导致了这个问题以及如何删除这个文件?

编辑:我尝试卸载文件系统并对其进行 fsck,但结果仍然相同:

# fsck /dev/sdb1 
fsck from util-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
/dev/sdb1: clean, 50903473/61054976 files, 167306276/244190390 blocks
# mount ...
# cd ....
# ls -la
ls: cannot access '1181781909'$'\016''2844_1.fresh:2,': No such file or directory
total 124
drwx------ 2 s2 s2 122880 Jan 31 20:57  .
drwx------ 3 s2 s2   4096 Jan 31 20:57  ..
-????????? ? ?  ?       ?            ? '1181781909'$'\016''2844_1.fresh:2,'
#

编辑2:这是一个USB驱动器,我看不到任何明显的错误dmesg。我尝试umount过,然后拔掉插头,然后重新插入。一切看起来都很好,但文件仍然存在,但我不能rm

[1228890.560683] usb 2-2: new SuperSpeed USB device number 3 using xhci_hcd
[1228890.581493] usb 2-2: New USB device found, idVendor=0480, idProduct=a200
[1228890.581498] usb 2-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[1228890.581502] usb 2-2: Product: External USB 3.0
[1228890.581506] usb 2-2: Manufacturer: TOSHIBA
[1228890.581509] usb 2-2: SerialNumber: 20170219005804F
[1228890.582340] usb-storage 2-2:1.0: USB Mass Storage device detected
[1228890.582679] scsi host6: usb-storage 2-2:1.0
[1228891.602341] scsi 6:0:0:0: Direct-Access     TOSHIBA  External USB 3.0 0    PQ: 0 ANSI: 6
[1228891.603059] sd 6:0:0:0: Attached scsi generic sg1 type 0
[1228894.192062] sd 6:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
[1228894.192283] sd 6:0:0:0: [sdb] Write Protect is off
[1228894.192288] sd 6:0:0:0: [sdb] Mode Sense: 43 00 00 00
[1228894.192501] sd 6:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[1228894.202195]  sdb: sdb1
[1228894.203659] sd 6:0:0:0: [sdb] Attached SCSI disk
[1228895.097777] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)

编辑3:我所做的fsck 错过了标志-ffsck -f解决了问题:

# fsck -f /dev/sdb1
fsck from util-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
Pass 1: Checking inodes, blocks, and sizes
Inode 1594688 extent tree (at level 2) could be narrower.  Fix<y>? yes
Inode 10620301 extent tree (at level 2) could be narrower.  Fix<y>? yes
Inode 37521525 extent tree (at level 2) could be narrower.  Fix<y>? yes
Inode 38541378 extent tree (at level 2) could be narrower.  Fix<y>? yes
Inode 38541380 extent tree (at level 2) could be narrower.  Fix<y>? yes
Inode 53190555 extent tree (at level 2) could be narrower.  Fix<y>? yes
Pass 1E: Optimizing extent trees
Pass 2: Checking directory structure
Problem in HTREE directory inode 43408878: block #10 has bad max hash
Invalid HTREE directory inode 43408878 (x).  Clear HTree index<y>? yes
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/dev/sdb1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdb1: 50903473/61054976 files (0.4% non-contiguous), 167306211/244190390 blocks
#

答案1

它看起来像是一个有错误的文件系统。其原因可能是:

  • RAM 错误(不太可能,如果是 ECC RAM,则极不可能)
  • 未刷新的磁盘缓冲区,例如由于断电或在刷新缓存之前断开 USB 连接(可能)
  • 磁盘错误(很有可能)
  • 文件系统代码中的错误(如果是经过良好测试的文件系统,则不太可能)

您应该检查umount文件系统并运行fsck -f(即使系统看起来干净,也强制执行 fsck)badblocks,, memtest86

相关内容