Cold storage automatic replication

erie_1

Cadet
Joined
Jun 15, 2023
Messages
4
I have a truenas scale system with data and backup datasets on a mirrored pool. And I also have a spare hdd and a 5.25" hotswap Bay in the front of my chassis. I would like to occasionally make a backup(replication) of the data/backup pool to the spar hdd as cold storage.
I'm looking for a way where I can plug in the hdd into the hotswap bay and the system would automagically execute the replication task without me having to go into the Web interface and executing it manually, how would I go about doing this?
 

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
At present, TrueNAS does not support this functionality. And it will likely not be added any time soon. iXsystems customers are Enterprise with different methods for backups.

I do something similar, though entirely manual. It is documented here;
This is not intended to be a plug and play solution for others. Simply as a starting point for their own solution.

Too many people have specific requirements that a more general purpose solution to what I do, and you want, would take far too much of my time to develop. Using the command line to launch the backup is trivial for me.


All that said, you could try this;
- Plug in backup disk
- Import backup pool
- Replicate to backup pool
- Export backup pool
- Remove backup disk
That should all be doable from the GUI, though obviously not a single step. Nor automatic.
 

erie_1

Cadet
Joined
Jun 15, 2023
Messages
4
At present, TrueNAS does not support this functionality. And it will likely not be added any time soon. iXsystems customers are Enterprise with different methods for backups.

I do something similar, though entirely manual. It is documented here;
This is not intended to be a plug and play solution for others. Simply as a starting point for their own solution.

Too many people have specific requirements that a more general purpose solution to what I do, and you want, would take far too much of my time to develop. Using the command line to launch the backup is trivial for me.


All that said, you could try this;
- Plug in backup disk
- Import backup pool
- Replicate to backup pool
- Export backup pool
- Remove backup disk
That should all be doable from the GUI, though obviously not a single step. Nor automatic.
I can imagine this can be done with a script that runs when a disk is inserted? Wirh something like a cron job(or something similar) are scripts supported/recommended for these kinds of jobs? How would i go about this?
 

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
Yes, you can script it.

Unless you have programing experience with expected behavior and fault tolerance, croning a task like this can be mildly dangerous. My point is that if you insert the disk and it does what you want, but you fail to remove the disk in the required time frame, another backup might kick off. This would then prevent you from removing the disk. Or worse, you remove an active disk.

This is why I have not bothered to automate the task. Too much can go wrong, that requires careful planning & testing.

You are not the first person to want that exact behavior from their TrueNAS server. I simply have no answers for you.
 
Joined
Oct 22, 2019
Messages
3,641
You would need to import the pool (upon inserting the disk) anyways.

Since you're already logged into the GUI or in an SSH session, you might as well just run the backup yourself.

If you want to automatically import the pool upon inserting the disk + automatically backup + automatically export the pool, then you're essentially doing it blind.

How do you know the import was successful?

How do you know the backup completed without errors?

How do you know the export was successful (and should it export if the backup failed)?

If the answer to the above is "I can check by logging into the server." Well, then you might as well login and do the import/backup/export yourself.
 
Top