Skip to content
Snippets Groups Projects
Verified Commit b9b55b77 authored by nfontrod's avatar nfontrod
Browse files

slides: update slides

parent dd460e19
Branches
No related tags found
No related merge requests found
slides/img/delta1.png

102 KiB

slides/img/delta2.png

189 KiB

slides/img/img_diff.png

100 KiB

...@@ -626,9 +626,26 @@ gblk mount --versions # version view ...@@ -626,9 +626,26 @@ gblk mount --versions # version view
``` ```
<p><p> <p><p>
## Mounting archives {.unnumbered .unlisted} ## 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)
:::
![](img/delta1.png){width=32.4%}
![](img/delta2.png){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 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 ...@@ -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: If two files are recovered this way, we can add the `--diff` option to the previous command:
```bash ```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 Δ .mount/df0eb55.../results/result.txt ⟶ .mount/964fec75.../results/result.txt
──────────────────────────────────────────────────────────────────────────────── ────────────────────────────────────────────────────────────────────────────────
...@@ -663,22 +680,27 @@ $ gblk mount --last 2 -p results/result.txt ...@@ -663,22 +680,27 @@ $ gblk mount --last 2 -p results/result.txt
## Mounting archives {.unnumbered .unlisted} ## 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: 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 ```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 ```bash
 .mount  .mount
└──  964fec75f58829c9642c9c2b675a4e1282d0d266 └──  df0eb55ce43fa48b652340183b5f9cc69daa2350
└──  results └──  results
└──  result.txt └──  result.txt
``` ```
```bash ```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 ```bash
Δ .mount/df0eb55../results/result.txt ⟶ test_gbl/results/result.txt Δ .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 ...@@ -691,14 +713,213 @@ If the selected file is not an image then `delta` display the chnages between th
``` ```
<p><p> <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} ## 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} :::: {.columns}
![first](img/first.png){width=40% height=40%} ::: {.column width="30%"}
![second](img/second.png){width=40% height=40%} :::
::: ::: {.column width="20%"}
\ No newline at end of file ![first.png](img/first.png)
:::
::: {.column width="20%"}
![second.png](img/second.png)
:::
::::
```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%"}
![.tmp/img_diff.png](img/img_diff.png)
:::
::: {.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
...@@ -64,6 +64,14 @@ ...@@ -64,6 +64,14 @@
text-align: center; text-align: center;
} }
.column {
text-align: center;
}
.column-left {
text-align: left;
}
.big-margin p { .big-margin p {
margin-top: 1em; margin-top: 1em;
margin-bottom: 1em; margin-bottom: 1em;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment