automatic backup of mounted hdd when another one is connected

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
illballer
Posts: 3
Joined: Wed Oct 21, 2020 5:16 pm

automatic backup of mounted hdd when another one is connected

Post by illballer »

Hi there,

I just discovered DietPi a few weeks ago and used this as an opportunity to learn some things about NAS / Cloud / Router Setups. It is really a great jumping off point for non-experts like me and the amount of work and skill put into it really shows. Thanks for that.

On Topic:

The Idea was to use a Raspberry 4 /4GB to replace my old Router, Synology NAS (mainly data storage + Plex) and to add Pihole to my Network.

So far, I was able to realize most of the things described above. One thing I am struggling with is the NAS part.

I have one 4 TB HDD (Seagate 2,5") attached to the USB 3.0 Port. Let´s call this one DRIVE A. I mounted it and use Samba Share to make it discover-able for the Clients in my Network (works).

Now I want to use a second DRIVE B, identical to DRIVE A to backup / sync the contents of DRIVE A, as soon as the Drive is physically connected to the Raspberry´s 2nd USB 3.0 port and to un-mount / spin down DRIVE B as soon as the job is finished.

I am looking for some guidance of how to archive the task above.

On a side note -

hdparam did not spin down the attached Seagate DRIVE A so I installed hd-idle via this tutorial which works fine.

Thanks for your tips and stay safe :)
User avatar
Joulinar
Posts: 2572
Joined: Sat Nov 16, 2019 12:49 am

Re: automatic backup of mounted hdd when another one is connected

Post by Joulinar »

Hi,

many thanks for your message. There isn't such function build into DietPi. However you could have a look to the following guide.

https://www.tecmint.com/auto-backup-fil ... -in-linux/
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
illballer
Posts: 3
Joined: Wed Oct 21, 2020 5:16 pm

Re: automatic backup of mounted hdd when another one is connected

Post by illballer »

Thank you for the link I will read into it!
illballer
Posts: 3
Joined: Wed Oct 21, 2020 5:16 pm

Re: automatic backup of mounted hdd when another one is connected

Post by illballer »

Joulinar wrote: Wed Oct 21, 2020 8:20 pm Hi,

many thanks for your message. There isn't such function build into DietPi. However you could have a look to the following guide.

https://www.tecmint.com/auto-backup-fil ... -in-linux/
Hi again,

I tried to follow the guide - unfortunately with no luck . When I connect the Backup Drive B, nothing happens.

Also I am not sure if I mounted the Drives correctly which might contribute to the guide not working.

Currently dietpi-drive_manager is configured as following:

Drive A: = Main Drive ext4
/dev/sda1/
/mnt/NAS/

Drive B: = Backup Drive ntfs - connecting this drive to USB should trigger automatic mounting, backup and unmount
/dev/sdb2/
/mnt/BACKUP/

I noticed, that when i umount Drive B it, disconnect it, and then re-connect it I manually have to mount it again and instead of /BACKUP it suggests the drives UUID as Mounting point.
Post Reply