I want to replace /home
with a symlink to my nfs-mounted home dirs.
Only root is logged in, /home is not a separate filesystem, lsof shows no locks, selinux is permissive. What am I missing?
I'm logged in directly as root via ssh:
[root@usil01-sql01 /]# uname -a
Linux usil01-sql01 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@usil01-sql01 /]# w
15:30:33 up 1:41, 1 user, load average: 0.00, 0.02, 0.22
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/2 10.50.11.114 15:13 1.00s 0.19s 0.01s w
[root@usil01-sql01 /]# lsof | grep /home
[root@usil01-sql01 /]# lsof +D /home
[root@usil01-sql01 /]# df -h /home
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 63G 4.1G 56G 7% /
[root@usil01-sql01 /]# mount | grep -w /
/dev/sda2 on / type ext4 (rw,relatime,seclabel,data=ordered)
[root@usil01-sql01 /]# ls -lFd /home
drwxr-xr-x. 3 root root 4096 Mar 7 13:36 /home/
[root@usil01-sql01 /]# getenforce
Permissive
[root@usil01-sql01 /]# mv /home /home-old
mv: cannot move "/home" to "/home-old": Device or resource busy
What else can I check?
More system info:
[root@usil01-sql01 /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 836.6G 0 disk
|-sda1 8:1 0 768.6G 0 part /storage
|-sda2 8:2 0 64G 0 part /
`-sda3 8:3 0 4G 0 part [SWAP]
sr0 11:0 1 1024M 0 rom
[root@usil01-sql01 /]# blkid
/dev/sda2: UUID="5ba6a429-4c65-4023-82b4-3673bfcf6a88" TYPE="ext4"
/dev/sda3: UUID="b5eb680f-8789-43b2-9f7e-c52570b0eb73" TYPE="swap"
/dev/sda1: UUID="cb22d57d-4a5b-4963-a990-890abe0c56dc" TYPE="ext4"
Best Answer
The only "use"[*] I can think of, which holds the name of a file from changing, is a mount point.
I am not certain, but perhaps this could happen if the mount still exists in another mount namespace. Because it's not getting unmounts propagated from the root namespace, for some reason? Or looking at the result on my system, maybe systemd services with
ProtectHome
?Note this issue - unable to rename /home despite it not showing as a mount point (in the current namespace) - should be fixed in Linux kernel version 3.18+.
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?h=linux-3.18.y&id=8ed936b5671bfb33d89bc60bdcc7cf0470ba52fe
how to find out namespace of a particular process?
lsns
might be useful if you can install it. More possible commands:List mount namespaces:
Identify root mount namespace:
Find processes with a given mount namespace
Inspect the namespace of a given process:
[*] 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.)