this post was submitted on 29 Jul 2023
23 points (87.1% liked)

Selfhosted

39435 readers
6 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

I'm looking for a linux program that can mirror a directory to another drive and move a subdirectory in the mirror.

all 16 comments
sorted by: hot top controversial new old
[–] [email protected] 10 points 1 year ago

Perhaps git would work?

[–] [email protected] 8 points 1 year ago

Syncthing is also an option.

[–] [email protected] 5 points 1 year ago

But rsync can do this fine with --recursive --delete. The mirror will remain an exact replica.

[–] [email protected] 5 points 1 year ago (1 children)

lsyncd does just this. It's intended use is to sync directories between systems over slow(ish) uplink, but it can work locally as well. It takes some fiddling to set up, but once set up it just does it's thing seamlessly at the background. However if you're just looking for a backup solution I'd might look for something else, like a plain rsync script.

[–] [email protected] 3 points 1 year ago

This is the best answer. I use it regularly to keep hundreds of TB in sync across nodes. Works extremely well and is pretty much hands off once setup.

[–] [email protected] 4 points 1 year ago* (last edited 1 year ago)

I found an answer on StackExchange that refers to a tool called rsync-sidekick which looks like it could achieve your aims.

Edit: There is also another answer on that same StackExchange page referring to a script called rsync-prepare which is capable of working with a remote destination.

[–] [email protected] 2 points 1 year ago

Why not exclude the folder you want to move from the initial sync, and sync that folder separately to the final location?

[–] [email protected] 2 points 1 year ago

borg does this

[–] [email protected] 2 points 1 year ago (1 children)

Why not maintain a soft or hard link?

[–] [email protected] 1 points 1 year ago (1 children)

I am trying to create a crontab to backup multiple directory in which files change their location, but I don't know if links would solve it

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

You can also have rsync exclude specific files, so you could sync the main dir first, then the special subdir specifically

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

I use RealTimeSync.

It just... Works. I love it. It's free.

There are plenty of features that could effectively let you do what you want.

Mine is set to sync my server with a backup whenever my main PC is idle for 20 mins. Once it determines how to sync, it lets me review before syncing.

[–] [email protected] 1 points 1 year ago

Restic, kopia, and Borg are all pretty good backup tools with deduplication built in, so they might be a good option if you're doing this for backup purposes?

[–] [email protected] 1 points 1 year ago

As long as the backup system performs deduplication, it should be able to store the backup data efficiently even if the source files are constantly moved around or renamed.

ZFS snapshots can perform deduplication. There is also ZBackup, which also has deduplication support.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

rclone sync might be a acceptable?

It doesn't move files from one dir to another but it would delete the old directory and recopy to the new directory.

I think rsync has the same functionality but could be wrong