Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a collection of folders on one file system which have been hard linked together (the contents are identical).

What happens when I move one of the folders to another filesystem on another disk?

I'm on Mac OSX snow leopard and I'm using the command line mv command.

share|improve this question

migrated from stackoverflow.com Sep 6 '12 at 21:03

This question came from our site for professional and enthusiast programmers.

    
specifically, I am trying to understand if the mv command would copy the data to the new filesystem and if it would then delete one collection of hard links from the original filesystem, etc. –  b20000 Sep 6 '12 at 11:28
1  
When crossing file systems, mv can only do a copy then delete process. I don't know the MacOS, but do a man ls and see what parameters you need to view inodes. As far as *nix system is concerned, inodes are the file, and names are just pointers to it. That is what makes hard-linking possible. –  Jeremy J Starcher Sep 6 '12 at 17:58

1 Answer 1

Nope, the default mv does not preserve hardlinks:

~$ which mv
/bin/mv
~$ uname -a
Darwin mini.local 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64

~$ cd /Volumes/Backup\ primary/
Backup primary$ mkdir test
Backup primary$ cd test/
test$ echo foo > a
test$ ln a b
test$ ls -li a b
14271856 -rw-r--r--  2 user     staff  4 Oct 15 19:23 a
14271856 -rw-r--r--  2 user     staff  4 Oct 15 19:23 b
test$ cd ..
Backup primary$ mv test ../Backup\ secondary/
Backup primary$ ls -li ../Backup\ secondary/test/
total 32
11040478 -rw-r--r--  1 user     staff  4 Oct 15 19:23 a
11040479 -rw-r--r--  1 user     staff  4 Oct 15 19:23 b
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.