"Updates"

This commit is contained in:
2025-10-18 18:14:47 +02:00
parent 15ac2592e0
commit 6ef480e13f

View File

@@ -5,20 +5,114 @@ Borg Server / Borg Backup
sudo apt install borgbackup -y
```
#### Repository initialization on server :
### Repository initialization on server :
#### Classic repo
```bash
borg init -e none /mnt/data/backup/<repo_name>
```
#### Repository initialization from distant host :
### Repository initialization from distant host :
```bash
# local
borg init -e none /mnt/data/backup/<repo_name>
# distant
borg init -e none ssh://pleb@krabs/mnt/data/backup/<repo_name>
```
> Enter a passphrase to encrypt the folder.
#### Verify the backup folder using the command info:
#### Encrypted repo
```bash
borg info ssh://pleb@krabs/mnt/data/backup/<repo_name>
# local
borg init -e repokey /mnt/data/backup/<repo_name>
# distant
borg init -e repokey ssh://pleb@krabs/mnt/data/backup/<repo_name>
```
> Enter a passphrase to encrypt the folder.
```txt
Enter new passphrase:
Enter same passphrase again:
IMPORTANT: you will need both KEY AND PASSPHRASE to access this repo!
If you used a repokey mode, the key is stored in the repo, but you should back it up separately.
Use "borg key export" to export the key, optionally in printable format.
Write down the passphrase. Store both at safe place(s).
```
### Create a backup :
```bash
cd /path/to/folder
# local
borg create --progress --stats -C zstd,10 /mnt/data/backup/<repo_name>::20251018 .
# distant
borg create --progress --stats -C zstd,10 ssh://pleb@krabs/mnt/data/backup/<repo_name>::20251018 .
```
### List a backup :
```bash
# local
borg list /mnt/data/backup/<repo_name>::20251018
# distant
borg list ssh://pleb@krabs/mnt/data/backup/<repo_name>::20251018
```
### Verify the backup folder using the command info:
```bash
# local
borg info /mnt/data/backup/<repo_name>::20251018
# distant
borg info ssh://pleb@krabs/mnt/data/backup/<repo_name>::20251018
```
### Restore a backup to a folder :
```bash
# local
borg extract --progress /mnt/data/backup/<repo_name>::20251018 /path/to/folder
# distant
borg extract --progress ssh://pleb@krabs/mnt/data/backup/<repo_name>::20251018 /path/to/folder
```
### Mount a backupr :
```bash
mkdir /var/tmp/<folder_name>
# local
borg mount /mnt/data/backup/<repo_name>::20251018 /var/tmp/<folder_name>
# distant
borg mount ssh://pleb@krabs/mnt/data/backup/<repo_name>::20251018 /var/tmp/<folder_name>
# unmount
borg unmount var/tmp/<folder_name>
```
### Delete a backup :
```bash
# local
borg delete /mnt/data/backup/<repo_name>::20251018
# distant
borg delete ssh://pleb@krabs/mnt/data/backup/<repo_name>::20251018
```
### Freeup space
#### Compact space
```bash
# local
borg compact /mnt/data/backup
# distant
borg compact ssh://pleb@krabs/mnt/data/backup
```
#### Prune and keep lastest 2 backups
```bash
# local
borg prune --keep-last 2 /mnt/data/backup
# distant
borg prune --keep-last 2 ssh://pleb@krabs/mnt/data/backup
```