rsync 备份_如何在Linux上轻松设置Rsync备份

rsync 备份

rsync 备份

Most people these days use some type of online backup like Dropbox, but what if you just want the same feature, but backing up to an external hard drive instead? Here’s how to do it the easy way.

如今,大多数人都使用某些类型的在线备份(例如Dropbox),但是如果您只想要相同的功能,而是备份到外部硬盘驱动器怎么办? 这是简单的方法。

In the past, we showed you how to synchronize files and folders with SyncToy, however, SyncToy only works for Windows. On the other hand, Rsync is an open source tool that works on any computing platform. Whether you are on Windows, Linux, or Mac, Rsync backups files and folder on any of these platforms.

过去,我们向您展示了如何使用SyncToy同步文件和文件夹 ,但是SyncToy仅适用于Windows。 另一方面,Rsync是可在任何计算平台上运行的开源工具。 无论您是在Windows,Linux还是Mac上,Rsync都会在任何这些平台上备份文件和文件夹。

Rsync comes as a command line utility, and the secret to make it work, lies in how skilled you are with command line switches. If you loathe the command line, Grsync gives a nice user interface for Rsync, and it is also available for Windows and Mac.

Rsync作为命令行实用程序提供,而使其起作用的秘诀在于您对命令行开关的熟练程度。 如果您讨厌命令行,Grsync会为Rsync提供一个不错的用户界面,并且也可用于Windows和Mac。

Grsync入门 (Getting Started with Grsync)

Install Grsync with your package manager.

使用软件包管理器安装Grsync。

Prepare a folder, ideally somewhere outside your PC – an external hard disk, or a network storage drive, for your backups. Once you have done that, open Grsync, and create a new session.

准备一个文件夹,最好是在PC外部的某个位置–一个外部硬盘或网络存储驱动器,以进行备份。 完成此操作后,打开Grsync,并创建一个新会话。

A session stores a different set of source and destination directories, and any configuration associated to them. Simply click the add button to add a new one, and delete it if you no longer need the session.

会话存储一组不同的源目录和目标目录,以及与之关联的任何配置。 只需单击添加按钮即可添加一个新按钮,如果您不再需要该会话,则将其删除。

The top box is the source, and the bottom box is the destination. The destination folder is where you want to back up your files, this folder acts as your Dropbox folder. The source folder is where you keep all your important files in your computer.

顶部的框是源,底部的框是目的地。 目标文件夹是您要备份文件的位置,此文件夹充当您的Dropbox文件夹。 在源文件夹中,您可以将所有重要文件保留在计算机中。

You have three options the basic, advance, and extra. The basic options are pretty self- explanatory, and you’ll find most of the options they will ever need here. You might want to select “skip newer” and “delete on destination” option. “Skip newer” tell grsync not to overwrite files that are newer in the back up folder, and “delete on destination” tells grsync to trash files that you have in your back up folder but not in your computer.

您有三个选项,基本,高级和附加。 基本选项非常容易解释,您将在这里找到他们所需的大多数选项。 您可能需要选择“跳过更新”和“在目的地删除”选项。 “跳过新文件”告诉grsync不要覆盖备份文件夹中较新的文件,“删除目标文件”告诉grsync删除备份文件夹中但不在计算机中的文件。

Hover your mouse over each option to understand what it means.

将鼠标悬停在每个选项上以了解其含义。

The simulation menu is very useful if you are not sure that you have selected the right options.

如果不确定您是否选择了正确的选项,模拟菜单将非常有用。

Simulation does not copy your files, it only gives you a list of files that Grsync will backup with the options that you have selected.

Simulation不会复制您的文件,它仅提供了Grsync将使用您选择的选项备份的文件列表。

If you are happy with the output, click the execute menu to save the settings, and perform the backup.

如果对输出感到满意,请单击执行菜单以保存设置,然后执行备份。

Once we have a session that backup our files to an external storage device, we have to create another one that synchronize files between the network folder and your computer. This way, Grsync will download new files in the network folder into your computer. Please remember that Grsync only copies the folder that you specify in the source field, and if you want to synchronize that folder, you need to specify a path to that folder in the destination field, not the actual folder.

一旦有了将文件备份到外部存储设备的会话,就必须创建另一个会话,以在网络文件夹和您的计算机之间同步文件。 这样,Grsync会将网络文件夹中的新文件下载到您的计算机中。 请记住,Grsync仅复制在源字段中指定的文件夹 ,如果要同步该文件夹,则需要在目标字段中指定该文件夹的路径,而不是实际文件夹。

For example, we want to synchronize the document folder in the back up drive with our document folder inside our home folder. To do this, we set our home folder, “home/zainul”, and not “home/zainul/document” in the destination field.

例如,我们要使备份驱动器中的文档文件夹与主文件夹中的文档文件夹同步。 为此,我们在目标字段中设置主文件夹“ home / zainul”,而不是“ home / zainul / document”。

Scheduling Backups

安排备份

To get a Dropbox-like synchronization, you need to schedule Grsync to synchronize both your folder and the network folder. Windows, Mac, and Linux have their own GUI based scheduler. Gnome Scheduler might be the easiest way to schedule these backups for Linux. You can use Task Scheduler, if you are running Windows, and iCal if you are on Mac.

要获得类似Dropbox的同步,您需要安排Grsync同步文件夹和网络文件夹。 Windows,Mac和Linux具有自己的基于GUI的调度程序。 Gnome Scheduler可能是为Linux计划这些备份的最简单方法。 如果您正在运行Windows,则可以使用任务计划程序;如果是Mac,则可以使用iCal。

We have to add both back ups as recurring tasks.

我们必须将两个备份都添加为重复任务。

Give them a good name, and enter this as the command

给他们起一个好名字,然后输入此命令

grsync –e “name of the session”

grsync –e “name of the session”

Remember to schedule both sessions that you just created: the one that back up your files to the network folder, and the one that download new files from the network folder to you computer.

记住要安排两个刚创建的会话:将文件备份到网络文件夹的会话,以及将新文件从网络文件夹下载到计算机的会话。

Rsync is a great tool to keep your files synchronize across computers, network drive, and even mobile devices. Try it out, and feel free to share what you think with the other fellow readers in the comments section.

Rsync是使您的文件在计算机,网络驱动器甚至移动设备之间保持同步的出色工具。 尝试一下,并随时在评论部分与其他读者分享您的想法。

Download Grsync for Windows and Mac

下载适用于Windows和Mac的Grsync

翻译自: https://www.howtogeek.com/66348/how-to-setup-rsync-backups-on-linux-the-easy-way/

rsync 备份