13

I was attempting to move files from one directory to another and was displayed the following message although the files were moved. Why does display the "error" and what does it mean? When does it occur? The directories are on the same device and partition. The device runs off Ubuntu 12.04 LTS

Error

*mv: cannot move `.' to `../new_media/press/.': Device or resource busy*

3 Answers3

11

From the rename(2) man page:

   EBUSY  The  rename fails because oldpath or newpath is a directory that
          is in use by some process (perhaps as current working directory,
          or  as root directory, or because it was open for reading) or is
          in use by the system (for example as  mount  point),  while  the
          system considers this an error.  (Note that there is no require‐
          ment to return EBUSY in such cases — there is nothing wrong with
          doing  the  rename anyway — but it is allowed to return EBUSY if
          the system cannot otherwise handle such situations.)
6

Some process is using the file/s. You can find what files are open by what processes using the command 'lsof' (list open files). This will return a lot of open files. Once you've found the process, you could try killing it.

Or restarting the computer may be easier if that is an option.

askvictor
  • 1,708
0

I have this problem when trying to mv a regular file to a bind mounted one in Docker. It can be overcomed by cat src > dest ; rm src because dest are busy.

In your case you are trying to mv the current directory . to another location, it's the current directory that is busy. You need to cd to another directory to perform this operation.

charles
  • 107