diff --git a/slides/img/delta1.png b/slides/img/delta1.png new file mode 100644 index 0000000000000000000000000000000000000000..bd3763147090f1df0b1cdf2035753eb8e8c6aed3 Binary files /dev/null and b/slides/img/delta1.png differ diff --git a/slides/img/delta2.png b/slides/img/delta2.png new file mode 100644 index 0000000000000000000000000000000000000000..e744511864b5995e978f9773f59e02616fb79e73 Binary files /dev/null and b/slides/img/delta2.png differ diff --git a/slides/img/img_diff.png b/slides/img/img_diff.png new file mode 100644 index 0000000000000000000000000000000000000000..e1110841b46667ff6f8d6ed6d620a5d7d50060ef Binary files /dev/null and b/slides/img/img_diff.png differ diff --git a/slides/slides.qmd b/slides/slides.qmd index 95a59dab3f7eb460189902cdf5e048734f225920..a83bb9e058773b4aaf8ae04b0218729f5356395c 100644 --- a/slides/slides.qmd +++ b/slides/slides.qmd @@ -626,9 +626,26 @@ gblk mount --versions # version view ``` <p><p> + ## Mounting archives {.unnumbered .unlisted} -**Displaying changes between files:** +**Displaying changes between files (1/3):** + +To display the changes between two file gblk uses `delta`. + +To customize the was delta display file differences you can visit: + +::: {#center-p} +[https://github.com/dandavison/delta](https://github.com/dandavison/delta) +::: + +{width=32.4%} +{width=67%} + + +## Mounting archives {.unnumbered .unlisted} + +**Displaying changes between files (2/3):** To display the changes of a results file named `result.txt` in our example between the tow last commits, we can enter @@ -648,7 +665,7 @@ $ gblk mount --last 2 -p results/result.txt # mounting the results/result.txt o If two files are recovered this way, we can add the `--diff` option to the previous command: ```bash -$ gblk mount --last 2 -p results/result.txt +$ gblk mount --last 2 -p results/result.txt --diff Δ .mount/df0eb55.../results/result.txt ⟶ .mount/964fec75.../results/result.txt ──────────────────────────────────────────────────────────────────────────────── @@ -663,22 +680,27 @@ $ gblk mount --last 2 -p results/result.txt ## Mounting archives {.unnumbered .unlisted} +**Displaying changes between files (3/3):** + To display the changes between one commit and the current results folder, only one target file must be recovered by the mount command: example with the `results/result.txt` file: ```bash -$ gblk mount --commit '964fec75f588*' -p results/result.txt # mounting the results/result.txt of the two last commits +# mounting the results/result.txt of the commit starting with df0eb55ce +gblk mount --commit 'df0eb55ce*' -p results/result.txt ``` ```bash .mount -└── 964fec75f58829c9642c9c2b675a4e1282d0d266 +└── df0eb55ce43fa48b652340183b5f9cc69daa2350 └── results └── result.txt ``` ```bash -$ gblk mount --commit 'df0eb55ce*' -p results/result.txt --diff # mounting the results/result.txt of the two last commits +# mounting the results/result.txt of the commit starting with df0eb55ce and +# displaying the changes between this file and the same file insde our results folder. +gblk mount --commit 'df0eb55ce*' -p results/result.txt --diff ``` -If the selected file is not an image then `delta` display the chnages between the two files +If the selected file is not an image then `delta` display the changes between the two files ```bash Δ .mount/df0eb55../results/result.txt ⟶ test_gbl/results/result.txt @@ -691,14 +713,213 @@ If the selected file is not an image then `delta` display the chnages between th ``` <p><p> +## Mounting archives {.unnumbered .unlisted} + +**Displaying changes between images (1/4):** + +To display the change between two images gblk uses [ImageMagick](https://imagemagick.org/script/index.php). + +If you plan to display the changes between *pdf*, you might have to change the file `etc/ImageMagick-[VERSION]/policy.xml` by replacing the line: + +```xml +<policy domain="coder" rights="none" pattern="PDF" /> +``` + +by + +```xml +<policy domain="coder" rights="read | write" pattern="PDF" /> +``` + +Currently the following formats are +available *PNG*, *JPEG*, *BMP*, *ICO*, *SVG*, *PDF* ## Mounting archives {.unnumbered .unlisted} -**Displaying changes between images:** +**Displaying changes between images (2/4):** -Let's consider the following images: +Let's consider the following images in the `data` folder: -::: {layout-ncol=2} -{width=40% height=40%} -{width=40% height=40%} -::: \ No newline at end of file +:::: {.columns} +::: {.column width="30%"} +::: +::: {.column width="20%"} + +::: +::: {.column width="20%"} + +::: +:::: + +```bash +# Copy of the first.png image into the results folder with the name img.png +echo 'cp data/first.png results/img.png' >> src/script.sh +bash src/script.sh +# Saving the results folder +git add src/script.sh && git commit -m "add image" +``` +<p><p> + +## Mounting archives {.unnumbered .unlisted} + +**Displaying changes between images (3/4):** + +The results folder now look like this: + +```sh + results +├── .gitignore +├── img.png +├── new.txt +└── result.txt +``` + +Now let's change the last line of the script: + +```bash +# Change first.png into second.png in the file src/script +sed -i "s/first.png/second.png/g" src/script.sh +# Execute the new script +bash src/script.sh +# Saving the new images +git add src/script.sh && git commit -m "add new image" +``` +<p><p> + +## Mounting archives {.unnumbered .unlisted} + +**Displaying changes between images (4/4):** + +Let's run the following command to create an image corresponding to the differences of `first.png` and `second.png` + +```bash +gblk mount --last 2 --path results/img.png --diff +``` + +::: {.callout-note} +## This command: + +1. Mount *the images `results/img.png`* inside our *two last archives* +2. Creates an image inside the `.tmp` folder *corresponding to the differences between the two `results/img.png` images*. +::: + +:::: {.columns} +::: {.column width="18%"} + +::: +::: {.column .column-left width="80%"} +::: {.callout-note} +## The color: +- *red*: Corresponds to what was on the old image but not in the new one +- *green*: Corresponds to what is new on the most recent image +- *pale*: What didn't change between the images +::: +::: +:::: + +## Deleting archive + +**gblk delete command (1/2)** + +- The `delete` command is a wrapper of the `borg delete` command +- Can be used to delete *specific archive* by *their name*, *a prefix* or *a glob*. + +::: {.callout-important icon=false} +Note that this command *doesn't actually free disk space*. You have to use `gblk compact` afterwards to achieve this. +::: + + +## Deleting archive {.unnumbered .unlisted} + +**gblk delete command (2/2)** + + +To display the help of gblk delete, run the following command: + +```sh +gblk delete -h # -h for compact help, --help for a more exhaustive help +``` + +::: {.callout-tip icon=false} +The delete command has a lot of option: go to [borg's delete documentation](https://borgbackup.readthedocs.io/en/stable/usage/delete.html) to have more details on each of them +::: + + + +To see what archive you are about to remove, run: + +```sh +gblk delete --list --dry-run [OTHER_OPTIONS] +``` + +- The `--dry-run` option will keep the archive unchanged +- The `--list` option will display what was deleted (without `--dry-run` option) or what would be deleted (with the `dry-run` option) + +## Deleting archive {.unnumbered .unlisted} + +**gblk prune command (1/2)** + +- The `prune` command is a wrapper of the `borg delete` command +- Can be used to *keep archives created during a given period of time* and *remove others*. + +::: {.callout-important icon=false} +Note that this command *doesn't actually free disk space*. You have to use `gblk compact` afterwards to achieve this. +::: + +To display the help of `gblk prune`, run the following command: + +```sh +gblk prune -h # -h for compact help, --help for a more exhaustive help +``` + +::: {.callout-tip icon=false} +The delete command has a lot of option: go to [borg's prune documentation](https://borgbackup.readthedocs.io/en/stable/usage/prune.html) to have more details on each of them +::: + +## Deleting archive {.unnumbered .unlisted} + +**gblk prune command (2/2)** + +The *prune* command applies to *all archives in the repository* unless you want to perform it only on a subset of archive with the `--glob-archives` option. + + +To see what archives you are about to remove, enter + +```sh +gblk prune --list --dry-run [OTHER_OPTIONS] +``` + +To keep *1 end of day*, *1 additional end of week* archives run the following commands: + +```console +$ gblk prune --list --dry-run --keep-daily 1 --keep-weekly 1 +Keeping archive (rule: daily #1): 248a2e5f... Tue, 2023-02-14 09:39:10 [ef885658...] +Would prune: 964fec75... Mon, 2023-02-13 09:12:50 [fef70c46...] +Keeping archive (rule: weekly #1): df0eb55c... Fri, 2023-02-10 16:15:56 [c9409d26...] +``` + +To keep *all backups in the last 2 days* and *1 additional end of week* archives, + +```console +$ gblk prune --list --dry-run --keep-within=2d --keep-weekly 1 +Keeping archive (rule: within #1): 248a2e5f... Tue, 2023-02-14 09:39:10 [ef885658...] +Keeping archive (rule: within #2): 964fec75... Mon, 2023-02-13 09:12:50 [fef70c46...] +Keeping archive (rule: weekly #1): df0eb55c... Fri, 2023-02-10 16:15:56 [c9409d26...] +``` +<p><p> + +## Deleting archive {.unnumbered .unlisted} + +**gblk compact command** + +- This command frees `.borg` repository space. +- To use after `prune` or `delete` command +- Can be time consuming if the amount of parts that needs compation is big. You can use `--progress` option in this case + +You can run: + +```sh +gblk compact --verbose +``` + +To compact you `.borg` folder \ No newline at end of file diff --git a/slides/style.css b/slides/style.css index 16ea4856c936c63f17813f2f06babf95afbecbad..d058bd5b6e55f787e86495859749fa17930863ef 100644 --- a/slides/style.css +++ b/slides/style.css @@ -64,6 +64,14 @@ text-align: center; } +.column { + text-align: center; +} + +.column-left { + text-align: left; +} + .big-margin p { margin-top: 1em; margin-bottom: 1em;