To have that script that sync periodically your hard drives:
sudo su
(login as root)- copy the project under
/usr/local/bin
- install the project
cd /usr/local/bin/syncExtHdd
python3.10 -m pip install poetry
poetry install
- Copy the file
disks_to_sync.template.json
todisks_to_sync.json
and edit it to put the uuid of your disks- to get the uuid of your disks, once you have plugged them, run
lsblk -f
and look at the UUID column
- to get the uuid of your disks, once you have plugged them, run
- test:
poetry run psync -cfg /usr/local/bin/syncExtHdd/disks_to_sync.json
- If everything is ok, you should see something like:
Synced disk: myDiskLabel (xxxxeeee-xxxx-xxxx-xxxx-xxxxffffeeee)
cd /etc/systemd/system/
ln -s /usr/local/bin/syncExtHdd/systemd.service/sync_ext_hdd.service
systemctl enable sync_ext_hdd
for automatic start at bootsystemctl start sync_ext_hdd
to start it nowjournalctl -u sync_ext_hdd -f
to see the logs (after 2 minutes)
To have that script that sync your hard drives when you suspend or hibernate your computer:
sudo su
(login as root)- copy the project under
/usr/local/bin
(if not already done) - copy the script
sync_before_sleep.sh
under/usr/lib/systemd/system-sleep/
chmod +x /usr/lib/systemd/system-sleep/sync_before_sleep.sh