Personal computing discussed

Moderators: renee, Dposcorp

 
DrCR
Gerbil XP
Topic Author
Posts: 350
Joined: Tue May 10, 2005 7:18 am

Issue deleting a directoryish (Linux)

Wed Nov 04, 2020 6:45 am

After more than a decade of apathy and negligence, I'm finally cleaning up and organizing the data in my life e.g. running fslint on my venerable NAS (Debian with mdm), finishing getting rsnapshot setup, et al.

One step was moving data from an external HDD to my NAS. While cleaning up said data now on my NAS, I encountered a directoryish that I can't delete despite every trick I know. Thoughts on how i can get it deleted? Note at the end where I tried to take the inode route, it said it's both a directory and not a directory in the output. Odd, right? I can cd into it, but ls -lah does not yield . nor ..

# ls
'Fran?ois Couperin'
#ls -lah
ls: 'Fran?ois Couperin': No such file or directory
total 0
drwxr-xr-x+ 3 jdoe jdoe 0 Nov 4 02:11 .
drwxr-xr-x+ 3 jdoe jdoe 0 Nov 3 11:40 ..
drwxr-xr-x 3 jdoe jdoe 0 Aug 15 2014 'Fran?ois Couperin'
# rm F*
rm: cannot remove 'Fran?ois Couperin': Is a directory
# rm -r F*
rm: cannot remove 'Fran?ois Couperin': No such file or directory
# rm -rfi F*
rm: descend into directory 'Fran?ois Couperin'? y
rm: cannot remove 'Fran?ois Couperin': No such file or directory
# find -maxdepth 1 -name F*
./Fran?ois Couperin
# find -maxdepth 1 -name F* -delete
find: cannot delete ‘./Fran?ois Couperin’: No such file or directory
# ls -il
ls: 'Fran?ois Couperin': No such file or directory
total 0
239210 drwxr-xr-x 3 jdoe jdoe 0 Aug 15 2014 'Fran?ois Couperin'
# find . -inum 239210 -exec rm -i {} \;
rm: cannot remove './Fran?ois Couperin': Is a directory
find: ‘./Fran?ois Couperin’: Not a directory
# cd Fran\?ois\ Couperin/
.../Music/Fran?ois Couperin# ls -lah
ls: cannot open directory '.': No such file or directory


Filesystem on the NAS is jfs. Client OS happens to be Ubuntu at the moment.

Origin was a CD rip (François Couperin was a baroque composer), more than likely ripped on a Mac. If it matters, it was originally on a Fat32 partition on the external drive before I brought it over to my jfs NAS yesterday. (I regularly used 4 different OSes any given day at the time, hence the use of Fat32.) My guess is that I ripped it on my MacbookPro with some auto CD/track naming, and when it go ripped to the Fat32 partition, Fat32 didn't like the the special character in François. Sadly I cannot check and see how well I can interact with the original directory on the external HDD's Fat32 partition, as after copying everything over to the NAS, I zeroed it out. Regardless, I've now got this directory on my NAS I seemingly can't get rid of.
 
just brew it!
Administrator
Posts: 54500
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: Issue deleting a directoryish (Linux)

Wed Nov 04, 2020 7:48 am

Ugh, that sucks.

Sadly, I am not very familiar with jfs.

Maybe try coding something up in Python to scan the directory and delete it programmatically?
Nostalgia isn't what it used to be.
 
Wirko
Gerbil Team Leader
Posts: 296
Joined: Fri Jun 15, 2007 4:38 am
Location: Central Europe

Re: Issue deleting a directoryish (Linux)

Wed Nov 04, 2020 9:49 am

Probably just another item to add to your list of unsuccesful attempts: try renaming the directory with both "mv" and "rename" commands. "rename" should accept regular expressions in directory names but has to be installed separately on Debian/Ubuntu.
 
Yan
Gerbil XP
Posts: 349
Joined: Fri Dec 21, 2012 9:37 pm
Location: Ottawa

Re: Issue deleting a directoryish (Linux)

Wed Nov 04, 2020 10:23 am

# find . -inum 239210 -exec rm -i {} \;
rm: cannot remove './Fran?ois Couperin': Is a directory

rm won't remove a directory. Try rm -r.
 
Blahpony
Gerbil XP
Posts: 378
Joined: Mon Oct 14, 2002 11:39 pm

Re: Issue deleting a directoryish (Linux)

Wed Nov 04, 2020 11:26 am

Maybe rm -rf Fran <tab key>. That might let it see it a s a valid name and allow you to delete it.
 
SecretSquirrel
Minister of Gerbil Affairs
Posts: 2726
Joined: Tue Jan 01, 2002 7:00 pm
Location: North DFW suburb...
Contact:

Re: Issue deleting a directoryish (Linux)

Thu Nov 05, 2020 7:54 am

ls -b
will print any special characters as C-style escapes. I expect that '?" isn't actually a question mark, but some "unprintable" character.

--SS
 
zamb
Gerbil
Posts: 15
Joined: Wed Nov 26, 2008 9:38 am

Re: Issue deleting a directoryish (Linux)

Thu Nov 05, 2020 9:55 am

Maybe a corrupt filesystem?

I seldom see this kind of behaviour without there being a corrupt filesystem.

It won’t harm you to run “****” on the volume, if for no other reason than to be at ease of mind.

Sorry if I was a bad news bearer.
Hope that helps.
Ziyad.

EDIT: The forum software censored the name of the utility to run. It should be “j f s _ f s c k” (without spaces, of course).
 
DrCR
Gerbil XP
Topic Author
Posts: 350
Joined: Tue May 10, 2005 7:18 am

Re: Issue deleting a directoryish (Linux)

