cannot delete a folder ..tried many things..
I have a 1TB backup drive. I tried to delete a directory on that drive, but one folder
would not delete. I tried rm -rf - failed I tried to use rsync to delete it by syncing the directory with an empty directory. No luck. I booted up Windows 10 and tried several tricks there. No luck. I cannot rename the directory. Here is a sampling of the 2 main errors I get.. "the system cannot find the file or folder specified" "the filename syntax is incorrect" I checked : ls shows the file/folder. Thunar ( file manager) shows them too. But Thunar reports that the whole directory and all the folders/files under it have size 0 I tried doing this with sudo - failed. I've read many of the forum posts about this issue, and tried their solutions. Any suggestions? |
Is the drive's filesystem NTFS?
How is the drive mounted? read only or r/w? What are the permissions of the directory? |
Quote:
How about what the name of this folder is?? Can you rename it?? |
Quote:
Is it possible that you have a process that accesses this folder and has not released it? That can stop you from deleting a folder. We would have a better idea if you provided more information. |
Also, what is the name of this directory? Does it have spaces or unusual characters in it?
|
Thanks - sorry I am such a newbie - here's the info
Linux Distro is SolydX 2019-09 ( Kind of a spin-off of Linux Mint Debian edition ( the developers of the older version built this)
The 1TB drive is connected to system via USB Yes, I can delete anything else on the disk. It's just this one folder that chokes. Filesystem of the 1TB drive ( from fdisk ) Device Boot Start End Sectors Size Id Type /dev/sdb1 * 2048 1953525166 1953523119 931.5G 7 HPFS/NTFS/exFAT Drive is mounted with r/w permissions for all ( Owner,group and others). I am the owner. The folder concerned has the same permissions. folder name is "1525-01-28-2021". It can be renamed. It can be moved ( I put it in the .Trash-1000 folder ) It contains several other folders and files, and,yes, 2 of the files have weird characters in their names. One has a '\' at the end, the other has a ^M embedded in it. Here is one trick I tried in Windows 10( that failed ) : rd /s /q "\\?\E:\<path to the drive> One suggestion was to view the 8.3 name with dir /x. I did this - there was no 8.3 name I went to a subfolder in this directory, which was "empty", and did ls -l and got this ls: cannot access 'ChrisJones\': Input/output error total 4 d????????? ? ? ? ? ? 'ChrisJones\' drwxrwxrwx 1 phild phild 4096 Apr 13 12:01 Tulsat Did ls -l in another sub-folder with the other screwy filename ls: cannot access 'media[0]'$'\r''otation.dat': Input/output error total 0 -????????? ? ? ? ? ? 'media[0]'$'\r''otation.dat' What I get when I try to delete the directory: [rm -rf 1525-01-28-2021/ ] rm: cannot remove '1525-01-28-2021/Documents/MUM docs/vendors/ChrisJones\': Input/output error rm: cannot remove '1525-01-28-2021/Documents/MUM docs/vendors/Tulsat': Directory not empty rm: cannot remove '1525-01-28-2021/Documents/scripts/bash tutorial/backups': Directory not empty rm: cannot remove '1525-01-28-2021/KHOE/media/media[0]'$'\r''otation.dat': Input/output error File manager shows #2 and 3 are empty. but ls shows they are not. Hope this is enough info.. Thanks for your patience. I've learned a lot in linux, but still a bit green in forum etiquette |
Look for dot files (.), ls -a, (or 'unhide' in a file manager).
Possibly need to use sudo or the root account to delete them. |
fdisk does not report the file system type.
Correct commands are df -T lsblk -fp The Input/Output errors mean the file system is corrupted. You can try to repair it - a NTFS/exFAT on Windows, a ext3 or ext4 or xfs on Linux. If you want to make it completely empty then you better recreate the file system. Before repair or recreation, umount the disk on Linux and make it safe for removal on Windows. |
yes, first those Input/Output errors should be solved. That blocks any other operation. You might want to repair the filesystem as it was already recommended and/or you can use smartctl to check your disk(s).
|
Thanks to all..
there are no dot files. and I've tried sudo to delete - no dice. [MadeInGermany] df -T results:(sdb1 is the drive where the errant folder is located) Filesystem Type /dev/sdb1 fuseblk 976761556 395081460 581680096 41% /media/phild/TERA1 lsblk -fp shows /dev/sdb │ └─/dev/sdb1 ntfs TERA1 2AE8FB4AE8FB1335 554.8G 40% /media/phild/TERA1 "The Input/Output errors mean the file system is corrupted." You can try to repair it - a NTFS/exFAT on Windows, a ext3 or ext4 or xfs on Linux." Since it is NTFS/ExFat, must it be repaired in Windows? Can the filesystem be repaired without deleting all the data on the drive? I'll try smartctl on it. IS there a way to fix I/O errors without major surgery? pp2 |
Quote:
|
Quote:
|
I'm going to disagree with some previous post and say that any I/O or Input/Output errors I have run down have damaged hardware behind them.
In the case of a disk surface, it may be only a few sectors that have failed. To verify my diagnosis, run badblocks with some logging options. It doesn't bode well for the disk's future, though. Older IDE drives (Anyone remember those?) would clunk along happily with the surface gradually collapsing, but with newer drives, the first surface errors are really the last warning to get anything you really want off that disk. |
>> I booted up Windows 10
If I am facing your issue, I used to follow: Install procexp.exe at windows Open procexp.exe Press Ctrl shift f search the directory where you are facing this error Assume that bash.exe is using that directory Open cmd.exe as administrator kill those process which is using this directory using C:\Windows\System32\taskkill.exe /f /im bash.exe After that: CD /D ERROR_DIRECTORY_FULL_PATH_PREVIOUS_DIRECTORY icacls.exe "%CD%" /Setintegritylevel (OI)(CI)Medium After this try removing rm.exe (since I have cygwin at windows) inside bash.exe |
Quote:
|
All times are GMT -5. The time now is 12:58 AM. |