before you start writing a bash skript with tar and so on have a look at restic
depends. i would put my data at least on another “server”. e.g. raspi+hdd.
if you want to protect against thunderstorm and fire you have to place that device in another house.