Visit Our UNIX and Linux User Community


UNIX rm -rf error "rm: cannot remove `filename' : Device or resource busy"


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers UNIX rm -rf error "rm: cannot remove `filename' : Device or resource busy"
# 1  
Old 05-23-2011
UNIX rm -rf error "rm: cannot remove `filename' : Device or resource busy"

Hi Everyone,

I am trying to remove a directory:

Code:
$ rm -rf directory_name/
rm: cannot remove `directory_name/filename': Device or resource busy

What does this mean, and why can't I remove these files? I already tried moving into the directory, and removing the files individually, but I get the same error:

Code:
$ rm -rf filename
rm: cannot remove `filename': Device or resource busy

The file I am trying to remove is only visible via ls -la, and begins with a "."

Thanks,
Anna
# 2  
Old 05-23-2011
Make sure you are not is the directory you are trying to delete
Code:
 pwd

If your file is named so, don't forget the leading dot
Code:
rm -rf .filename

?
# 3  
Old 05-23-2011
Thanks for the quick reply.

I am definitely not in the directory that I am trying to delete.
# 4  
Old 05-23-2011
Post the results of "uname -a" so we know what OS you're using.
# 5  
Old 05-23-2011
Unfortunately my problem is not as easy as a missing "."

when I try to delete the directory:
Code:
[zdepski@overseer 70nt_68kmer]$ rm -rf velvet/
rm: cannot remove `velvet/.nfs0000000106400b63000000c1': Device or resource busy
rm: cannot remove `velvet/.nfs00000001064d051f000000c2': Device or resource busy

when I try to delete the offending files (from within the directory):
Code:
[zdepski@overseer velvet]$ rm -rf .nfs00000001064*
rm: cannot remove `.nfs0000000106400b63000000c1': Device or resource busy
rm: cannot remove `.nfs00000001064d051f000000c2': Device or resource busy

---------- Post updated at 01:16 PM ---------- Previous update was at 01:15 PM ----------

Code:
[zdepski@overseer 70nt_68kmer]$ uname -a
Linux overseer 2.6.31.6-2.caos #1 SMP Tue Nov 17 11:46:26 PST 2009 x86_64 x86_64 x86_64 GNU/Linux

Thanks.
# 6  
Old 05-23-2011
Hi,

NFS cannot remove a file that is used.

Try using lsof to find who use it.

---------- Post updated at 07:25 PM ---------- Previous update was at 07:23 PM ----------

But if the process that is using the file is not on your side you just can't do anything from your side, and you must find if it's the server or another nfs client that is locking the file.
# 7  
Old 05-23-2011
You're in a directory that is NFS mounted to your system. That's different then dealing with a local disk. Some process has that file opened. That process will need to close the file or exit.

on mu linux system..
Code:
$ echo fubar > fubar
$ ls -a
.  ..  fubar  one  two
$ df -k .
Filesystem           1K-blocks      Used Available Use% Mounted on
vamain:/vol/vol1     17408962080 13603234592 3805727488  79% /nas01
$ sleep 1000 < fubar &
[1]     7887
$ ls -a
.  ..  fubar  one  two
$ rm fubar
$ ls -a
.  ..  .nfs00000000010005470000001f  one  two
$
$ cat .nfs00000000010005470000001f
fubar
$ kill %1
[1] + Terminated               sleep 1000 < fubar &
$
$ ls -a
.  ..  one  two
$

See? The file disappeared when the process exited.
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #258
Difficulty: Medium
Iannis Xenakis wrote programs in the FORTRAN language that generated numeric data that he transcribed into scores to be played by traditional musical instruments.
True or False?

10 More Discussions You Might Find Interesting

1. Solaris

How to remove a LUN in "Online Busy" state?

Hi all, I have a LUN that is in "Online Busy" when I issue the dev_gestate subcommand of luxadm: root@es088wb6:~# luxadm -v -e dev_getstate /dev/rdsk/c21t50050763090887FEd4s2 phys path = "/devices/pci@6c0/pci@1/pci@0/pci@4/SUNW,qlc@0/fp@0,0/ssd@w50050763090887fe,4:c,raw" ... (5 Replies)
Discussion started by: ludiegu
5 Replies

