Questions tagged [hard-link]
A hard link is file system entry that associates a name with another file on a file system.
236
questions
0
votes
0
answers
18
views
Where is hard link data stored in the system? [duplicate]
I understand that a hard link is a pointer to the inode of a file, but I can't find any information about where the data about the hard link itself is stored; stuff like its name, path and the index ...
0
votes
0
answers
34
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 ...
7
votes
1
answer
1k
views
Why does this new directory have a link count of 3?
$ sudo su
# dd if=/dev/zero of=./myext.img bs=1024 count=100
.
.
.
# modprobe loop
# losetup --find --show myext.img
/dev/loop0
# mkfs -t myext /dev/loop0
.
.
.
# mkdir mnt
# mount /dev/loop0 ./mnt
# ...
1
vote
1
answer
123
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
0
answers
65
views
How to get timestamp of given rsnapshot backup directory (eg beta.3)
Given a directory in the snapshot_root, how do I determine the time that given backup was created?
The default rsnapshot configuration in Debian 9 puts its rotating rsnapshot directories in /var/cache/...
0
votes
3
answers
86
views
linux hardlinks [duplicate]
Okay so I understand that this is a relatively Novice question about linux however in any case concerning hardlinks, If I create a hardlink to an existing file, then delete the original then the data ...
0
votes
1
answer
43
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
1
answer
51
views
Why can't I symlink a preexisting file to a target file? [duplicate]
I have an example to better illustrate what I'm talking about:
$ touch tas
$ ln -s /etc/leviathan_pass/leviathan3 /tmp/l2/tas
ln: failed to create symbolic link '/tmp/l2/tas': File exists
Basically I ...
0
votes
2
answers
207
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 ...
0
votes
1
answer
420
views
Why can't I create a hard link in a directory on Ubuntu?
I just started learning about the Linux command line with the book "The Linux Command Line". I was trying to create a hard link by following instructions from the book and typing this ...
0
votes
2
answers
88
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
# ...
0
votes
1
answer
158
views
On xfs, why can't I hardlink to /tmp/, giving the error "Invalid cross-device link" when my fstab indicates tmp is on the same partition?
My error:
ln "99700.fa821246f01ef7f3d86a503e33de5753b50640d69de790fd3db5a5dc31ffa45d1dc64a93f950379ee432aa27cbb0593e6e50ddbb6f8a7e279afaf90cec961233.png" /home/anon/foo.png
# ^ ...
1
vote
1
answer
169
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
404
views
Is there any advantage to using a hard-link on ZFS instead of relying upon deduplication when considering only disk space allocation?
If I want to create multiple instances of a file on a ZFS file system, is there any advantage to using a hard-link instead of relying upon deduplication as a method of preserving disk space?
This ...
1
vote
1
answer
98
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 ...
1
vote
1
answer
143
views
GNU cp: What's the difference between `--link` and `--reflink=always`?
What's the difference between --link and --reflink=always?
I use the following command as an mv substitute, and I am wondering if using --reflink is a better choice.
command gcp -r --link --archive --...
2
votes
1
answer
60
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
0
answers
163
views
What is the difference between link and ld command in linux ..?
First, let tell what do I think about them:-
ld
ld is a GNU linker according to man page. I think, It takes an object file as input and return an executable output file. ld combines a number of object ...
0
votes
1
answer
44
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
0
answers
87
views
How do I derive multiple bash variables from a folder path and filenames?
This is about the twentieth time I've tried to write this post but it always becomes a behemoth... so I'm going to try and keep it short.
Basically what I want to do is push my noobie skills to the ...
0
votes
2
answers
247
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
.
├── ...
3
votes
3
answers
373
views
Why didn't inode change anymore with a hard link
I use Vim 8.2 to edit my files in my Ubuntu 18.04. When I open a file, do some changes and quit with Vim, the inode number of this file will be changed.
As my understanding, it's because the backup ...
1
vote
2
answers
326
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 ...
0
votes
1
answer
118
views
How to find evey softlink to a directory?
Take /etc dir as example. On my system it has 144 links. And as dir's can't have hardlinks (this is my understanding), the number 144 should refer to softlinks (1 original + 143 softlinks).
$ ll -i
...
7
votes
2
answers
3k
views
How to effectively trace hardlink in Linux?
Softlinks are easily traceable to the original file with readlink etc... but I am having a hard time tracing hardlinks to the original file.
$ ll -i /usr/bin/bash /bin/bash
1310813 -rwxr-xr-x 1 ...
2
votes
0
answers
98
views
In an NTFS filesystem, does hardlink count, as reported by ls and stat, include other link types as well as hardlinks
Does NTFS count other link types with the same counter it uses for hardlinks? Or does Linux include other link types when it calculates hardlink count in an NTFS filesystem?
I have an NTFS filesystem ...
0
votes
2
answers
44
views
Linking and Copying
I have a few questions regarding links in UNIX
Can I say Soft links in UNIX are analogous to shortcuts in windows?
Difference between copying and hard-linking?
Can anyone give me a use-case where I ...
1
vote
0
answers
15
views
Using link-dest thwarted by permissions
I'm trying to do a weekly archive of a source folder using the previous week as a source for link-dest.
However, the actual source folder has one set of permissions (on files) that differ from what ...
1
vote
2
answers
144
views
Unix: ".." doesn't point to parent -- how is this possible?
I recently ran into the following problem on a Solaris 11 system
I do development on:
Somehow, a few directories had their parent pointer (..) pointing to
a different directory from the parent.
Let'...
0
votes
1
answer
91
views
Move daily backup directories (made by rsync) to another directory in the same partition
I have a daily rsync script backing up my data on an external hard drive at /mnt/X (root of hard drive). I am using --link-dest to use hard links and avoid duplicating data. I need to move all my ...
1
vote
1
answer
112
views
Understanding hard links
I created a file in home directory.
touch demo
echo "This is demo" > demo
Now I created a hard link in /tmp
ln /home/leo/demo demoLink
Now when checking the inode using
ls -ltri demoLink
It ...
0
votes
1
answer
557
views
Enable symbolic link from other user
I'm trying to get the symbolic link from other user.
My file is located in /home/serviceA/logs/a.txt And I want to create a symbolic link to /home/centos/logs/a.txt.
Here is my command I ran as root ...
0
votes
1
answer
219
views
Invalid cross-device linked. Multiple shares from the same NAS
I have a NAS devices, and I've mounted 2 shared folders from this one device.
QNAP
Ubuntu 18.04
fstab config:
//192.168.0.10/Media /media/QNAP_Media cifs credentials=/home/user/.smbcredentials,...
2
votes
0
answers
63
views
Looking for a convenient way to create hard links
I'm looking for a convenient way to create hard links. Sort of like a drag and drop method. I was looking for such a feature in Midnight Commander but I couldn't find it. If there's a CLI-based file ...
0
votes
1
answer
154
views
Can every file really own at least 2 names (and thus 2 hard links)?
This page on inodes has been exceptional help in grasping the surface-level concept of file systems. On the same page, the author has inserted this snippet demonstrating that each file or directory ...
4
votes
3
answers
556
views
Hardlink that "split" when a file changes
Is it possible (in classical ext4, and/or in any other filesystem) to create two files that point to the same content, such that if one file is modified, the content is duplicated and the two files ...
0
votes
1
answer
150
views
Working Syntax for Rsync Copy of a set of 2 or more Hard-linked Folder Trees while maintaining this specific archive structure?
Working Syntax for Rsync Copy of a set of 2 or more Hard-linked Folder Trees while maintaining this specific archive structure?
PS: Would this be a better fit in SO or SU SE?
Template of Current/ ...
1
vote
0
answers
153
views
How to force tar cf to have reproducable results?
Preface: We have a complex build process and discovered it's working on one system and failing on another (unfortunally/Murphy it worked on the Jenkins build server, so the problem remained ...
8
votes
4
answers
1k
views
Properly unlinking hard links
I have a script that goes like this
ln /myfile /dev/${uniquename}/myfile
I want to remove the link of /dev/somename/myfile to decrease the link count.
How do I do this?
0
votes
0
answers
489
views
Cannot rm broken NTFS link
I'm trying to use an old windows NTFS drive as extra storage on a raspberry pi. I tried to delete everything on it, but came across a problem where I can't remove two broken links. I can format the ...
1
vote
1
answer
257
views
Find (and delete) all files with hard link count = 1
I'm having a tough time trying to reclaim some unused disk space on one of my macOS 10.13 partitions.
Thanks to GrandPerspective, I think I found out that every time I delete some items in Photos for ...
0
votes
1
answer
222
views
Link files and directories, in target directory, with cross-device links
I have a user account at my local library (they use openslx), in which I can store files. My actual home folder is "mounted" (I'm not sure how) in /home/[my_userID]/PERSISTENT instead of /home/[...
0
votes
1
answer
854
views
Hard links with MergerFS
If someone uses the command "cp -alr" on a directory located in a non-path preserving merged pool will it always create a directory on the same disk with all of its contents as hard links?
For ...
1
vote
1
answer
230
views
Safely remove a symlink or hardlink
Does using rm on a symlink or a hard-link remove the source in addition to the link? Is there a good way to delete a hard-link or a symlink without deleting the source?
And if there is a good way ...
0
votes
1
answer
1k
views
Difference between file descriptor and soft/hard link
If soft link and hard link are pointer to a file.
And file descriptor is a file handle pointing to an open file.
Then what exact difference is between the two if both of them are a kind of pointer ...
1
vote
1
answer
453
views
What happens when you copy a hardlink?
Imagine I have a file something/a.txt, which I hardlink from b.txt. Now, if I cp b.txt c.txt, is c.txt a hard link to a.txt, or is it a copy of the contents of a.txt?
-1
votes
1
answer
337
views
A command to know if some file are "only" an hard link and "not" a symlink [duplicate]
I need a command for an if condition to know if 'file_name' is an hard link (not symlink). Thanks
1
vote
2
answers
380
views
What to do when hard link is lost because of my text editor
So, I have a file, for this instance we shall call it $HOME/Documents/hello.txt. I will write some text inside it:
Hello, welcome to my text file
And I will hard-link this file here: $HOME/Documents/...
1
vote
2
answers
1k
views
How can you move hardlinks to another disk
If we have a file on a disk and create a hard link pointing to it then we have two references to the same data. If one link gets deleted it does not affect the other link as it is directly pointing ...
2
votes
1
answer
787
views
Overlay storage driver internals
A follow-up from this question.
My further reading on Docker storage drivers revealed that the overlay driver merges all the image layers into lower layers using a hard link implementation which ...