LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 04-14-2024, 03:40 PM   #1
pedpup2
LQ Newbie
 
Registered: May 2017
Location: Fairfield, Iowa, USA
Distribution: SolydX 10 2019-09
Posts: 21

Rep: Reputation: Disabled
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?
 
Old 04-14-2024, 04:37 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,713

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
Is the drive's filesystem NTFS?
How is the drive mounted? read only or r/w?
What are the permissions of the directory?
 
Old 04-14-2024, 06:01 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by pedpup2 View Post
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??
 
Old 04-14-2024, 06:18 PM   #4
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,640

Rep: Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697
Quote:
Originally Posted by TB0ne View Post
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.
 
Old 04-14-2024, 08:23 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,328
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
Also, what is the name of this directory? Does it have spaces or unusual characters in it?
 
Old 04-14-2024, 09:09 PM   #6
pedpup2
LQ Newbie
 
Registered: May 2017
Location: Fairfield, Iowa, USA
Distribution: SolydX 10 2019-09
Posts: 21

Original Poster
Rep: Reputation: Disabled
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
 
Old 04-15-2024, 04:17 AM   #7
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,498

Rep: Reputation: Disabled
Look for dot files (.), ls -a, (or 'unhide' in a file manager).

Possibly need to use sudo or the root account to delete them.
 
Old 04-15-2024, 04:18 AM   #8
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,798

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
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.
 
Old 04-15-2024, 04:42 AM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
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).
 
Old 04-15-2024, 12:19 PM   #10
pedpup2
LQ Newbie
 
Registered: May 2017
Location: Fairfield, Iowa, USA
Distribution: SolydX 10 2019-09
Posts: 21

Original Poster
Rep: Reputation: Disabled
Wink

Thanks to all..

there are no dot files.
and I've tried sudo to delete - no dice.

[MadeInGermany]
df -T resultssdb1 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
 
Old 04-15-2024, 12:44 PM   #11
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by pedpup2 View Post
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.
 
Old 04-16-2024, 12:27 AM   #12
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
Quote:
Originally Posted by TB0ne View Post
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.
 
Old 04-16-2024, 12:20 PM   #13
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,309

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
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.
 
Old 04-16-2024, 11:35 PM   #14
murugesandins
Member
 
Registered: Apr 2024
Location: Bangalore Karnataka India
Distribution: CYGWIN_NT
Posts: 46

Rep: Reputation: 0
>> 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
 
Old 04-17-2024, 09:38 AM   #15
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,780

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by business_kid View Post
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.
 
  


Reply

Tags
bash, folder



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Grub 21 error - Have tried many things already with no success :( killpotts Ubuntu 9 03-01-2009 07:27 PM
A script within a folder to delete the folder, script, and the folder's contents Cyberman Programming 15 10-17-2007 07:32 AM
Out of Range Signal (tried many things) Mannequin_Incised Ubuntu 5 10-09-2006 03:47 PM
Winmodem on Toshiba A15-S157... Tried many things but no luck. Help! Trip in VA Linux - Laptop and Netbook 3 03-18-2004 09:24 PM
java, help me i tried many things no results Laptop2250 Programming 9 10-26-2003 05:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration