pCloud Tip: Hash checker (oneliner)

Hi!

If you are using pCloud as a backend (using rclone), this is something you might want to use:

You are lucky if your data in the European region, because there pCloud saves the SHA256-hash of all files and you have access to those hashes using rclone. This here is a small oneliner, which compares the SHA256 with the filename of the blob:

rclone lsf pcloud:restic/data | xargs -I {} sh -c "echo checking data pcloud:restic/data/{}...; rclone lsjson pcloud:restic/data/{} --hash  | jq '.[] | if .Path != .Hashes.sha256 then .  else empty end'"

It prints those files whose hash do not match, example output:

checking data pcloud:restic/data/00/...
checking data pcloud:restic/data/01/...
checking data pcloud:restic/data/02/...
checking data pcloud:restic/data/03/...
{
  "Path": "03d0785c18575578a666160c4c1a013fed555b01020f95aba897176789d273ed",
  "Name": "03d0785c18575578a666160c4c1a013fed555b01020f95aba897176789d273ed",
  "Size": 11028992,
  "MimeType": "application/octet-stream",
  "ModTime": "2023-01-10T18:25:35Z",
  "IsDir": false,
  "Hashes": {
    "sha1": "864285377a3f7faca67236eeb948a9aac12c00e4",
    "sha256": "d220dc24d3c3f9aefd2ed1cbd82d84abf2563bfff3c6550313c44abb21f84437"
  },
  "ID": "f21710404428"
}
checking data pcloud:restic/data/04/...
checking data pcloud:restic/data/05/...
checking data pcloud:restic/data/06/...
checking data pcloud:restic/data/07/...
checking data pcloud:restic/data/08/...
checking data pcloud:restic/data/09/...
checking data pcloud:restic/data/0a/...
{
  "Path": "0abbc8867199cdc0012f9cb33dea6629c827911a28d80b45ab990e044d8b7ee1",
  "Name": "0abbc8867199cdc0012f9cb33dea6629c827911a28d80b45ab990e044d8b7ee1",
  "Size": 11698176,
  "MimeType": "application/octet-stream",
  "ModTime": "2023-01-09T20:49:08Z",
  "IsDir": false,
  "Hashes": {
    "sha1": "00305778f9cd2243947901be36c821f8fbd3e219",
    "sha256": "7fb530110dd3721e7eac4499c1eb57266e6a4e0451737072648c305420f6c12a"
  },
  "ID": "f21661393258"
}
checking data pcloud:restic/data/0b/...
checking data pcloud:restic/data/0c/...
{
  "Path": "0cbe4c46df9eb88d7efce3acd0ef760c69e03ead1f9ce65d4c63e64d51addd72",
  "Name": "0cbe4c46df9eb88d7efce3acd0ef760c69e03ead1f9ce65d4c63e64d51addd72",
  "Size": 8093696,
  "MimeType": "application/octet-stream",
  "ModTime": "2023-01-15T19:40:19Z",
  "IsDir": false,
  "Hashes": {
    "sha1": "d6559aab42d8b67012d9096aa581bf2d8cf5c806",
    "sha256": "0d9e535445d5417d718116c8635dd211d0ab9749765ce464255afd3b62dfad7f"
  },
  "ID": "f21941670585"
}
checking data pcloud:restic/data/0d/...

You can delete these files by hand (these are broken already).

This might speed up debugging and healing your pCloud repos :).

3 Likes

Hello @derphysiker ,

you say filename of the blob, can you tell us more about that? Do you run this oneliner before or after backup? Or forget? In which scenario is that needed?

Thanks!