Build Home NAS(3)Data Redundancy

Build Home NAS(3)Data Redundancy

Install the software tool rsync
> sudo apt-get install rsync

Actually both of my machines are installed this.

Sync all the files under the file1 to file2, if there is more things in file2, delete them
> rsync -av --delete /home/carl/install/file1/ /home/carl/install/file2

More details in the logs
> rsync -avP --delete /home/carl/install/file1/ /home/carl/install/file2

Generate and Set up the SSH Key
> ssh-keygen -t rsa

Check the public keys on each machine
>cat ~/.ssh/id_rsa.pub

Put the content into the machines which you want to access
>vi ~/.ssh/authorized_keys

Sync from ftp machines to the back up machines.
> rsync -avP --delete raspberrypi1:/mnt/driver1/nas_cloud/ /mnt/driver2/nas_cloud

And then I need to configure this command to crontab

>crontab -e

Every 30 minutes
30 * * * * rsync -avP --delete raspberrypi1:/mnt/driver1/nas_cloud/ /mnt/driver2/nas_cloud

The format of the time will be
minute | hour | day-of-the-month | month | day-of-the-week

References:
http://www.makeuseof.com/tag/turn-your-raspberry-pi-into-a-nas-box/

你可能感兴趣的:(Build Home NAS(3)Data Redundancy)