22
votes
5answers
2k views

How to tell which file is original if hard link is created

For example, I have a file myold_file. Then I use ln to create a hard link as mylink: ln myold_file mylink Then, even by using ls -a, I cannot tell which is the old one. Is there anyway to tell?
4
votes
1answer
82 views

“hard-linking” parts of a big file in which only a small part has changed

I use rsync to make backups: rsync -a --link-dest=PATHTO/$PREVIOUSBACKUP $SOURCE $CURRENTBACKUP This way I save space due to using hard links. The problem appears when I need to backup a huge file ...
3
votes
1answer
57 views

Where are information stored information about hard/soft links

Where does the *nix system store information about number of hard links to a specific inode? I can't find any information about that. Everywhere what a hard link is but rarely a bit more advanced ...
0
votes
2answers
226 views

Hard links versus symbolic links: which one is faster / smaller? [duplicate]

Hard links Given a file original.txt, a hard link hardlink.txt will point to the same inode and continue to exist even when original.txt is deleted. Symbolic links Given a file original.txt, a ...
1
vote
1answer
90 views

If I hardlink to a directory, will the contents be “preserved” as if I hard-linked to every file?

I've seen people on the internet talk about using hardlinks to force files to stay on disk as a backup, even if they're deleted in their original location. Would this work for a directory too? Why or ...
0
votes
1answer
78 views

How to increase the link count for a directory, link count went to 0?

I have made myself land in this situation, it is a chrooted workspace on my system where I virtualize the entire file system ( so its not actual /var/log ) Is there a way that I can either delete this ...
1
vote
2answers
101 views

FS permission scenario

How can I achieve this files & folders permissions scenario: Consider these folder: Folder A: 640 root apache /var/www/A/ Folder www: 640 root apache /var/www/ and this linux user: id user1: ...
4
votes
3answers
277 views

Why does mcedit recommend removing hardlinks when saving a file?

Whenever I use mcedit to edit a file that is hard linked somewhere and I want to save the file, the editor asks me if I want to remove the hard links. Is that common behavior on Linux or is mcedit ...
5
votes
1answer
326 views

Finding all the hard-links of a file without traversing the file system

I have seen in this page that inodes have a link counter to know how many files (read: "directory entry") point to this inode. Is there a way to know which directories contain such entries without ...
18
votes
2answers
7k views

What happens when you delete a hard link?

If you do rm myFile where myFile is a hard link, what happens?
3
votes
4answers
549 views

What are inodes good for?

I wonder if storing the information about files in inodes instead of directly in the directory is worth the additional overhead. It may be well that I'm overestimating the overhead or overlooking some ...
33
votes
2answers
1k views

Why is '.' a hard link in Unix?

I've seen many explanations for why the link count for an empty directory in Unix based OSes is 2 instead of 1. They all say that it's because of the '.' directory, which every directory has pointing ...
62
votes
5answers
16k views

Why hard links not allowed to directories in UNIX/Linux

I read in text books that UNIX/Linux doesn't allows hard links to directories but soft links do. Is it because, when we have cycles and if we create hardlinks, and after some time we delete the ...
27
votes
5answers
4k views

Why do hard links exist?

I know what hard links are, but why would I use them? What is the utility of a hard link?
14
votes
3answers
2k views

Is there a limit of hardlinks for one file?

Is there a limit of number of hardlinks for one file? Is it specified anywhere? What are safe limits for Linux? And what for other POSIX systems?
8
votes
5answers
4k views

Can I determine the number of sub-directories in a directory using `ls -l`?

When displaying directories using ls -l, their number of links (the second field in the output) is at least two: one for the dir name and one for . $ mkdir foo $ ls -l total 2 drwxr-xr-x 2 user ...
9
votes
4answers
569 views

filesystem for archiving

I have some complex read-only data in my file system. It contains thousands of snapshots of certain revisions of a svn repository, and the output of regression tests. Identical files between snapshots ...