Mirroring whole cloud on second storage

Hi! I dont know if I post at the right place, I’m new here and find the forum pretty hard To understand.

I’m a newbie in this world and trying To setup my own cloud in order To store personal files.

My cloud works at this moment (running it on a raspberry pi 3 with dietpi os), but I use a USB key as storage.

I’m pretty afraid that the USB stick could fail at any moment and I wouldn’t like to loose my important files. I’d like to know if it is possible to have a mirrored storage.

What I mean is that I’d like to have 2 storages (2 HDD or USB sticks) plugged in my pi and everytime I upload something on the main storage, it copies itself on the second one.

It would be even better if everytime I drop a file in the cloud from somewhere in the world, it copies itself on my main pc, but since its not always running I dont think that could be a thing.

Is such a thing possible? If yes, how could I do that?

Last question is : If I got 2 storages plugged in the pi, can i switch from one To the other while being on the web panel? If yes, it could be a solution for me to upload twice each files even tho it would be less convenient.

Thanks again

I think what you are looking for is Software RAID on Linux. You can create one virtual device, your Linux is writing to, but in the back it is duplicating everything to one or more disks. What you want is a RAID 1.

1 Like

Your option to copy to your computer, which is not always on, would be to setup a shared folder on your computer to accept backups. I would be looking to do an rsync of the data folder via a cron job, if your desktop is on it’ll go through and your backup will be updated at that time.

I successfully set up a mdadm raid 1 for my two usb drives on my pi

now, I have put some files in the cloud and I’d, to be sure, that when I plug the usb drives in my pc, both have the same files in it, but when I plug them on my pc they both are empty, but aren’t when I look in the cloud.

Could I have made a mistake and Raid isn’t working and my cloud files are in my sd card, or is it normal that I don’t see any files when I plug my USB drives in my pc?

— NB Raid 1 resync isn’t finished yet.

Aclemence, sounds like a great idea !! I think I’mma give it a try

Hi Forum,

late reply, but please don’t use USB disks for a software raid configuration with Linux.
It is a very bad idea and bad design.

See more here: What's all this with USB? - Linux Raid Wiki

So if you came here, please don’t use USB-Disk for any RAID-Config.

1 Like

Does that apply to dedicated RAID boxes? I have 3 spindles mounted within a 5 slot RAID box which are RAIDed along with another two internals. The USB3 cable is routed carefully and is not touched in normal used.

@JMartinR you never know. As stated on the Linux kernel mailing list, compared to proper HDD connectors like SATA or M2 - USB has some flaws - especially if multiple devices are connected.
I use a raspberry pi with USB disk myself as a storage, but I’m doing a backup with rsync on a second disk. So I avoid having both disks “always online” which might bring them earlier to a failed state, plus I don’t need to worry about any RAID breaking.
As stated in the article - it is a very friendly hint - it might nevertheless - work for you - but don’t complain to Linux kernel if it breaks - as they warned everybody.

If the RAID box had an internal RAID controller and an external power source, independent of USB, then I guess it could be alright.

External power source, but MD RAID including two internal disks. Amazon entry here