<p>If you only want to know whether or not two binary files have identical contents, diff will do the job</p>
<p>See <a href="https://stackoverflow.com/q/12118403/477035">How to compare binary files to check if they are the same?</a></p>

CC BY-SA 4.0
2023-06-14T15:24:54.150Z
2023-06-14T15:24:54.150Z
RedGrittyBrick
<p><a href="https://lightning.readthedocs.io/BACKUP.html" rel="nofollow noreferrer">It is written in the documentation for core-lightning</a>:</p>
<blockquote>
<p>Copy the contents of the $LIGHTNINGDIR to the BTRFS mount point.</p>
<p>Copy the entire directory, then chown -R the copy to the user who will run the lightningd.</p>
<p>If you are paranoid, run diff -r on both copies to check.</p>
</blockquote>
<p><code>lightningd.sqlite3</code> and <code>emergency.recover</code> are binary files, as evidenced by <code>file --mime-encoding</code>. Is <code>cmp</code> a better tool than <code>diff</code> for checking integrity of channel backups? Isn't <code>diff</code> preferred for text files and <code>cmp</code> for binary files?</p>

<backup><core-lightning><static-channel-backups>
'lightningd.sqlite3' and 'emergency.recover' are binary files, why use diff then?
John Smith
# 'lightningd.sqlite3' and 'emergency.recover' are binary files, why use diff then?

(Asked by: username_0 on 2023-06-14)

[It is written in the documentation for core-lightning](https://lightning.readthedocs.io/BACKUP.html):

> Copy the contents of the $LIGHTNINGDIR to the BTRFS mount point.
>
> Copy the entire directory, then chown -R the copy to the user who will run the lightningd.
>
> If you are paranoid, run diff -r on both copies to check.

`lightningd.sqlite3` and `emergency.recover` are binary files, as evidenced by `file --mime-encoding`. Is `cmp` a better tool than `diff` for checking integrity of channel backups? Isn't `diff` preferred for text files and `cmp` for binary files?

**Tags:** backup, core-lightning, static-channel-backups


---

## 1 answers

### Answer by username_1 on 2023-06-14. Score: 1 | Accepted answer

If you only want to know whether or not two binary files have identical contents, diff will do the job

See [How to compare binary files to check if they are the same?](https://stackoverflow.com/q/12118403/477035)


---

