A hard link is file system entry that associates a name with another file on a file system.

learn more… | top users | synonyms (1)

0
votes
1answer
36 views

“Links” to dirs that have features of both hard and soft links?

It is not allowed to create a hard link for a dir. But the soft like will not work, if I later change the name of the dir. How would you solve the dilemma? Are there applications which can ...
4
votes
3answers
245 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 ...
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?
1
vote
3answers
36 views

Sharing a project tree between environments

To save space and time I copied a large project tree on a network drive as hard links, i.e. cp -a -r --link proj proj_B (background: it's huge, needs to be rebuilt from two incompatible ...
7
votes
5answers
5k views

How to copy directories with preserving hardlinks?

How to move directories that have files in common from one to another partition ? Let's assume we have partition mounted on /mnt/X with directories sharing files with hardlinks. How to move such ...
2
votes
2answers
34 views

How to create file links on a vfat filesystem of a mounted disk under Linux?

I have an external drive containing different pieces of music. The drive is a vfat formatted drive to be able to work with arbitrary devices. On the device I have music stored from different artists ...
3
votes
4answers
585 views

Breaking a hard-link in-place?

I am keeping my dotfiles under version control and the script deploying them creates hard links. I also use etckeeper to put my /etc under version control. Recently I have gotten warnings like this: ...
3
votes
4answers
155 views

How to get folder size ignoring hard links?

I use rsnapshot for backups, which generates a series of folders containing files of the same name. Some of the files are hard linked, while others are separate. For instance, hourly.1/file1 and ...
1
vote
3answers
102 views

Seemingly Inconsistent Behavior for “ln” & “ln -s”

As we all know, the ln command creates a link, with the default being a hard link and the -s option creating a symlink. The general syntax is ln [-s] OLD NEW, where OLD is the file you are linking to ...
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
70 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
55 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 ...
58
votes
3answers
15k 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 ...
4
votes
2answers
157 views

Linux: How does hard-linking to a directory work?

I'm aware that Linux does not allow hard-linking to a directory. I read somewhere, that this is to prevent unintentional loops (or graphs, instead of the more desirable tree structure) in the ...
-2
votes
2answers
3k views

Invalid cross-device link while Hardlinking in the same file system

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: ...
2
votes
2answers
300 views

Is a -rw-rw-rw- file really inaccessible inside a drwxrwx— directory?

Say I have a directory with these permissions: drwxrwx--- Inside this directory, a file with these permissions: -rw-rw-rw- Is the file readable/writable by everyone or not ? If not, how secure ...
0
votes
2answers
175 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 ...
0
votes
3answers
154 views

thoroughly find all links (hard and symlinks, and any combination thereof) leading to a file/dir

I read "most" of the proposed questions, but I believe they all miss the complexity of the right answer. I want, only using "basic" commands (for maximum portability) (i.e., something that would work ...
3
votes
1answer
112 views

setgid binary doesn't have permission, mount's right, I'm missing something, but what, please?

I'm sorry, I know this has to be something simple but I've checked the manpages, the mount, the permissions ... (edit: combined history into one sequence as requested. Starting to seem a not-simple ...
0
votes
0answers
24 views

Hard link for directories [duplicate]

I have a simple question about the difference between hard links and soft links. Why is it not possible to create hard links for directories in Linux?
0
votes
1answer
342 views

How to safely remove hard-link to home folder?

In a folder owned by my user /sites/Website there is a dir named ~. When I cd to this directory, I am redirected to ~/, my home folder. At first I thought this was a symbolic link, but doing ls ...
5
votes
2answers
471 views

Can a file be retrieved by its inode?

Run command like the following: $ln a b $ls -i a b 523669 a 523669 b $rm -f a $ls -i b 523669 b I concluded from this test that command rm actually removes the filename (a in this test) only ...
7
votes
2answers
115 views

Why is there a mix of symlinks and hardlinks in /bin?

I understand the technical difference between symlinks and hardlinks, this is a question about their use in practice, particularly I'm curious to know why both are used in seemingly similar ...
2
votes
3answers
292 views

Forcibly create directory hard link(s)?

I understand the reasoning why nearly every unix version doesn't allow hard-linking of directories (in fact HFS+ on OS X is the only one I know, but even that isn't made easy to do yourself). However, ...
0
votes
0answers
31 views

Howto get the “relative size” of two directories [duplicate]

Consider two directories dirA and dirB. Suppose dirB consists to a part (P1) of hardlinks which points to files in dirA and to a part (P2) of files which are not hardlinked to files in A. Is there a ...
1
vote
1answer
85 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 ...
5
votes
2answers
426 views

Why do hard links seem to take the same space as the originals?

Thanks to some good Q&A around here and this page, I now understand links. I see hard links refer the same inode by a different name, and copies are different "nodes, with different names. Plus ...
2
votes
3answers
2k views

`cp -al` snapshot whose hard links get directed to a new file when edited

I am trying to take snapshots of a massive folder regularly. I have read here: http://www.mikerubel.org/computers/rsync_snapshots/#Incremental that cp -al takes a snapshot of a folder by simply ...
3
votes
1answer
87 views

Files have the same inode but they don't link to each other

I have a bash script in two places and I can't remember how I created them. they have the same inode but none of them seem to link to another. is there a hard link but should not Links count for that ...
0
votes
1answer
73 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
96 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: ...
2
votes
3answers
331 views

hardlink/softlink multiple file to one file

I have many files in a folder. I want to concatenate all these files to a single file. For example cat * > final_file; But this will increase disk space and also will consume time. Is there is a way ...
1
vote
2answers
126 views

mlbackup / rsync / hard links data size

I am new to mlbackup/rsync and the concept of hard links, so I am a little confused after creating a backup data set via mlbackup. So here's the scenario: I am backing up "folder A" to "folder B". ...
4
votes
2answers
385 views

Can we use symbolic link and hard link for directories?

I know we can do that for files. What about directories? It seems that cpanel uses that a lot.
1
vote
1answer
52 views

is there some kind of symbolic links that support moving or renaming the target file?

I liked this explanation of hard and soft/symbolic links: http://unix.stackexchange.com/a/22406/42226 Now the reason why I googled about soft and hard links is simply because I was organizing my ...
1
vote
1answer
950 views

Backing up hard links (rsync)?

My question begins with: Do I actually have hard links on my disk at all (except for "." and ".." of course)? I'm not sure how I would find that out? If no, the question is already answered. If yes, ...
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 ...
1
vote
2answers
124 views

Incremental backup with hard links for multiple folders

Can anyone refer me to a simple backup script or program, that will backup in the following way: Incremental Rotation of X backups Backup to a mounted drive (no need for remote connections) Multiple ...
3
votes
1answer
100 views

How can I delete a hardlink to a directory?

Before I get 100s of answers that tell me it is impossible to hardlink directories in linux: yes, I know that. The file in question appeared in lost+fount after I checked the filesystem with e2fsck ...
5
votes
1answer
249 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 ...
9
votes
4answers
562 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 ...
1
vote
1answer
406 views

How do I manually modify an inode?

I am using Ubuntu Linux and, just for fun, I want to create a hardlink to a directory (as seen here). Because I'm just doing this for fun, I'm not looking for any sort of pre-developed ...
0
votes
1answer
149 views

How hardlink and softlink works in background?

I am looking for an explanation of the following: what happens in Linux when we create soft link and hardlink how are they accessible why do symlinks always display 777 permissions
2
votes
0answers
321 views

Multiple Linux or Unix Distributions, Same Home Partition or Data?

To avoid conflicts I have always installed multiple Linux and Unix distributions each with it's own home partion or directory, and in the era of 3TB hard drives this is often very practical; I also do ...
6
votes
4answers
1k views

What's the difference between a hard links and copied files?

RHEL 6 My understanding is that hard links include a copy of the original file and that I could delete a hard-linked file in one directory, and it would still exist in the other directory. If ...
2
votes
1answer
646 views

Hardlinks in Dropbox not updated

I want to create a backup of a single .tex file. I created the hard link to the file (which is not in Dropbox directory, lets say it is A) inside Dropbox directory. I did this so because I do not want ...
7
votes
1answer
89 views

Is there a way to express: `--link` or fall back to ordinary copy in cp (from GNU coreutils)?

Is there a way to tell cp to --link (i.e. create hard links), but fall back in the case where I am attempting inter-device hardlinks? Inter-device links aren't possible and would cause cp to fail. ...
3
votes
3answers
312 views

How to diff two folders by inodes

I'm currently using a script to backup files on my computer. In a nutshell, it works like this: rsync --link-dest=$FOLDER/current $SOURCE $DESTINATION However, I think that my script may be ...
6
votes
2answers
2k views

How to `du` only the space used up by files that are not hardlinked elsewhere?

Using rsync --link-dest for space-saving snapshots, how can I figure out how much space I actually saved? Or more general: How to figure out how much space a directory uses considering only files ...
17
votes
2answers
6k views

What happens when you delete a hard link?

If you do rm myFile where myFile is a hard link, what happens?