Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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?
Well, since the only thing you're saying is "failed", don't tell us the version/distro of Linux, file system this drive uses, how it's connected to your system, what "several tricks" you tried in Windows, not really. Without any usable information, we can't guess; you don't tell us if you can delete ANYTHING on that drive, or if it's just this one folder. These things are typically because of a permissions problem, filesystem type, or some junk in the filename that the utilities can't process.
How about what the name of this folder is?? Can you rename it??
Well, since the only thing you're saying is "failed", don't tell us the version/distro of Linux, file system this drive uses, how it's connected to your system, what "several tricks" you tried in Windows, not really. Without any usable information, we can't guess; you don't tell us if you can delete ANYTHING on that drive, or if it's just this one folder. These things are typically because of a permissions problem, filesystem type, or some junk in the filename that the utilities can't process.
How about what the name of this folder is?? Can you rename it??
TB0ne asked most of the important questions, but I have one more.
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.
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
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]
Code:
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?
A filesystem repair is just what it sounds like...it REPAIRS the file system, it doesn't delete/erase it. And fixing NTFS/exFAT is far better done on Windows than Linux, especially if you aren't 100% sure of what you're doing. Smartctl is for drive hardware, not fixing filesystems...read the man page on that command and what it is/does.
A filesystem repair is just what it sounds like...it REPAIRS the file system, it doesn't delete/erase it. And fixing NTFS/exFAT is far better done on Windows than Linux, especially if you aren't 100% sure of what you're doing. Smartctl is for drive hardware, not fixing filesystems...read the man page on that command and what it is/does.
Additionally, if you want to be on the safe side you can make a backup copy of the available data on that disk before trying to repair it. Just in case the disk/data is not recoverable.
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.
Last edited by business_kid; 04-16-2024 at 12:25 PM.
>> 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
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.
Indeed, "Input/output error" generally relates to hardware problems. There should be messages recorded in the system error log indicating what went wrong. I'm not familiar with the "SolydX" distribution and whether you can just look at /var/log/messages or have to use journalctl to see the system messages.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.