Solaris 11.3

My script needs to recursive delete in a directory.

Other directories work fine.

One directory is plagued by the following:

rm -rf: Unable to remove directory <some/sub/directory>: Device busy

I found a post that said "shared folder" was the issue, but doesn't seem to be the fix.

I have tried:

#share - got nothing    
lsof: command not found

privs seem ok

drwxr-xr-x   4 root     root           4 Jan  3 13:25 dir2/
drwxr-xr-x   5 root     root           9 Jan  8 20:16 bad_dir1/

fuser -cu  /bad_dir1

Rewrote my script to ensure it returns to original calling directory.

Anything else I can look for?

  • Is the directory (or one of its parents) an active mount point? – Hauke Laging Jan 8 '18 at 21:01
  • 1
    lsof: command not found The POSIX standard way to determine if a file/directory is open is fuser. Solaris uses that. – Andrew Henle Jan 8 '18 at 21:01
  • Assuming "/bad_dir1" is the root directory of your "rm -rf" command, what does the command "mount | grep /bad_dir1" give you? – L.Ray Jan 8 '18 at 21:57
  • Under Solaris 11, you can also use netstat -u to get useful information on open files/ports. – sleepyweasel Jan 8 '18 at 22:26
  • @L.Ray mount | grep bad_dir1 /bad_dir1 on bad_dir1 read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=4750007 on Wed Nov 22 14:11:29 2017 /bad_dir1/Sol_Audit on bad_dir1/Sol_Audit read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=4750008 on Wed Nov 22 14:11:29 2017 – Marinaio Jan 9 '18 at 18:11

The output of your 'mount | grep bad_dir1' command looks a little strange to me, but you have a filesystem mounted on bad_dir1/Sol_Audit. You won't be able to remove the directory while it's mounted. Try unmounting it first:

$ sudo umount /bad_dir1/Sol_Audit

and then try running your "rm" command again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.