2. SCO

NFS umount shows the "Device busy (Error 16)"

Hi there After making a backup copy of it sometimes happens that when I want to unmount an NFS indicates the error:umount: /path_mount busy: Device busy (Error 16) if I run lsoff, I can not find the process that is blocking the application. I'm using OpenServer 5.0.2c as one NFS server ... (14 Replies)
Discussion started by: flako
14 Replies

3. Solaris

"Device busy" When Reopening Serial Port

Any help much appreciated. I am a Java developer, not a Solaris adept. I'm having an issue reopening serial port with the Java app I am developing. I develop in Windows and deploy the app on Solaris 10 (Sunfire X4170 with Xeon.) On the target machine my app uses the two serial ports... (11 Replies)
Discussion started by: Jim Ryan
11 Replies

4. UNIX for Advanced & Expert Users

lvm swapon failed Device or resource busy

Is there a trick to mounting swap in n a lvm? I can't get it to work. # swapon -va swapon on /dev/mapper/VG-lv_swap swapon: /dev/mapper/VG-lv_swap: found swap signature: version 1, page-size 4, same byte order swapon: /dev/mapper/VG-lv_swap: pagesize=4096, swapsize=4294967296,... (1 Reply)
Discussion started by: cokedude
1 Replies

5. UNIX for Dummies Questions & Answers

"tail -n 1 filename" error while "head -n 1 filename" is ok?

Hi all, I was wondering why tail -n 2 filename produce an error when I manage to do similar command on head -n 2 filename SunOS{type8code0}: tail -n 2 filename usage: tail ] tail ] (2 Replies)
Discussion started by: type8code0
2 Replies

6. Hardware

/dev/ttyS0: Device or resource busy

hello to everybody I have Ubuntu Lucid 10.04 installed on my Desktop and I have a PCI serial card in my computer and it has only one serial port. Actually I want to use this serial port for the serial communication and for that I executed this command : $ setserial -g /dev/ttyS and I... (0 Replies)
Discussion started by: piyush011
0 Replies

7. UNIX Desktop Questions & Answers

cygwin error device or resource busy

Hello!!! My problem is: i'm trying to send At commands from Pc to mobile phone using bluetooth and cygwin and i would like to read the device's answers on the shell bash. And so, i open two terminals in this way: xterm & In the first i write: cat /dev/ttyS2 because the device is... (9 Replies)
Discussion started by: blianna
9 Replies

8. UNIX and Linux Applications

/dev/ttyS2 device or resource busy

Ciao a tutti!!! il mio problema questo: sto cercando di inviare dei comandi AT da PC a cellulare utilizzando il bluetooth e cygwin e vorrei visualizzare le risposte nella shell bash. Per farlo apro due terminali utilizzando le seguente istruzioni: xterm & Sul primo scrivo cat /dev/ttyS2 ... (1 Reply)
Discussion started by: blianna
1 Replies

9. UNIX Desktop Questions & Answers

cygwin /dev/ttyS2: Device or resource busy

Ciao a tutti!!! il mio problema questo: sto cercando di inviare dei comandi AT da PC a cellulare utilizzando il bluetooth e cygwin e vorrei visualizzare le risposte nella shell bash. Per farlo apro due terminali utilizzando le seguente istruzioni: xterm & Sul primo scrivo cat /dev/ttyS2 ... (0 Replies)
Discussion started by: blianna
0 Replies

10. UNIX for Dummies Questions & Answers

Device or resource busy??

Hi, I'm trying to do a sharity mount to mount a terastation network drive. I'm getting a Device or resource busy message after my mount command. Please see output below... # /usr/local/sharity3/bin/sharity mount smb://labbackup01/bakup_data /mnt/labbackup01 Device or resource busy.... (2 Replies)
Discussion started by: orahi001
2 Replies

Featured Tech Videos