傲梅轻松备份还原不了_轻松备份

  • Post author:
  • Post category:其他


傲梅轻松备份还原不了

Okay look, we all love Linux as our daily driver. We love to flout how great it is. After all, Linux powers the vast majority of all webservers in the world, so certainly it is robust…

好的,我们都喜欢Linux作为我们的日常驱动程序。 我们喜欢吹牛它多么伟大。 毕竟,Linux为世界上所有的Web服务器提供了强大的动力,因此它无疑是强大的……

Well, here’s the thing. Every self-respecting sysadmin has good backup policies for a reason. Disasters DO happen, it’s as much a fact of life as death, taxes, and people saying that Windows is so awesome. We all know someone who asked us to fix their pc after a mysterious crash on their work laptop which has TONS of important stuff on it that they NEED. Linux, unfortunately, is no exception, and this is especially true for desktop Linux, where the chance of a dumb end user (read, Yours Truly) screwing up a graphics driver or network manager or something is all too high.

好吧,这就是事情。 每个自重的sysadmin都有良好的备份策略,这是有原因的。 灾难确实发生了,这与死亡,税收一样是生活中的事实,人们说Windows真棒。 我们都知道有人在工作笔记本电脑发生神秘崩溃后要求我们修复其电脑,笔记本电脑上有大量他们需要的重要内容。 不幸的是,Linux也不例外,对于台式机Linux来说尤其如此,最终的愚蠢的最终用户(阅读,Yours Truly)搞砸了图形驱动程序或网络管理器或其他东西的机会太高了。

Therefore, every smart user should implement backups on their computer. You could install a tool to manage this for you, but at its core, a backup just needs to include whatever files you need to move to a new system with minimal effort. This can include a reinstall of your current distro, an upgrade, a downgrade, a different distro, your next computer, your dog/cat/drinking buddy, or

whatever.

You should never have to worry that a different system will take ages to set up.

因此,每个智能用户都应在其计算机上实施备份。 您可以安装一个工具来为您管理此工具,但是从根本上来说,备份只需要包括所需的任何文件即可轻松地转移到新系统。 这可以包括重新安装您当前的发行版,升级,降级,其他发行版,您的下一台计算机,您的狗/猫/饮酒伙伴,

等等。

您永远不必担心不同的系统会花费很多时间。

That’s why I have a small script which creates daily backups of my most important files and configurations, why I keep a text file with installation instructions for all my most used apps (from git clone and cmake to apt install, I copy my commands to this file every time I install something and then I can usually just run it, or make minor edits, and I’m good to go on my new system), and why I keep my home folder structure very clean and organized. (That last bit makes it very easy for me to specify what I want backed up and what I don’t care about.)

这就是为什么我有一个小脚本来创建最重要文件和配置的每日备份,为什么我保留了一个文本文件,其中包含所有最常用应用程序的安装说明(从git clone和cmake到apt install,我将命令复制到此文件)每次安装某些文件时,我通常都可以运行它,或进行较小的编辑,并且很高兴继续使用新系统),以及为什么我的主文件夹结构保持整洁有序。 (最后一点使我很容易指定要备份的内容和无关的内容。)

I’m sure you know this, but on most distributions, all app-related settings are saved in

~/config

. So that’s a good idea to backup. Same with your dotfiles. (Thos are the ~/.bashrc, .vimrc, .history, and the like). Then it’s just whatever actual files you have. You could simply take your entire home directory, but that is often overkill, especially if you plan to upload your backups to online storage. (I don’t. I know, I know, practice what you preach, but in my experience, just having a tarball on my filesystem is almost always available for copy to a USB stick, even if it means booting a live USB to access the files. Of course, I just copy the folder to external storage before attempting anything I deem risky.) SO, my script lets me finetune what I care about.

我确定您知道这一点,但是在大多数发行版中,所有与应用程序相关的设置都保存在

~/config

。 因此,备份是个好主意。 与您的dotfiles相同。 (例如〜/ .bashrc,.vimrc,.history等)。 这就是您拥有的任何实际文件。 您可以简单地使用整个主目录,但这通常是过大的,特别是如果您计划将备份上传到在线存储中。 (我不知道。我知道,我会练习您的讲道,但是根据我的经验,即使在我的文件系统上只有压缩文件,几乎总是可以复制到USB记忆棒,即使这意味着要启动实时USB进行访问当然,在尝试任何我认为有风险的操作之前,我只是将文件夹复制到外部存储中。

I’ll attach a link to my git so that if I change it, anyone reading this in the future can use those changes too, but this should be good enough for anyone who just wants to backup some files:

我将在我的git上附加一个链接,这样,如果我更改它,以后阅读此文件的任何人也可以使用这些更改,但这对于只想备份一些文件的人来说应该足够了:

bin/bash
BKPDIR=~/Backups/daily_backup_`date +%d-%m_%Y`/
mkdir -p $BKPDIR
# All of the excludes are relative to ALL of the folders to backup - EG, if I have a Postman folder in ~/scripts and in ~/eBooks, both will be excluded.
GZIP=-9 tar -czvf $BKPDIR/files.tar.gz \
--exclude='BlackmagicDesign' \
--exclude='Image-Line' \
--exclude='ExpedaHours' \
--exclude='rundeck' \
--exclude='Postman' \
--exclude='Screenshots' \
~/scripts \
~/eBooks \
~/Documents \
~/Pictures \
~/Dev
GZIP=-9 tar -czvf $BKPDIR/config.tar.gz \
~/.config \
~/.ssh \
~/SoftMaker \
~/Templates \
~/.p10k.zsh \
~/.zshrc \
~/.aliases \
~/.davmail.properties \
~/.vimrc \
~/.bashrc \
~/.gitconfig

This way, I keep my tarballs small and manageable. You could also add a command to automatically clean older backups, but I don’t bother. If I’m running out of space I just manually delete the entire backup folder and make a new one right away.

这样,我将我的压缩包保持在较小范围内且易于管理。 您还可以添加一个命令来自动清除较旧的备份,但是我不会打扰。 如果空间不足,请手动删除整个备份文件夹,然后立即新建一个。

You can find the latest version of the script

here

.

您可以在

此处

找到该脚本的最新版本。

Keep your files safe, keep your head free of worry, and keep on learning! Never be afraid to bork up yum or apt again. And like this, even if you somehow mess up everything, a quick reinstall is super easy and painless.

确保文件安全,免除烦恼,并继续学习! 永远不要害怕加剧百胜或再次适应。 像这样,即使您以某种方式弄乱了一切,快速重新安装也是超级容易且轻松的事情。

翻译自:

https://medium.com/for-linux-users/making-backups-easy-13aeec54e290

傲梅轻松备份还原不了