> cmd0 borg create --progress /path/to/your/repository::archive-name-$(date +%Y-%m-%d_%H-%M-%S) /path/to/files/to/backup borg prune --prefix 'archive-name-' --keep-last 3 /path/to/your/repository > in cmd0 I create an archive and keep last 3. Show command to extract last archive created by cmd0

borg backup extract last archive command keep last 3 archives

Focused on the specific action of extracting the last archive from a Borg backup and included relevant keywords to improve the precision of the search results.

To extract the last archive created by your borg create command, which maintains the last three archives due to the borg prune command, you can follow these steps. The borg extract command allows you to specify the exact archive you want to restore.

Steps to Extract the Last Archive

  1. Identify the Archive Name: Since you used a dynamic naming system based on the date and time of creation (e.g., archive-name-YYYY-MM-DD_HH-MM-SS), you'll need to locate the latest archive in your repository.

  2. Extract the Latest Archive: You can accomplish this by leveraging the borg list command to find the name of the most recent archive and then use borg extract to extract its contents.

Example Commands

  1. List the Archives: First, you should list the archives in your repository to identify the most recent one.

    borg list /path/to/your/repository
    

    This will output a list of your archives. Look for the one with the most recent timestamp.

  2. Extract the Most Recent Archive: Once you've identified the latest archive, you can extract it using the following command:

    borg extract /path/to/your/repository::archive-name-2025-10-01_11-20-30
    

    Replace archive-name-2025-10-01_11-20-30 with the actual name of the latest archive you found in the previous step.

Automating the Extraction

If you wish to automate the extraction process to avoid manually checking the list, you can use a command to extract the last archive directly:

borg extract /path/to/your/repository::$(borg list /path/to/your/repository | tail -n 1)

This command utilizes borg list and pipes the output to tail to grab the last entry, which corresponds to the latest archive based on your pruning strategy.

Summary

To summarize, you can find and extract the most recent Borg archive using the borg list and borg extract commands. The automation option allows for a seamless extraction process without having to manually verify the latest archive name. Make sure to adjust the paths as per your configuration and always refer to the Borg documentation for any additional options or considerations.

People Also Ask

Related Searches

Sources

10
1
borg prune — Borg - Deduplicating Archiver 1.4.1 documentation
Borgbackup

The --keep-last N option is doing the same as --keep-secondly N (and it will keep the last N archives under the assumption that you do not create more than one ...

2
borg extract — Borg - Deduplicating Archiver 1.4.1 documentation
Borgbackup

This command extracts the contents of an archive. By default the entire archive is extracted but a subset of files and directories can be selected by passing a ...

3
Extract only difference of latest backup : r/BorgBackup - Reddit
Reddit

I think the best bet would be borg mount and then rsync if the number of files to be updated is very small.

4
Borg backup - ArchWiki
Wiki

To keep only the last 7 daily archives, the last four weekly archives, and the last three monthly archives: ... $ borg prune --keep-last=10 /path/ ...

5
View topic - Borg Backup Cron Script - Gentoo Forums
Forums

I just wanted the ability to say, "make a new backup, then keep the last three backups (regardless of age), then prune the rest and compact the ...

6
How to extract a backup - torsion.org projects
Torsion

The first step is to figure out which archive to extract. A good way to do that is to use the repo-list action.

7
Borg prune deletes new archive - Stack Overflow
Stack Overflow

You told borg prune to keep the latest backup for 7 days. As the redmine backup is newer (later) than the other one, it keeps that for that ...

8
Borg Backup: an introduction - Luca Ferrari
Fluca1978

borg allows you to prune old backups according to a retention time policy: you can specify how many sets to keep for month, day, hour or even ...

9
Backup And Restore Files Using Borg In Linux - OSTechNix
Ostechnix

This tutorial explains what is BorgBackup and how to backup and restore files using Borg in Linux and Unix-like systems.

10
borg: BorgBackup is a deduplicating backup program with optional ...
Mankier

# Extract entire archive $ borg extract /path/to ... For example, --keep-within 2d means to keep all archives that were created within the past 48 hours.