{"id":13844881,"url":"https://github.com/aktos-io/dcs-tools","last_synced_at":"2026-04-04T11:30:21.182Z","repository":{"id":65542005,"uuid":"39864414","full_name":"aktos-io/dcs-tools","owner":"aktos-io","description":"Tools for making remote Linux node management easy","archived":false,"fork":false,"pushed_at":"2023-02-01T12:44:22.000Z","size":161,"stargazers_count":43,"open_issues_count":5,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-05T17:43:09.344Z","etag":null,"topics":["backup","btrfs","remote-admin-tool"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aktos-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-29T00:26:06.000Z","updated_at":"2023-09-28T10:29:47.000Z","dependencies_parsed_at":"2023-02-15T15:31:27.833Z","dependency_job_id":null,"html_url":"https://github.com/aktos-io/dcs-tools","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aktos-io%2Fdcs-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aktos-io%2Fdcs-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aktos-io%2Fdcs-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aktos-io%2Fdcs-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aktos-io","download_url":"https://codeload.github.com/aktos-io/dcs-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225772790,"owners_count":17521889,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","btrfs","remote-admin-tool"],"created_at":"2024-08-04T17:03:01.107Z","updated_at":"2026-04-04T11:30:21.102Z","avatar_url":"https://github.com/aktos-io.png","language":"Shell","funding_links":[],"categories":["Shell (473)","Shell"],"sub_categories":[],"readme":"# Description\n\nThis toolset is intended for administrating remote Linux devices that are directly connected or behind a proxy server (RaspberryPi in mind, but any remote Linux system will work), by simplifying 7 tasks:\n\n1. `make ssh` to connect the remote shell (either directly or over a link up server).\n2. Responsively edit remote files via local IDE almost independent from the internet connection speed and interruptions (\"Responsive remote development\").\n3. Use simple drag and drop style file transfers (by `sshfs`).\n4. Backup the target's entire root filesystem (by `rsync`).\n5. Create fast and efficient **differential full backups** (by hardlinks or by BTRFS snapshots).\n6. Create a separate physical bootable system disk from any of your backups.\n7. Clone the current device with a new identity to create a new device.\n\n\n# Install\n\n### Requirements\n\n* Linux OS\n* `git` (for submodule fetching and `make update`)\n* `rsync`\n* `sshfs`\n\n### Setup\n\nFollow these steps for every project:\n\n\t# on your host (eg. your laptop)\n\tmkdir your-project\n\tcd your-project\n\tgit clone --recursive https://github.com/aktos-io/dcs-tools\n\n### Configuration\n\nAssuming you are in `/path/to/your-project` folder already,\n\n1. Create your configuration file and mandatory folders/flags:\n\n       ./dcs-tools/setup\n\n2. *(Optional)*: Send your RSA public key to the target in order to prevent asking password on every connection:\n\n       ./dcs-tools/make-target-settings  \n\n# Usage\n\n### Set connection type\n\n*either connect to your target by its direct IP address and port:*\n```bash\nmake conn-direct\n```\n*or  meet with your target on a link up server* (see [link-with-server](https://github.com/aktos-io/link-with-server))\n```bash\nmake conn-over-proxy\n```\n\nSee [doc/configuration.md](./doc/configuration.md) for explanations.\n\n### Make ssh\n\n```bash\nmake ssh\n```\n\nMakes ssh connection either directly or via the link up server according to [your connection type](#set-connection-type).\n\n### Responsive Remote Development\n\nResponsive remote development means keeping a local folder in sync with a remote folder. \n\n1. `cp ./sync-config-example.sh path/to/your/project/folder/my-sync-config.sh`\n2. Edit `my-sync-config.sh` accordingly. See `./sync-with-sgw.sh --help` for options.\n3. Send your project folder to your remote system and watch for changes by: \n\n\t    ./sync-with-sgw.sh -c path/to/your/project/folder/my-sync-config.sh --dry-run\n\nThis will keep `path/to/your/project/folder/` and `$dest_dir` (within your config file) in sync. Remove the `--dry-run` switch for real transfer if the transfer summary is as you expected. \n\nSynchronization will exclude the `.git` folder and the other files/folders listed in `path/to/your/project/folder/.gitignore`.\n\n`run_before_sync` hooks can be used to build, bundle, copy files or perfom any other tasks before the actual synchronization. Synchronization will fail and display a visual error message if any of the hooks fails. \n\n### Mount target root\n\n```bash\nmake mount-root\n```\nMounts the root folder to `your-project/NODE_ROOT`, which you can use for drag-n-drop style file transfers.\n\nYou can later unmount with `make umount-root` without using `sudo` command. \n\nThis feature is only practical with fast (generally on local) connections.\n\n### Sync target's root folder\n\n```bash\nmake sync-root\n```\n\nSync whole root partition of the target with `your-project/sync-root` folder. You can use this command consecutively to keep your `sync-root` folder up to date as much as possible. Only differentiating data will be transmitted (if any).\n\nThis command will only copy the current state of your target to your host machine. You will need to create your backups manually, with `make backup-sync-root` command\n\n### Create backups       \n\n```bash\nmake backup-sync-root\n```\n\nCreate a backup from the `sync-root` folder into `./backups` folder either by hardlinks method or by creating a btrfs subvolume, according to your `your-project/method-*` flag.\n\n\u003e `method-*` flags can be set by `make method-btrfs` or `make method-hardlinks` commands.\n\n\n### UDP port forwarding \n\n\u003e Taken from https://superuser.com/a/974091/187576\n\nExample connection: \n\n```\n[PLC 192.168.250.9 UDP/9600] \u003c--\u003e [Scada-Gateway (sgw)] \u003c--\u003e [Rendezvous server] \u003c--\u003e [Laptop] \u003c--\u003e [Virtual machine]\n```\n\n1. Assign the same IP of the PLC to your laptop: \n\n\t\tsudo ip a add 192.168.250.9/24 dev wlp2s0\n\n2. In terminal 1 on your laptop:\n\n\t\tlaptop$ cd your/project\n\t\tlaptop$ make ssh ARGS=\"-L 9602:localhost:9602\"\n\t\tsgw$ socat -T10 TCP4-LISTEN:9602,fork UDP4:192.168.250.9:9600\n\n3. In terminal 2 on your laptop: \n\n\t\tlaptop$ sudo socat UDP4-LISTEN:9600,fork TCP4:localhost:9602\n\n4. In your virtual machine's network settings -\u003e Bridged adapter -\u003e wlp2s0\n\n\nResult: Your virtual machine will not detect any difference and will connect the target PLC as if it is connected directly.\n\n\n## Advanced actions:\n\nFollowing tools are for advanced usage, use them **with extreme caution**.\n\n\n### Produce bootable disk from a backup\n\n```bash\n./dcs-tools/produce-bootable-disk [--help]   \n```\n\nProduces a bootable disk that is capable of booting your target hardware.\n\n\n### Restore files from a backup to physical disk\n\n```bash\n./dcs-tools/restore-from-backup [--help]\n```     \nRestores all files from backup folder to the SD card. Useful when you want to\nupdate your physical backup disk with your latest sync folder.\n\n### Give New ID\n\nMake appropriate changes to give new identity to an installation. Useful for creating\na new controller/machine based on current installation.\n\n```bash\n./dcs-tools/give-new-id [--help]\n```\n\n### See Also\n\n* [Recipes](./doc/recipes.md)\n\n* [Helper methods](./doc/tips-and-tricks.md)\n\n\n# Advantages\nBackups have following properties:\n\n* **portable** (you can move your copies around. eg: take first backup locally, remove disk, mound on another computer, `make backup-root` again)\n* **differential** (only differences are transmitted)\n* **dead simple copies** of original files (you can simply copy/paste when you need to restore or move your files around) **(see BIG WARNING)**\n* **versioned** : Take any number of full backups as much as you like. You are responsible for deleting old backups.\n* **efficient storage usage** (if you backup your 10 GB root for 5 times, you end up using 10.2 GB disk space if you have no modified files. But you will see the `snapshots` folder has a size of 50 GB. (Magic? No: Hardlinks or BTRFS subvolumes)\n\n# BIG WARNING\n\n### Move your backups around carefully\n\nIf you are not using **btrfs**, \"dead simple copies\" feature has a problem by its design: As backups are just plain folders, this may lead breaking (unintentionally changing) the ownership of the files if you move/copy your files carelessly (eg. if you `mv your/snapshot to/another/location` and then interrupt the command in the middle, you will probably end up with moved files having `root:root` permissions.) That's why you **SHOULD always use `rsync`** for such movements.\n\n\u003e If you are using `--method btrfs`, backups are made as readonly snapshots, so you will not have such problems.\n\n### Use correct filesystem\n\nMake sure that you are performing `make sync-root` command on a native Linux\nfilesystem. You will end up having a backup with wrong file ownership and/or\npermissions otherwise.\n\n### Hardlinks are not always safe \n\nHardlinks are simply pointers to a file in the filesystem. If you delete or overwrite a file, your hardlinks (thus your backups) are safe. However, if you open a file and change the contents, all hardlinks point to this new data. So your backups (your previous data) are instantly broken. If you don't use BTRFS-method, you should always update your files by overwriting, not updating their contents. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faktos-io%2Fdcs-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faktos-io%2Fdcs-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faktos-io%2Fdcs-tools/lists"}