To create a recurring USB backup - you will want to first enable SSH for your MyCloud (in my case a mirror).
Instructions on enabling SSH can be found here:
Remember your user name is _ sshd _ and the password is what you set yourself.
If you have never used SSH before, you may want to avoid doing this all together. SSH logs you in as the user “root” which is the all powerful, capable of destroying everything, user. If you do this, I make absolutely no warranty you won’t accidentally turn your drive into a brick.
That said - the examples I am giving below work for my specific setup - you will need to adjust them to your own.
Using your favorite terminal app - open up the ssh connection using your my cloud’s ip address:
Because the MyCloud uses a self signed certificate - it will likely require you to agree to connect to it by typing “yes”
Once in, you will want to discover your usb drive’s name on the system itself - use the commands:
You will see in the folder list the USB drives that are mounted.
If you will be backing up to a specific directory on the drive, you will want to browse into the drive keeping track of your folder hierarchy - in my case, it is:
To create the above browsed into the folder:
Created my base directory:
Browsed into that folder:
And made my backup directory:
Now that you have your backup location, you need to know where the shares are…
In ssh type:
And there they are… along with all your other files for your system — if you get a directory not found, cd /mnt/HD/ and then do ls to see what your drive is called, then cd into that… and you should see your shares.
In my case, the utility WD provides is limited in that it will not let you backup the entire shares director - rsync will. If you want to backup a specific directory within a share, make note of the hierarchy to get to that folder like we did for the backups folder.
So now we should know the basic syntax for our rsync command - in my case to create a backup of all my shares that is synchronous :
rsync -r -av --delete /mnt/HD/HD_a2/ /mnt/USB/USB2_c2/300m/Backups
However, we want this to be run repeatedly - so we need to tell it to run as a cron job.
To understand cron - see the article here:
Open your cron tab typing in your terminal:
This will open in the hardcore editor - vi - so be careful - you can’t just type in this…
move your cursor to the bottom line using your arrow keys.
Press the letter “o” to inset a line below.
Remember cron jobs are laid out with each of the sections separated by a space, with the final section having one or more spaces in it. No spaces are allowed within Sections 1-5, only between them. Sections 1-5 are used to indicate when and how often you want the task to be executed. This is how a cron job is laid out:
minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday), command
So for mine, I want it to run my backup every day at 3 AM - so I typed in:
00 03 * * * rsync -r -av --delete /mnt/HD/HD_a2/ /mnt/USB/USB2_c2/300m/Backups
After you finish, press the esc key.
Type “:w” (without the quotes) to save the file.
Then “:q” to quit.
There you go, you now have a scheduled backup to your usb drive.