Build Home NAS(3)Data Redundancy

使用Raspberry Pi搭建NAS
本文介绍如何利用Raspberry Pi及rsync工具实现家庭网络存储(NAS)的数据冗余备份方案。通过安装rsync并配置定时任务,可以实现两台设备间文件的同步更新与删除。此外还介绍了SSH密钥的生成与授权过程,确保了数据传输的安全性。
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/
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值