# Change the base directory of a backup?

**URL:** https://forum.duplicati.com/t/change-the-base-directory-of-a-backup/9069
**Category:** Features
**Created:** [February 4, 2020, 5:41am UTC](https://forum.duplicati.com/t/change-the-base-directory-of-a-backup/9069 "2020-02-04T05:41:49Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![drivetourist](https://forum.duplicati.com/letter_avatar_proxy/v4/letter/d/ccd318/32.png) [@drivetourist](https://forum.duplicati.com/u/drivetourist)
#### Post date: [February 4, 2020, 5:41am UTC](https://forum.duplicati.com/t/change-the-base-directory-of-a-backup/9069/1 "2020-02-04T05:41:50Z")

</div>

I’m using Duplicati to back up data stored in ZFS. ZFS has a snapshot feature where you can atomically save the state of the filesystem, then find it in `/<pool>/.zfs/snapshot/<snapshot name>`. Is there a way to tell Duplicati to back up a directory like `/tank/.zfs/snapshot/2020-02-03`, but rewrite the paths to `/tank` when checking for changes in the db and saving?

Also, Duplicati works impressively well under Mono. I was expecting to be fighting with it, but it was as easy as `mono <duplicati path>/Duplicati.CommandLine.exe`, so cheers!

---

<div class="post-metadata">

### Author: ![drwtsn32](https://forum.duplicati.com/user_avatar/forum.duplicati.com/drwtsn32/32/2591_2.png) [@drwtsn32](https://forum.duplicati.com/u/drwtsn32)
#### Post date: [February 4, 2020, 6:15am UTC](https://forum.duplicati.com/t/change-the-base-directory-of-a-backup/9069/2 "2020-02-04T06:15:14Z")

</div>

I don’t think that’s possible, but others have expressed interest in adding ZFS snapshot support to Duplicati.

Here is an improvement filed on Github: [ZFS Periodic Snapshot integration · Issue #3862 · duplicati/duplicati · GitHub](https://github.com/duplicati/duplicati/issues/3862)

And there are some threads in this forum where it’s been discussed before, such as this one: [Any plans to support snapshots on the modern Filesystems (ZFS et. al)?](https://forum.duplicati.com/t/any-plans-to-support-snapshots-on-the-modern-filesystems-zfs-et-al/1006)

---

<div class="post-metadata">

### Author: ![ts678](https://forum.duplicati.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@ts678](https://forum.duplicati.com/u/ts678)
#### Post date: [February 4, 2020, 10:52pm UTC](https://forum.duplicati.com/t/change-the-base-directory-of-a-backup/9069/3 "2020-02-04T22:52:06Z")

</div>

> [@drivetourist](#):
>
> rewrite the paths to `/tank` when checking for changes in the db and saving?

Do you mean changes in the source file snapshot? The files are walked and file path is file path.  
There is pathname trickery possible with symbolic links, bind mounts, and similar, but be careful.

For mono, there are also some wrappers such as /usr/bin/duplicati-cli. Not everything has one…  
Some systems will also know to run mono when they see a mono .exe. My Linux Mint does that.

---

<div class="post-metadata">

### Author: ![drivetourist](https://forum.duplicati.com/letter_avatar_proxy/v4/letter/d/ccd318/32.png) [@drivetourist](https://forum.duplicati.com/u/drivetourist)
#### Post date: [February 6, 2020, 5:04am UTC](https://forum.duplicati.com/t/change-the-base-directory-of-a-backup/9069/4 "2020-02-06T05:04:04Z")

</div>

> others have expressed interest in adding ZFS snapshot support to Duplicati.

I actually _don’t_ like the idea of ZFS integration because it would be pretty specific to ZFS, and if you really want a backup solution tailored to ZFS, you’re better off writing one from the ground up or sending snapshots.

> Do you mean changes in the source file snapshot?

Not quite. Backup tools can have issues with locked files or files that are changed mid-backup. ZFS snapshots _look_ like the full filesystem, just frozen at the time the snapshot was taken and in a different root directory.

You could definitely do some bind mount or chroot trickery, but this feature would just be a string replace on the file path before it’s uploaded or written to the DB. Now, that doesn’t mean it’s easy to add…

---

<div class="post-metadata">

### Author: ![kenkendk](https://forum.duplicati.com/user_avatar/forum.duplicati.com/kenkendk/32/5305_2.png) [@kenkendk](https://forum.duplicati.com/u/kenkendk)
#### Post date: [February 6, 2020, 9:51am UTC](https://forum.duplicati.com/t/change-the-base-directory-of-a-backup/9069/5 "2020-02-06T09:51:36Z")

</div>

> [@drivetourist](#):
>
> Is there a way to tell Duplicati to back up a directory like `/tank/.zfs/snapshot/2020-02-03` , but rewrite the paths to `/tank` when checking for changes in the db and saving?

There is no support for this currently. As @ts678 mentions this can be done with bind mounts. Something like this for each backup:

```plaintext
mkdir /tankbind
mount -bind /tank/.zfs/snapshot/2020-02-03 /tankbind
duplicati-cli backup ...dest... /tankbind
umount /tankbind
rmdir /tankbind

```

The only difference between using the full path will be that Duplicati will be able to re-use the metadata from the previous paths, such that it does not need to re-hash the file to see if it has any changes.

> [@drivetourist](#):
>
> You could definitely do some bind mount or chroot trickery, but this feature would just be a string replace on the file path before it’s uploaded or written to the DB. Now, that doesn’t mean it’s easy to add…

It would be fairly easy to add (I think) but it is a wormhole of options and trouble to allow users to define a list of rewrite rules. Do you have an idea for how you would like to specify the rewrite rule on the commandline?

---

<div class="post-metadata">

### Author: ![drivetourist](https://forum.duplicati.com/letter_avatar_proxy/v4/letter/d/ccd318/32.png) [@drivetourist](https://forum.duplicati.com/u/drivetourist)
#### Post date: [February 8, 2020, 8:57pm UTC](https://forum.duplicati.com/t/change-the-base-directory-of-a-backup/9069/6 "2020-02-08T20:57:05Z")

</div>

> [@kenkendk](#):
>
> Do you have an idea for how you would like to specify the rewrite rule on the commandline?

What about `--base-path` or `--root-path`, and all specified root paths are relative to it?
