rm -fr not deleting stuff

Karl Auer kauer at biplane.com.au
Tue Feb 24 13:12:48 UTC 2015


On Tue, 2015-02-24 at 13:07 +0100, iceblink wrote:
> On 2015-02-24 00:17, Karl Auer wrote:
> > 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.
> 
> 
> Synology uses Busybox instead of the rm binary.

Yes.

> Busybox may have some limitations, though I haven't found any in Google.

Me either. Though rm, like many other busybox binaries, is a severely
cut down version. I installed the Optware utilities, which include a
full version of rm. The full version behaved the same way, but of course
it would have been using the same system calls as the busybox version,
so it doesn't mean much.

I've just done a test: I attached the same drive to my main workstation
running proper Ubuntu. Tried deleting one of the old backup directories
with rm -fr - and it worked just fine.

So my current theory is that there is a resource limitation in busybox
that prevents overly-deep recursion. Anyway, that's a good enough theory
for me.

One last test to do - can I delete a directory using the FileStation
(GUI utility) on the NAS?

> Another possible problem is that your NAS probably uses some sort of 
> RAID, and so it may be that the link to the inode is gone on one disk 
> but not yet on another disk, so Linux thinks the hardlink still exists 
> and cannot delete the directory.

Sorry, should have made clearer that the disks concerned are attached
USB drives, not part of any arrays.

> Doesn't sound like a huge problem though?

Makes it hard to automate stuff when you can't rely on rm doing its
job...

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389

GPG fingerprint: 3C41 82BE A9E7 99A1 B931 5AE7 7638 0147 2C3C 2AC4
Old fingerprint: EC67 61E2 C2F6 EB55 884B E129 072B 0AF0 72AA 9882





More information about the ubuntu-users mailing list