automatic backup of mounted hdd when another one is connected

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 :slight_smile:


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

Thank you for the link I will read into it!

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

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

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.

Hi, Joulinar I want to add second 3TB HDD to my Dietpi serwer [Rpi4+HDD 3,5", 3TB connected with USB]. I’m also looking for solution to auto backup my whole data from first HDD. I never use RAID or other things like that. Can You tell me what is the best way? Does my Rpi4 handle two HDD’s [2x3TB, 3,5", USB with external power supply]?

yes your RPi is able to handle both HDD as separate volumes. If you like to do regular backps from HDD1 to HDD2, you could have a look to DietPi-Sync.

Joulinar Thanks I will do that.