Questions tagged [hard-link]
A hard link is file system entry that associates a name with another file on a file system.
262 questions
0
votes
1
answer
45
views
rsync with --include-from breaks hardlinks (evec with -H)
I'm trying to copy a bunch of files (around 50000) from an include-file list. THe include-file has relative path to the files on the source folder.
I'm using the following command :
rsync -avPilHAXWE \...
0
votes
2
answers
116
views
How to programmatically deduplicate files into hard links while maintaining the time stamps of the containing directories?
Continuing https://unix.stackexchange.com/a/22822, how to deduplicate files, given as a list, into hardlinks, while maintaining the timestamps of their directories? Unfortunately, hardlinks changes ...
11
votes
6
answers
3k
views
Why are symbolic links more common than hard links in Unix/Linux? [closed]
I frequently find myself googling the difference between symbolic links and hard links. Each time, I conclude that hard links seem superior in most use cases, especially when Linux is my daily driver. ...
0
votes
1
answer
104
views
How to Avoid Copying Large Folders When Creating a chroot Sandbox Using Symlinks, Hard Links, or Bind Mount?
I am working on creating a chroot sandbox and want to avoid the time-consuming and storage-intensive process of copying large directories such as bin, lib, and others.
Is it possible to use symbolic ...
3
votes
3
answers
380
views
Why hard link doesn't corrupt if we remove the original file? [duplicate]
Why the hard link doesn't corrupt if we remove the original file?
If I remove the original file then the softlink gets corrupt but hard link doesn't so why it does't corrupt
0
votes
2
answers
123
views
Creating hard links [duplicate]
$ ln fun fun-hard
$ ln fun dir1/fun-hard
$ ln fun dir2/fun-hard
$ ls -1
total 16
drwxrwxr-x 2 me 4096 2018-01-14 16:17 dir1
drwxrwxr-x 2 me 4096 2018-01-14 16:17 dir2
-rw-r—-r—- 4 me 1650 2018-01-10 ...
0
votes
2
answers
77
views
Creating a hard link increases the hard link count for two names
gui@Latitude:~$ cd playground
gui@Latitude:~/playground$ ls -l
total 8
drwxrwxr-x 2 gut gut 4096 set 20 16:18 dir1
-rw-r--r-- 1 gut gut 2903 set 20 14:46 gato
gui@Latitude:~/playground $ ln gato gato-...
0
votes
0
answers
155
views
How do I get the number of hardlinks of a folder?
I am on Mac. However, I use gstat (GNU stat) so my understanding is that behavior should match linux.
I cd to a folder. Then I use gstat --format=%h .. The output is 65.
Next, I use gfind . -maxdepth ...
0
votes
0
answers
64
views
archiver/backups does not save/restore hardlinks
I will explain what kind of hardlinks and where and why they appeared, and why to save them.
pictures on the server are saved:
../foto/M/ay/uZbIKBgsXr0222858001661067986M
../foto/M/ay/...
0
votes
1
answer
510
views
Hard links on a mounted disk
I have a work laptop that I will soon have to return to my employer. Having foreseen this, I ordered a second internal disk and mounted it at /home/<user> so that I can just pull it out and ...
3
votes
2
answers
213
views
How can I copy directories recursively with hardlinks with variables in bash?
The operation I'm trying to do is take directory 1:
Dir1
Dir A
File A
Dir B
File B
Then use the find command to check every file in Dir 1 for whether or not they have an ...
1
vote
1
answer
2k
views
How to find all hardlinks to a given inode? [duplicate]
Is there a way to list all hardlinks, by path/filename, or even just by file name alone, that point to a given inode? I have a file that ls -al reports has three hardlinks, but it should only have two....
0
votes
1
answer
5k
views
getting "Invalid cross-device link" doing a cp -l - same volume
This command - run as Admin (not Root) in directory
/volume2/Media/AllOurMedia/1 Our Pictures/Cataloged ( 3-5):
cp -l HL_Test.JPG /volume2/phototest/
got this response:
cp: cannot create hard link '/...
0
votes
3
answers
2k
views
What is the fastest way of copying long paths for the cp command? [duplicate]
I'm controlling a Linux based NAS through SSH on a Windows computer. What I'm trying to do is use the cp -al command to rapidly copy folders from one directory to another, hardlinking all the files ...
0
votes
0
answers
237
views
How to remove hardlink to /home created by timeshift?
After installing timeshift on Kali Linux, the same device/drive with a different name/path was created as seen in the system monitor under the File Systems tab:
Even after uninstalling timeshift, the ...
1
vote
1
answer
744
views
Is symbolic link to hardlink (inode) of directory possible? (that would point to the same physical location after mount on top of that directory?)
Some time ago I wanted to be able to access files in a directory which was overshadowed by later mount point. I recall finding several QAs on SE giving answers, but I recall none I've tried worked. ...
0
votes
1
answer
542
views
Hard link to soft link
Can one force ln not to follow a soft link in its first argument? For example, in the following I would like hard to be a hard link to the soft link soft:
$ mkdir dir
$ ln -s dir soft
$ ln soft hard
...
1
vote
2
answers
2k
views
backing up rsync with hard links -- can you hard link files moved to different folders? [duplicate]
I use rsync for incremental backups of my folder /hi AND I use --link-dest=[some.server]/hi. Lets say I have 1000 photos in a folder /hi/there, which is backed up on my server with rsync.
Now I move ...
1
vote
2
answers
2k
views
How can I preserve hardlinks with tar while creating archives of multiple folders?
I have multiple subfolders and some of them contain hardlinks to other subfolders:
# mkdir /tmp/data
# mkdir /tmp/foo
# mkdir /tmp/foo/bar
# mkdir /tmp/foo/baz
# truncate -s 10M /tmp/foo/bar/file1
# ...
1
vote
1
answer
2k
views
Git - how to add/link subfolders into one git-repository directory
Assuming I have a file structure like this:
├── Project-1/
│ ├── files/
│ └── special-files/
├── Project-2/
│ ├── files/
│ └── special-files/
└── Project-3/
├── files/
└── special-...
2
votes
1
answer
483
views
Why . and .. are hard links to directories while in *nix systems hard links are not allowed for directories?
I know how hard links and symlinks work and I know why hard links can't be used for directories but in this case, is it some kind of exception?
For example I do:
ls -al Documents
total 8
drwxr-xr-x ...
2
votes
1
answer
500
views
about ln command : condition of cross-device
On openSUSE Tumbleweed 20210606 with kernel GNU/Linux 5.12.9-1-default
I tried making a hard link of file from /cust to ~/backup:
df /cust && df ~/backup && ln -P /cust/customization....
0
votes
1
answer
227
views
How can I have it so, that when hardlinks which are not the original, are editted, that they would first be copied then editted?
This is something I imagine I might have to submit a patch or feature request for, but I'd like to know if it is possible to create a hardlink to a file, that when that hardlink which was not the ...
0
votes
2
answers
2k
views
du counts hard links only once but hard links have the same size as the first hard link?
I have a large directory structure that has many hard links from the first hard link which lives in a different directory structure. For example dir1 has the following structure :
[dir1]$ tree
.
├── ...
1
vote
2
answers
1k
views
Finding duplicate files using bash script
How do you write a bash one-liner that will find binary files with identical contents, permissions, and owner on the same ext4 file-system, from the current working directory recursively, and replace ...