`
sillycat
  • 浏览: 2486631 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

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/
分享到:
评论
5 楼 sillycat 2015-11-17  
Every Half an Hour
30 * * * * /usr/bin/rsync -avP --delete -e "ssh -i /home/carl/.ssh/id_rsa" carl@raspberrypi1:/mnt/driver1/nas_cloud/share/ /mnt/driver2/nas_cloud/share >> /opt/logs/cron-rsync.log 2>&1
4 楼 sillycat 2015-11-17  
3 List the Cron Job I Have
>crontab -l
30 10 * * * /usr/bin/rsync -avP --delete raspberrypi1:/mnt/driver1/nas_cloud/share/ /mnt/driver2/nas_cloud/share > /opt/logs/cron-rsync.log 2>&1

4 Logging the cron task
30 10 * * * /usr/bin/rsync -avP --delete raspberrypi1:/mnt/driver1/nas_cloud/share/ /mnt/driver2/nas_cloud/share > /opt/logs/cron-rsync.log 2>&1
3 楼 sillycat 2015-11-17  
Set up my time zone to be the current local time
>sudo dpkg-reconfigure tzdata

>sudo dpkg-reconfigure tzdata

Current default time zone: 'US/Central'
Local time is now:      Mon Nov 16 10:21:01 CST 2015.
Universal Time is now:  Mon Nov 16 16:21:01 UTC 2015.
2 楼 sillycat 2015-11-14  
Quick format
sudo mkfs.ntfs /dev/sda1 -f
1 楼 sillycat 2015-11-14  
Command to format the disk
>sudo mkfs.ntfs /dev/sdc1

相关推荐

Global site tag (gtag.js) - Google Analytics