rm -fr not deleting stuff

Colin Law clanlaw at gmail.com
Tue Feb 24 09:01:01 UTC 2015


On 23 February 2015 at 23:17, Karl Auer <kauer at biplane.com.au> wrote:
> Got a weird one here.
>
> Not entirely an Ubuntu question, but it is Linux. I have a Synology NAS,
> and I wanted to delete some old backup directories off it. I create
> backup directories using rsync, hard-linking to unchanged files in
> previous backups. This reduces the size of each backup by re-using an
> existing copy if a file hasn't changed. Read the man page for rsync and
> look at the --link-dest option.
>
> Anyway, when I tried removing a backup using rm -fr dirname it deleted
> heaps of files out of the directory and its many subdirectories, but
> also issued lots of messages about being unable to delete directories
> because they were not empty.

Did you look at one of those directories to see if there is anything
special about that directory and what it had left behind?  That may
well give you a clue.

Is it possible files in the directories are in use when you are trying
to delete them?  In that case I think they will not disappear until
they are freed.  You could try a re-boot to see if they then
disappear.  Not sure about this though.

I would however point out that I think that to use rm -rf on anything
in any way related to backups sounds like a very bad idea.  It is much
too easy to make a mistake.

Colin




More information about the ubuntu-users mailing list