Deleting files with zero links
I have a large (hundreds, not thousands) number of files which I cannot delete, for example
49504 -rwxr-xr-x 0 root root 50691712 Sep 26 2009 5 - Arensky: Variations on a theme of Tchaikovsky, Op 35A.flac rm -rf does nothing at all, and gives no error message. I have tried mv to get it somewhere else and this just produces mv: cannot stat `....': No such file or directory Using Nautilus produces similar error messages. My *guess* is that the problem is the 0 links, but I cannot find how to change this. What I've been doing: I have needed to delete about 330GB of flac files to free up space before replacing with a better version. I used rm -r successfully on most directories (most have about 6 levels of sub-dirs) but am stuck with a few dirs containing scattered files like the above. Using debian wheezy. The files are actually mounted from a NAS, so am working as root. If you can confirm/correct my guess and point me to information that would be great. Looking at info chmod and info ls hasn't helped. |
The file shown is owned by root, have you been logged in as root and trying to delete it? How about using:
Code:
sudo rm -f <filename> If you login to your XWindows as a normal user, then you really can't use Nautilus to do this. An alternate way I'd say would be to so something better like this from a top level directory where these files start from: Code:
sudo chown -R <your-user-name> * |
before executing rm you can try lsof and fuser to find out if a process is using that file
|
Yes, I've got that thanks. I am working as root.
I did make slips in mistranscribing the commands. I've tried to delete dirs : <code> ls -lsa 0 drwxr-xr-x 0 root root 0 Jul 9 09:41 ARENSKY root@TQD:/mnt/M-Multimedia# rm -rf ARENSKY/ rm: cannot remove `ARENSKY/ULSTER_O/Variations on a theme of Tchaikovsky, Op.35a': Directory not empty root@TQD:/mnt/M-Multimedia# </code> The only file in this dir (two levels down) is <code> 49504 -rwxr-xr-x 0 root root 50691712 Sep 26 2009 5 - Arensky: Variations on a theme of Tchaikovsky, Op 35A.flac </code> and doing rm -f on this leaves the file intact and issues no error message. Maybe the zero links is not the problem? |
(Reply was to rtmistler)
Will try what pan64 suggests. |
I don't suggest you work as root given that you have some trouble with these types of command.
You really can get yourself into critical system trouble a.k.a. destroy your entire system, if you issue a misplaced rm -rf command. |
I don't know anything about this subject but I just read this thread and it may be relevant to your situation:
https://www.linuxquestions.org/quest...nd-4175547602/ EDIT: LOLOLOL SORRY! Didn't know that was your post as well! |
that "bomb" of a command can be VERY EASILY created from a
NORMAL!! EVERYDAY!!!! TYPO!!!! that we all make EVERY DAY so heed the warning rm and r and f DO NOT MIX WELL on Debian systems "srm" is likley installed or in the repos on RPM systems the debian srm source code builds JUST FINE for normal recursive removal of files a "simple" zero pass is fine and quick also this file name Quote:
|
Quote:
Go to the ARENSKY directory and, using ls -a, check if the dot and dotdot files are there (they are named "." and "..", respectively). If not, something's even more fishy. Can you unmount this filesystem and fsck it? If not, can you boot a live CD and fsck this filesystem? |
Try using midnight commander. mc has been able to delete some otherwise un-deleteable files for me.
Also mc is a bit more fail-safe than the command line when deleting directory trees. |
All times are GMT -5. The time now is 10:38 PM. |