• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

rubo77/rsync-homedir-excludes

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

rubo77/rsync-homedir-excludes

开源软件地址(OpenSource Url):

https://github.com/rubo77/rsync-homedir-excludes

开源编程语言(OpenSource Language):


开源软件介绍(OpenSource Introduction):

rsync-homedir-excludes

This project maintains a list of directories and files you probably do not need to back up, which you can pass to the rsync command's --exclude-from option.

Usage:

# download to `rsync-homedir-local.txt`
wget https://raw.githubusercontent.com/rubo77/rsync-homedir-excludes/master/rsync-homedir-excludes.txt -O rsync-homedir-local.txt
# or clone and copy to `rsync-homedir-local.txt`
git clone https://github.com/rubo77/rsync-homedir-excludes
cd rsync-homedir-excludes
cp rsync-homedir-excludes.txt rsync-homedir-local.txt

# edit the file rsync-homedir-local.txt to your needs
nano rsync-homedir-local.txt

# define a Backup directory (with trailing slash!)
# some examples:
BACKUPDIR=/media/workspace/home/$USER
BACKUPDIR=/media/$USER/linuxbackup/home/$USER
BACKUPDIR=/media/$USER/USBSTICK/backup/home/$USER

# first specify the "-n" parameter so rsync will simulate its operation. You should use this before you start:
rsync -naP --exclude-from=rsync-homedir-local.txt /home/$USER/ $BACKUPDIR/

# check for permission denied errors in your homedir:
rsync -naP --exclude-from=rsync-homedir-local.txt /home/$USER/ $BACKUPDIR/ | grep denied

# if it is all fine, actually perform your backup:
rsync -aP --exclude-from=rsync-homedir-local.txt /home/$USER/ $BACKUPDIR/

You can edit the exclude file before execution:

  • All lines starting with a # are ignored by rsync, i.e. those directories will be backed up.
  • The syntax doesn't support comments at the end of a line yet.
  • At the start there is a section with directories that are probably not worth backing up. Uncomment those lines to exclude them as well.

Making incremental backups:

When running locally or with the --whole-file option (for backups over SSH), rsync doesn't modify files but replaces them entirely. This allows us to create a snapshot directory (with hardlinks) with the state of the backup directory at a certain point in time.
Run this after finishing the rsync backup and it'll create a new snapshot:

BACKUPDIR=/media/workspace/home/$USER
SNAPSHOT_DIR="$BACKUPDIR.snapshot_$(date +'%Y-%m-%d_%H%M%S' -u)"
cp -al $BACKUPDIR $SNAPSHOT_DIR

Next time you run your backup, the snapshot directory will be intact despite the changes rsync made to the files in the backup directory.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Sponsor @rubo77 on GitHub Sponsors · GitHub发布时间:2022-06-17
下一篇:
paulodiovani/hacktoberrank: Hacktoberfest Rank发布时间:2022-06-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap