How to identify which chunks represent a particular file

To solve a specific problem, I’m looking for a way to identify which chunks represent a particular file.

I have looked at what is described in this topic about snapshot format:

But when I checked the snapshot files, they don’t have the information for each file, just a summary of the revision:


Am I looking at the correct file?

Yep but there’s a bit more to it. Further down that page it explains that:

So from what I understand, the files entries in your example is a list of metadata chunks which, once decoded, expands into the more detailed file list as shown further up the howto page. They’re probably just raw text in .json format, but chunked, compressed, and encrypted like all other chunks.

Same with chunks entries, and same with lengths.

Once decoded, each file should have a content field which details the start and ending chunk, plus where in the chunks they start and end.

I agree, but it also has:


The snapshot file I showed above has 9 files in the “files” section:


But I did not find (for example) the file:

chunks / 54 / 5ad57c1d3dae9df0d7f635b21a99f3023e6645a5e402803cb0c97ed8b9098d

The backup log shows that I have 8 metadata chunks:

File chunks: 18450 total, 20,750M bytes; 1582 new, 1,783M bytes, 1,783M bytes uploaded
Metadata chunks: 8 total, 8,043K bytes; 8 new, 8,043K bytes, 3,114K bytes uploaded
All chunks: 18458 total, 20,758M bytes; 1590 new, 1,791M bytes, 1,786M bytes uploaded

What would these 8 chunks be?

Probably, but the problem is: how to do this?

I just remembered this:

The cat log for the above storage shows:

  "chunk_sequence": [
  "chunks": [
	... [thousands of lines]
  "end_time": 1560970712,
  "file_sequence": [
  "files": [
      "content": "6884:0:6884:188",
      "hash": "d7206f987d976f0fba2ef658c3805ff8ab358dd5b8cbdb511c25797019bca626",
      "mode": 438,
      "path": "[file 1]",
      "size": 188,
      "time": 1540320503
      "content": "6884:188:6884:19750",
      "hash": "7b8b9ef315866fa4d6a7cab137c2f61c1713fbea4a3350de272a28a4751a12b8",
      "mode": 438,
      "path": "[file 2]",
      "size": 19562,
      "time": 1540320498

Okay, that’s a bit more light on the subject.

Now, considering this:

What would be the chunks that are associated with file 2?

      "content": "6884:188:6884:19750",
      "path": "[file 2]",

That means file 2 runs from offset 188 to 19750 in chunk 6884. 6884 is the index of the chunk in the chunks array.

1 Like

This was the part of the puzzle that was missing…

A curious detail is that the file that starts from the “zero position” is the oldest file in the whole folder:

      "content": "0:0:0:17899",
      "path": "[very old file]",
      "time": 1387212469

1387212469 = Mon, 16 Dec 2013 16:47:49

That is just a coincidence. Files are always sorted alphabetically.

Could this be because they are stored as chunk hashes and not chunk ID’s (chunk file names)?

If you think about it, if you copy snapshots between different storages - i.e. copy-compatible, but not bit-identical - those storages will have a different ‘ID Key’. You’ll have the same data but encrypted differently, and the chunk file names will be different. But the data inside the snapshots has to be immutable.

Makes sense :thinking: