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/
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/
使用Raspberry Pi搭建NAS

本文介绍如何利用Raspberry Pi及rsync工具实现家庭网络存储(NAS)的数据冗余备份方案。通过安装rsync并配置定时任务,可以实现两台设备间文件的同步更新与删除。此外还介绍了SSH密钥的生成与授权过程,确保了数据传输的安全性。
1292

被折叠的 条评论
为什么被折叠?



