[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cannot rename with mv



	Hi.

On Mon, 16 Jan 2017 22:17:24 -0600
rlharris@oplink.net wrote:

> I wish to rename the directory "/backup" to "/backup.new".
> 
> / is on a 452G partition with 54% in use.
> / is owned by root.
> /backup is owned by normal user "rh".
> 
> The command "$ mv /backup/ /newbackup/" fails with " cannot move ...
> Permission denied".
> 
> The command "# mv /backup/ /newbackup/" fails with "cannot move ... Device
> or resource busy".
> 
> No application and no terminal window is looking at / or at /backup .
> 
> What am I overlooking?

First case ('rh' user) is a canonical lack of filesystem permissions.
To rename a directory a user should be able to write into parent one
("/" in your case).

Second case ('root' user) is somewhat more interesting. 'mv' invokes
'rename' system call, and rename(2) has this pearl of wisdom to share:

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.

So, since nothing is using the directory in your case, this means
either that /backup is a mounted filesystem, or your root filesystem
suffers severe damage.

Reco


Reply to: