Hard link (invalid Peripheral cross link)

tuton Posted messages 94 Status Member -  
 kmf -
Hello, I would like to create a hard link from one folder...
I read on Google that the command "cp -l" or "ln -d" could work but I ended up with an error:
"ln: creating hard link 'rep2' to 'rep1' not possible: invalid cross-device link" ...
I can't find anything about this on the internet, if someone has an idea it would be very kind...
thank you

3 answers

  1. kmf
     
    Probably you want to create a link on one partition (for example "/") with the original file on another partition (for example "/home") and that, does not work. It is simply impossible by the nature of a hard link (please don’t ask me to explain why, for that you need to learn how ext2/3 and hard links work in detail). The link and the original file must be on the same partition for a hard link. If it’s on different partitions, you need to create a symbolic link (to be created with: "ln -s ...." or "cp -s ...").

    In general, a symbolic link always seems preferable to a hard link, especially if you are a beginner. It allows you to do the same things and it is also more easily visible later with "ls -l".
    6
  2. tuton Posted messages 94 Status Member 5
     
    Thank you, I'll take a look at that.
    0