Fri Nov 06, 2020 10:12 am

Tried mv to no avail. Just gave rename a shot at your suggestion. Output below. (Side note: I think this is also the first time I've seen * not wildcard everything, but give this situation I'm not particularly surprised. Tried n$ as well to no avail.)

ls -b doens't seem to shed any additional light? Tried GUI and mc as well, to no avail. Been using <tab autocomplete> already.

$ ls
'Fran?ois Couperin'
$ ls -b
Fran?ois\ Couperin
$ sudo rename -n 's/F*/test/' *
rename(Fran?ois Couperin, testran?ois Couperin)
$ ls
'Fran?ois Couperin'
$ sudo rename 's/F*/test/' *
Can't rename Fran?ois Couperin testran?ois Couperin: No such file or directory

$ sudo find . -inum 239210 -exec rm -ir {} \;
rm: descend into directory './Fran?ois Couperin'? y
rm: cannot remove './Fran?ois Couperin': No such file or directory
find: ‘./Fran?ois Couperin’: No such file or directory

$ sudo rm -rf Fran\?ois\ Couperin/
$ ls
'Fran?ois Couperin'


Corrupt filesystem? Hum. zamba, you may very well be right, even though I had perhaps unwisely dismissed that possibility earlier this week given the specific nature of the problematic files i.e. OSX generated saved to FAT32.

I just setup rsnapshot to backup the NAS, and in the rsnapshot config's exclude_file, I accidentally didn't include another directory containing such problematic files. (Same origin. Some iTunes podcast and music files e.g. 18 Cantata _Schweigt stille, plaudert nicht_, BWV 211_ Recitative (Schlendrian_Lieschen) _Du b?ses Kind_.mp3 ripped on a MacbookPro, saved to a FAT32 partition, copied to this NAS just the other day before fully decommissioning that previously dusty drive.)

Before making the rsnapshot backup to the external drive (same top quality enclosure as above but different HDD), I did $ sudo badblocks -wsvt random -o badblocks.txt /dev/sdc which yielded 0/0/0 errors upon completion. Afterwards, just to change things up, I went with mkfs.ext4.

Well guess what? In the rsnapshot backup on the external drive, I without fanfare of any kind deleted a problematic file that was inadvertently copied to the external during the rsnapshot backup. So even though earlier this week I had dismissed the thought of some f s c k action being needful on the NAS, I'll go down that path now. Time to do some homework on hardcore but not data losing f s c k ing...
 
DrCR
Gerbil XP
Topic Author
Posts: 350
Joined: Tue May 10, 2005 7:18 am

Re: Issue deleting a directoryish (Linux)

Fri Nov 06, 2020 1:53 pm

Bummer. f s c k was not a solution.

#umount /dev/md0
#f s c k.jfs -nfv /dev/md0
...
File system checked read only.
Errors have been detected. Run f s c k with the -f parameter to repair
Filesystem is dirty.
Filesystem is dirty but is marked clean
...

So I ran the command without the readonly -n option. All clean now. So that -f f s c k was a good thing to do. But the issue persists.

$ sudo rm -r Fran\?ois\ Couperin/
rm: cannot remove 'Fran?ois Couperin/': No such file or directory
 
Waco
Maximum Gerbil
Posts: 4850
Joined: Tue Jan 20, 2009 4:14 pm
Location: Los Alamos, NM

Re: Issue deleting a directoryish (Linux)

Fri Nov 06, 2020 2:15 pm

It might be time to write something to clean it up using low level system calls.
Victory requires no explanation. Defeat allows none.
 
DrCR
Gerbil XP
Topic Author
Posts: 350
Joined: Tue May 10, 2005 7:18 am

Re: Issue deleting a directoryish (Linux)

Fri Nov 06, 2020 2:23 pm

Just had a break through, albeit without understanding. Still have an effectual solution regardless though.

After I did the f s c k on /dev/md0 i.e. the mdadm raid drive on the NAS, since I was connected into the NAS anyway, I tried to delete the now infamous Fran\?ois\ Couperin while logged into the NAS itself -- and it deleted successfully.

I went to the other problematic files (all same origin of MBP iTunes, saved to Fat32, copied to NAS), and successfully deleted those as well while logged into the NAS.

So all set, though I'm completely baffled as to why I could not delete them via my Ubuntu nor Slackware clients. Thanks for all the input.
 
JustAnEngineer
Gerbil God
Posts: 19673
Joined: Sat Jan 26, 2002 7:00 pm
Location: The Heart of Dixie

Re: Issue deleting a directoryish (Linux)

Fri Nov 06, 2020 2:45 pm

You're missing a lower case c with a cedilla accent. Can you not type that using an ASCII or unicode shortcut?
It's Alt+135 or Alt+0231 in Windows.
· R7-5800X, Liquid Freezer II 280, RoG Strix X570-E, 64GiB PC4-28800, Suprim Liquid RTX4090, 2TB SX8200Pro +4TB S860 +NAS, Define 7 Compact, Super Flower SF-1000F14TP, S3220DGF +32UD99, FC900R OE, DeathAdder2
 
DrCR
Gerbil XP
Topic Author
Posts: 350
Joined: Tue May 10, 2005 7:18 am

Re: Issue deleting a directoryish (Linux)

Fri Nov 06, 2020 3:22 pm

Early on, before starting a thread, I confirmed I could touch, nano, and rm a file named ç. What you're seeing in the command lines posted is the result of me simply doing F <tab auto complete>. In looking at my history, I can confirm it autocompleted exactly the same rm -r Fran\?ois\ Couperin/ when I successfully deleted it while logged into the NAS.

Who is online

Users browsing this forum: No registered users and 1 guest
GZIP: On