borg extract. can it extract just a file from the archive?

BorgBackup extract specific file from archive 2025

Specified 'BorgBackup' for clarity, included 'specific file' for focused results, and added the year for the most current information.

BorgBackup is a powerful deduplicating archiver that allows users to efficiently back up and restore data. When it comes to extracting files from an archive, Borg provides flexibility, enabling you to extract not just entire archives, but also specific files or directories. Here’s a comprehensive overview of how you can accomplish this.

Extracting Specific Files with BorgBackup

Overview of the borg extract Command

The borg extract command is the primary method for retrieving data from a Borg archive. By default, this command will extract all contents within the specified archive, but it also supports targeted extractions. This means you can specify certain files or directories that you wish to recover.

Syntax for Extracting Specific Files

To extract a specific file or folder, you can use the following command format:

borg extract /path/to/repository::archive-name path/to/file
  • /path/to/repository: This is the location of your Borg backup repository.
  • archive-name: The name of the archive from which you want to extract files.
  • path/to/file: The specific file or directory that you want to extract.

Detailed Steps

  1. Identify the Archive: Determine the archive name you want to extract from. You can list archives stored in your repository with borg list /path/to/repository.

  2. Use the Extract Command: To extract just a specific file from the archive, you would execute a command like:

    borg extract /path/to/repository::archive-name /path/to/specific/file
    

    This will extract only the selected file, leaving the rest of the archive intact.

  3. Dry Run Option: It is often useful to perform a dry run first. You can do this by adding the --dry-run flag, which will show you what would be extracted without actually performing the extraction:

    borg extract --dry-run /path/to/repository::archive-name /path/to/specific/file
    

Example Usage

If you have an archive named backup-2025-08-01 and you want to extract a file located at documents/report.txt, you would use:

borg extract /path/to/repository::backup-2025-08-01 documents/report.txt

Additional Options

Borg also offers a variety of other options that can enhance your extraction process:

  • --list: Lists the contents of the archive(s) as part of the extraction process.
  • --dry-run: Displays which files would be extracted without performing the action.
  • -v: Provides verbose output for better visibility into what the command is processing.

Conclusion

BorgBackup provides a robust way to extract individual files from your backups, saving time and storage space by allowing you to avoid unnecessary data restoration. By using the commands specified above, you can quickly retrieve the files you need from your archives. If you're interested in more detailed commands or options, you can refer to the official BorgBackup documentation for further guidance.

Related Searches

Sources

10
1
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 ...

2
Feature Request: Extract single file with unkown archive location
GitHub

Is there a way to find this file in the repository, other than looking into each archive manually? If not I suggest the following: borg extract ...

3
extract only data in current archive : r/BorgBackup - Reddit
Reddit

Can it be done, so that data in archive b_2024-09-16 is added to the extracted directory, but b_2024-09-09 is not? /storage/data is multiple ...

4
borg-extract(1) — borgbackup — Debian testing
Manpages

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 ...

5
Quick Start — Borg - Deduplicating Archiver 2.0.0b20.dev7 ...
Borgbackup

One can later extract or mount an archive to restore from a backup. Repositories are filesystem directories acting as self-contained stores of archives.

6
How to restore borg backups? - Andrey Albershtein
Alberand

To restore specific files or directories: copy borg extract /path/to/repository::archive-name path/to/file path/to/directory. For extracting ...

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

$ borg extract --dry-run -v --list backup/::25-11-2021. You can extract a particular directory from the archive by passing the directory name.

8
Get all specific files from all Backups · Issue #4841 · borgbackup/borg
GitHub

Get all specific files from all Backups #4841 · Have you checked borgbackup docs, FAQ, and open Github issues? Yes · Is this a BUG / ISSUE report ...

9
Running a borg extract remotely - Unix & Linux Stack Exchange
Unix

Being able to perform a borg check remotely requires 1) that you can run commands on the remote server and 2) that borg is installed on the remote server.

10
Have you pointed borgbackup or similar at it? i.e. extract the archive ...
News

Have you pointed borgbackup or similar at it? i.e. extract the archive to a specific directory, let borg create an archive of it, and then a ...