# Black hole repo?

**URL:** https://forum.syncthing.net/t/black-hole-repo/843
**Category:** Feature
**Created:** [September 3, 2014, 6:50am UTC](https://forum.syncthing.net/t/black-hole-repo/843 "2014-09-03T06:50:35Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![phutidus](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/p/dc4da7/32.png) [@phutidus](https://forum.syncthing.net/u/phutidus)
#### Post date: [September 3, 2014, 6:50am UTC](https://forum.syncthing.net/t/black-hole-repo/843/1 "2014-09-03T06:50:35Z")

</div>

Abstract: This feature can be useful when you just want to store files to a warehouse and don’t want to leave a copy on your working device.

I have setup Syncthing node on two of my devices, one Macbook Pro (Mac OS X installed) and a Banana Pi (Linux installed).

I usually import a bunch of photo from my camera to Mac and do some adjustment, however my Mac has only 80GB of storage, I must move those photos to other place once i finished editing. I use Syncthing to do this job, first I move those edited photo to repo “EditedPhotos” and Syncthing will push them to Banana Pi. Once the photos are synced across two nodes, all files in “EditedPhotos” on Banana Pi is moved to another folder, and “EditedPhotos” on my Mac will be empty after a while, free some space.

The workflow, in short:

1. On Mac: I adjust some photos on my Mac and I won’t use them recently
2. On Mac: I put all of them in repo “EditedPhotos”
3. On Mac: Syncthing push those photos to Banana Pi
4. On Banana Pi: **I manually move those photo from “EditedPhotos” to the final destination of them**
5. On Mac: Syncthing detect the deletion of files and empty “EditedPhotos”
6. On Mac: Mac has space to import new photos

I wish the workflow can be further simplified to:

1. On Mac: I adjust some photos on my Mac and I won’t use them recently
2. On Mac: I put all of them in a repo “EditedPhotos”
3. On Mac: Syncthing push those photos to Banana Pi
4. On Banana Pi: **Since repo “EditedPhotos” is set as a black hole, Syncthing move everything in “EditedPhotos” to another folder (a.k.a. white hole)**
5. On Mac: Syncthing detect the deletion of files and empty “EditedPhotos” on my Mac
6. On Mac: Mac has space to import new photos

I know this feature can be done in various ways, and I’ve implemented one using inotifywait(1) on Linux (posted below). Maybe others want this “black hole repo” option too?

```
#!/bin/bash
# Warning: this script does no error checking, and expects no two files have the same name
# Warning: only files can be put into black hole, folders not handled prperly

BLACK_HOLE="/mnt/hdd2/black_hole"
WHITE_HOLE="/mnt/hdd2/white_hole"

inotifywait -mq --timefmt '%Y/%m/%d %H:%M:%S' --format '%f' -e moved_to "$BLACK_HOLE" | while read file
    do
        mv "$BLACK_HOLE/$file" "$WHITE_HOLE/$file"
        echo "moved $BLACK_HOLE/$file to $WHITE_HOLE/$file"
    done
```

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [September 3, 2014, 7:32am UTC](https://forum.syncthing.net/t/black-hole-repo/843/2 "2014-09-03T07:32:36Z")

</div>

To me this sounds like a very specific use case, and one that your script actually handles fairly well as is? I don’t think syncthing needs to be everything for everyone, as long as it can be used as a brick to build whatever the final use case is.

---

<div class="post-metadata">

### Author: ![phutidus](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/p/dc4da7/32.png) [@phutidus](https://forum.syncthing.net/u/phutidus)
#### Post date: [September 4, 2014, 3:15am UTC](https://forum.syncthing.net/t/black-hole-repo/843/3 "2014-09-04T03:15:37Z")

</div>

Well I agree this is a very specific case and should be done using an external process. I will try to create a separate cross-platform black hole repo implementation using [howeyc/fsnotify](https://github.com/howeyc/fsnotify) and post here when it is done.

---

<div class="post-metadata">

### Author: ![Rnhmjoj](https://forum.syncthing.net/user_avatar/forum.syncthing.net/rnhmjoj/32/138_2.png) [@Rnhmjoj](https://forum.syncthing.net/u/Rnhmjoj)
#### Post date: [September 4, 2014, 4:09pm UTC](https://forum.syncthing.net/t/black-hole-repo/843/4 "2014-09-04T16:09:34Z")

</div>

Can’t you just use ftp or likes? Syncthing is meant to keep folder synced not to send files.

---

<div class="post-metadata">

### Author: ![phutidus](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/p/dc4da7/32.png) [@phutidus](https://forum.syncthing.net/u/phutidus)
#### Post date: [September 5, 2014, 5:28am UTC](https://forum.syncthing.net/t/black-hole-repo/843/5 "2014-09-05T05:28:08Z")

</div>

I do use Syncthing to sync files between my devices, this is a special use case in one of my many repos.

In fact it is doing syncing jobs… – Sync new file from Mac to warehouse -\> Syncing file deletion notification to Mac

SFTP or other solutions is indeed more suitable for this case, but if you can do many things using one tool, why bother setting up another service?

---

<div class="post-metadata">

### Author: ![Rnhmjoj](https://forum.syncthing.net/user_avatar/forum.syncthing.net/rnhmjoj/32/138_2.png) [@Rnhmjoj](https://forum.syncthing.net/u/Rnhmjoj)
#### Post date: [September 5, 2014, 11:04am UTC](https://forum.syncthing.net/t/black-hole-repo/843/6 "2014-09-05T11:04:08Z")

</div>

This is the exact opposite of the unix philosophy. I don’t know what @calmh thinks but in my opinion syncthing already does syncing and versioning adding also this would be too much.

---

<div class="post-metadata">

### Author: ![Alex](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@Alex](https://forum.syncthing.net/u/Alex)
#### Post date: [September 5, 2014, 11:23am UTC](https://forum.syncthing.net/t/black-hole-repo/843/7 "2014-09-05T11:23:40Z")

</div>

this is really a too specific case, the more general suggesting here [Pre and Post process scripting?](https://forum.syncthing.net/t/pre-and-post-process-scripting/847) should make this a one line script when called at “post-sync”, so better only implement that 😉

---

<div class="post-metadata">

### Author: ![bigbear2nd](https://forum.syncthing.net/user_avatar/forum.syncthing.net/bigbear2nd/32/4525_2.png) [@bigbear2nd](https://forum.syncthing.net/u/bigbear2nd)
#### Post date: [September 14, 2014, 2:33pm UTC](https://forum.syncthing.net/t/black-hole-repo/843/8 "2014-09-14T14:33:43Z")

</div>

If you could sync directly to your final destination, i would be easier.

You copy, you sync, you delete, your deletions are not repeated on the Banana Pi.

> <https://github.com/syncthing/syncthing/issues/584>
>
> Hello Everybody.
> I really enjoy seeing this project grow and getting better.
> I would like to request the feature "One way sync". I...

> <https://github.com/syncthing/syncthing/issues/62>
>
> I.e. ones that we never accept updates from, but who can otherwise participate in the exchange as usual. Needs #63 to...

---

<div class="post-metadata">

### Author: ![hobarrera](https://forum.syncthing.net/user_avatar/forum.syncthing.net/hobarrera/32/519_2.png) [@hobarrera](https://forum.syncthing.net/u/hobarrera)
#### Post date: [September 15, 2014, 10:13pm UTC](https://forum.syncthing.net/t/black-hole-repo/843/9 "2014-09-15T22:13:47Z")

</div>

> [@Rnhmjoj](#):
>
> Can’t you just use ftp or likes?

Ugh, please, **NO** , ftp is [obsolete since 1999](https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol), not only because it’s totally insecure, but because it’s algo very poorly designed and quite complicated to handle behind NATs/firewalls/etc.

This particular case can be perfectly handled by an rsync script anyway, which is perfectly portable to any system. Just rsync the files to destination, and delete the local copy afterwards. You can have it scan the directory for files every N minutes and have a .lock file to avoid multiple instances if you want to cron this.

---

<div class="post-metadata">

### Author: ![Rnhmjoj](https://forum.syncthing.net/user_avatar/forum.syncthing.net/rnhmjoj/32/138_2.png) [@Rnhmjoj](https://forum.syncthing.net/u/Rnhmjoj)
#### Post date: [September 15, 2014, 10:30pm UTC](https://forum.syncthing.net/t/black-hole-repo/843/10 "2014-09-15T22:30:54Z")

</div>

With “ftp **or likes** ” I meant protocols that transfer files: sftp, scp, webdav, whatever you want. I think no one sane use ftp.

---

<div class="post-metadata">

### Author: ![phutidus](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/p/dc4da7/32.png) [@phutidus](https://forum.syncthing.net/u/phutidus)
#### Post date: [September 16, 2014, 1:52am UTC](https://forum.syncthing.net/t/black-hole-repo/843/12 "2014-09-16T01:52:19Z")

</div>

> [@bigbear2nd](#):
>
> You copy, you sync, you delete, your deletions are not repeated on the Banana Pi.
> 
> [One way sync · Issue #584 · syncthing/syncthing · GitHub](https://github.com/syncthing/syncthing/issues/584)[Non-source / read only / untrusted / backup devices · Issue #62 · syncthing/syncthing · GitHub](https://github.com/syncthing/syncthing/issues/62)

Wow, really? but to my observation, everything worked as expected in the last 2 weeks.

---

<div class="post-metadata">

### Author: ![bigbear2nd](https://forum.syncthing.net/user_avatar/forum.syncthing.net/bigbear2nd/32/4525_2.png) [@bigbear2nd](https://forum.syncthing.net/u/bigbear2nd)
#### Post date: [September 16, 2014, 2:04am UTC](https://forum.syncthing.net/t/black-hole-repo/843/13 "2014-09-16T02:04:50Z")

</div>

> [@phutidus](#):
>
> Wow, really? but to my observation, everything worked as expected in the last 2 weeks.

Yes, the above mentioned behavior is a planned feature, not a bug.

---

<div class="post-metadata">

### Author: ![system](https://forum-uploads.syncthingcdn.net/original/2X/0/0b50e0a202b22ae6a67190759e8c868805b8ed9f.png) [@system](https://forum.syncthing.net/u/system)
#### Post date: [May 12, 2017, 1:19pm UTC](https://forum.syncthing.net/t/black-hole-repo/843/14 "2017-05-12T13:19:15Z")

</div>


