I try to remove a directory (rm -rf) and I get:
rm: cannot remove 'EMBA': Directory not empty
moreover when I try to list the directory I get:
ls: reading directory 'EMBA': Input/output error
the directory EMBA has 777 as permission and no program is using it.
The operating system is Ubuntu 20.04 and the file system is NTFS.
UPDATE
Following the roaima answer I try to:
1 - Check the recent output from dmesg or journalctl -k to look for messages corresponding to disk I/O errors
I can't find any error messages
2 - Check the SMART attributes to see if the disk is dying, or whether it's just the filesystem (smartctl -x)
I think there is notting relevant
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000f 080 064 006 Pre-fail Always - 108362796
3 Spin_Up_Time 0x0003 097 096 000 Pre-fail Always - 0
4 Start_Stop_Count 0x0032 100 100 020 Old_age Always - 39
5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail Always - 0
7 Seek_Error_Rate 0x000f 076 060 045 Pre-fail Always - 37146160
9 Power_On_Hours 0x0032 097 097 000 Old_age Always - 3456 (84 124 0)
10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 100 020 Old_age Always - 38
183 Runtime_Bad_Block 0x0032 100 100 000 Old_age Always - 0
184 End-to-End_Error 0x0032 100 100 099 Old_age Always - 0
187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0
188 Command_Timeout 0x0032 100 100 000 Old_age Always - 0 0 0
189 High_Fly_Writes 0x003a 100 100 000 Old_age Always - 0
190 Airflow_Temperature_Cel 0x0022 070 061 040 Old_age Always - 30 (Min/Max 24/34)
191 G-Sense_Error_Rate 0x0032 100 100 000 Old_age Always - 0
192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 15
193 Load_Cycle_Count 0x0032 100 100 000 Old_age Always - 643
194 Temperature_Celsius 0x0022 030 040 000 Old_age Always - 30 (0 19 0 0 0)
195 Hardware_ECC_Recovered 0x001a 080 064 000 Old_age Always - 108362796
197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0
240 Head_Flying_Hours 0x0000 100 253 000 Old_age Offline - 667h+38m+56.521s
241 Total_LBAs_Written 0x0000 100 253 000 Old_age Offline - 6276317084
242 Total_LBAs_Read 0x0000 100 253 000 Old_age Offline - 8419504151
3 - Check the filesystem with ntfsfix. I get:
Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/sdb2 was processed successfully.
4 - Check the filesystem using a Windows OS
Windows has encountered errors on the volume
After fix the error and reboot the system the error in removing the directory was solved
ls
to list the contents, or are you usingls -al
? Also, check this out unix.stackexchange.com/questions/39905/…