borgbackup / borgbackup/borg

[Feature Request] Add layers option/notation to `extract`, `mount` and `export-tar`

Open
#5,425 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
13.7k
Forks
875
Avg merge
11h 15m
Merged PRs (30d)
192

Description

## What?

Add layers option/notation to `extract`, `mount` and `export-tar`.

## Why?

Use case: #5413

Extracting a complete borg archive might sometimes be impossible due to space restrictions (and can take forever). Additionally, updating an existing borg archive by partitioning the repository manually (different archives for different source folders) can be a problem as well. These manually crafted partitions can also grow to unmanageable size and in the end, one needs a management of these as well.

## How?

Layering multiple archives can be done by using some external tools like overlayfs but can be cumbersome after doing many partial backups over years.

The idea is to enable the export commands (`extract`, `mount` and `export-tar`) to be able to stack different archives in the order of their creation date.

```bash
# archive all the pictures, documents and movies
borg create --list /path/to/repo::myfirst ~/pictures/ ~/documents ~/movies
```

```bash
# after a year, backup 2020 pictures
borg create --list /path/to/repo::mysecond ~/pictures/2020-*
```

```bash
# after a seconds year, we need some of the stuff back
borg mount /path/to/repo::myfirst::mysecond /mnt/point/
```

## Details for mount

Idea: create multiple overlayfs mount points for each additional archive.

Example: 4 archives (a1, a2, a3, a4) in a repository (/path/to/repo):

```
borg mount /path/to/repo::a1::a2::a3::a4 /mnt/point/
```

or

```
borg mount /path/to/repo::a* /mnt/point/
```

Steps (or all at once if supported by the layering library):
1) mount overlayfs for a1 and a2 -> o1
2) mount overlayfs for o1 and a3 -> o2
3) mount overlayfs for o2 and a3 -> /mnt/point/

## Details for umount

```
borg umount /mnt/point/
```

Dismantles the layers in reverse order of creation.

## Impact

- parsing of command line arguments
- need for some layering tech

## Alternative via option `--layers`

```
borg mount --layers a1::a2::a3::a4 /path/to/repo /mnt/point/
```

or

```
borg mount --layers a* /path/to/repo /mnt/point/
```

## Bonus: specifying the order of the layers

Order usually should be by creation date of the respective archives. If needed, one could add another option `--layer-order` using the `::` separation syntax to specify order for specific archives.

## Remark

overlayfs is just a placeholder. Plug in your favorite layering fs here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.