I have /home/myuser/Desktop/rc/.netrc file that i want hardlink to /root, ie home directory of root user.
When i do:
ln /home/user/Destkop/rc/.netrc /root
it gives the following error:
ln: creating hard link
/root/.netrc' =>
.netrc': Invalid
cross-device link
but it works when i hardlink the file to myuser's home, ie to /home/myuser.
So, what's the problem, why it says invalid cross-devices when there is only one file system here?
PS. I am using RHEL6
Best Answer
it's most likely that your
/home
directory isn't on the same partition as the/root
directory.You can easily check this with
cat /etc/fstab
hardlinks cannot be created between different partitions, only symlinks can.