Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hard links - How do they work

11 views
Skip to first unread message

Keith Bainbridge

unread,
Feb 18, 2024, 7:00:06 PMFeb 18
to
As promised:
I said sometime in this thread that timeshift (and Back in Time) use
hard links to create progressive copies of the system. The more I think
about how hard links reportedly work, I reckon it can't be simply hard
links.

So I'm starting a new thread on that topic.

My understanding is that a hard link (ln with no option) will list the
file in another directory, but the file remains the same no matter where
I may edit it. I use cp -lru as a quick and dirty way to protect me
against accident deleting a file. (Sym-link doesn't give that
protection, but does allow me to keep my home on a separate partition so
that a fresh install is a LOT easier; but that is another topic)

Snapshots reportedly hard link the directory/ies (generally means / but
not limited ). a new snapshot copies the latest set and then updates any
new files in the base. The more I try to visualise that process the
more I reckon there must be more to it

Anybody care to fill me in please?

I am mindful that it is late Sunday night for many of you


--
All the best

Keith Bainbridge

keith.bain...@gmail.com
+61 (0)447 667 468

UTC + 10:00

Andy Smith

unread,
Feb 18, 2024, 7:10:06 PMFeb 18
to
Hi,

On Mon, Feb 19, 2024 at 10:52:16AM +1100, Keith Bainbridge wrote:
> I said sometime in this thread that timeshift (and Back in Time) use hard
> links to create progressive copies of the system. The more I think about how
> hard links reportedly work, I reckon it can't be simply hard links.

I can tell you how hardlinks work but I can't tell you how
Timeshift or Back In Time work as I have never used them. So you
might want to alter your subject line, because your email goes on
only to ask how these solutions work

Thanks,
Andy

--
https://bitfolk.com/ -- No-nonsense VPS hosting

Kushal Kumaran

unread,
Feb 18, 2024, 7:20:07 PMFeb 18
to
On Mon, Feb 19 2024 at 10:52:16 AM, Keith Bainbridge <keit...@gmail.com> wrote:
> As promised:
> I said sometime in this thread that timeshift (and Back in Time) use
> hard links to create progressive copies of the system. The more I
> think about how hard links reportedly work, I reckon it can't be
> simply hard links.
>
> So I'm starting a new thread on that topic.
>
> My understanding is that a hard link (ln with no option) will list the
> file in another directory, but the file remains the same no matter
> where I may edit it. I use cp -lru as a quick and dirty way to
> protect me against accident deleting a file. (Sym-link doesn't give
> that protection, but does allow me to keep my home on a separate
> partition so that a fresh install is a LOT easier; but that is another
> topic)
>
> Snapshots reportedly hard link the directory/ies (generally means /
> but not limited ). a new snapshot copies the latest set and then
> updates any new files in the base. The more I try to visualise that
> process the more I reckon there must be more to it
>
> Anybody care to fill me in please?
>

Have you read their FAQ page about hard links?
https://github.com/bit-team/backintime/blob/dev/FAQ.md#how-do-snapshots-with-hard-links-work

Charles Curley

unread,
Feb 18, 2024, 9:00:07 PMFeb 18
to
On Sun, 18 Feb 2024 16:15:01 -0800
Kushal Kumaran <kus...@locationd.net> wrote:

> Have you read their FAQ page about hard links?
> https://github.com/bit-team/backintime/blob/dev/FAQ.md#how-do-snapshots-with-hard-links-work

An excellent writeup. The only thing I would add is that creating a
hard link does require an entry in a directory somewhere. If that
requires adding a block to the directory entry, that will happen. So
hard links are not entirely free. TANSTAAFL: There Ain't No Such Thing
As A Free Link.

But I doubt that this explains all of Keith Bainbridge
<keit...@gmail.com>'s problem.

--
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/

Keith Bainbridge

unread,
Feb 18, 2024, 9:40:06 PMFeb 18
to

On 19/2/24 11:15, Kushal Kumaran wrote:
> Have you read their FAQ page about hard links?
> https://github.com/bit-team/backintime/blob/dev/FAQ.md#how-do-snapshots-
> with-hard-links-work


Very interesting. Thank you


I have totally missed the concept of copying all files as a starting point.

I was dismayed to read that a file that was deleted disappears from the
back up as well. UMMM I didn't know I had deleted that file. A
month/year later I NEED it quickly. What to do?

I went back to timeshift and looking again, this concept of copying all
files seems to be used here as well. The author does say that the app
uses btrfs inbuilt snapshot process when available.

I have to look harder when I browse over something. Is it looking
obvious that I never really learnt how to read, 70 years ago in primary
school.

Dan Ritter

unread,
Feb 19, 2024, 7:20:04 AMFeb 19
to
Keith Bainbridge wrote:
> As promised:
> I said sometime in this thread that timeshift (and Back in Time) use hard
> links to create progressive copies of the system. The more I think about how
> hard links reportedly work, I reckon it can't be simply hard links.
>
> So I'm starting a new thread on that topic.
>
> My understanding is that a hard link (ln with no option) will list the file
> in another directory, but the file remains the same no matter where I may
> edit it. I use cp -lru as a quick and dirty way to protect me against
> accident deleting a file. (Sym-link doesn't give that protection, but does
> allow me to keep my home on a separate partition so that a fresh install is
> a LOT easier; but that is another topic)

A hard link is a name for a file -- it points to the first inode. Most
files only have one name, but they can have many. Hard links can be in
many directories, but must stay on the same filesystem. If you
mv the file by any of its links on the same filesystem, all the
links remain valid. When the last name for a file is deleted,
the file is deleted. Now you know why deleting a file is
sometimes called "unlinking".

A symbolic link is a tiny file that contains a path to a file.
The kernel reads the path, then looks for the substitute file.
This can fail. But -- it can cross filesystems, even filesystems
of completely different types. If you move the symbolic link, it
continues to point to the same path. If you move the referenced
file, the symbolic links are no longer valid.


> Snapshots reportedly hard link the directory/ies (generally means / but not
> limited ). a new snapshot copies the latest set and then updates any new
> files in the base. The more I try to visualise that process the more I
> reckon there must be more to it

"snapshot" is not a single definition; the software you are using
produces different results.

rsnapshot/rsync, lvm, btrfs and zfs, for example, each use completely
different mechanisms with different semantics.

It looks like timeshift uses either rsync or btrfs snapshots,
and backintime uses rsync, so first you would need to define which of those you are using
and in what mode.

-dsr-
0 new messages