TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How do you backup before an upgrade (Linux)?

9 点作者 curvilinear_m大约 3 年前
Which software do you use as an emergency backup right before doing a risky operation (such as an upgrade) ?<p>I am going through the pain of restoring my files after a bad error on my part : I used déjà-dup (the default with Ubuntu 20.04.4) to back up the default home folder.<p>Unfortunately, my update broke everything and I lost access to my session. I hoped that deja-dup would allow me to restore from the live CD, but found out that I need the same computer name and username, so I had to reinstall everything before being able to restore.<p>This seems inconvenient, and I don&#x27;t understand why it is the default behavior.<p>What are you using to do your backups ? Have you felt the same frustration I&#x27;m facing ?

9 条评论

smoldesu大约 3 年前
&gt; This seems inconvenient, and I don&#x27;t understand why it is the default behavior.<p>Nobody made the conscious decision to kneecap you here: it&#x27;s simply dangerous to treat one computer&#x27;s hardware configurations the same as another. Backing up your home folder is your best bet, as it&#x27;s relatively safe to &quot;restore&quot; after an install. It&#x27;s up to you to have a bootstrapping script ready to get your system to the same place it was before it was borked.<p>This is one of the things NixOS would solve quite well, but unfortunately the software just isn&#x27;t <i>quite</i> there yet, in my opinion. Your Nix install has two configuration files: a software config and a hardware one. Your software configuration is portable, you can use it to define things like users, user configurations, permission structures, desired global applications, themes, groups, system config and more. Your hardware configuration file is specific to the machine you&#x27;re running, and is auto-generated when you install a system. This separation makes it really easy to &quot;carry around your system&quot; as a 10kb text file. The tough part is that it doesn&#x27;t work very well with most desktop environments, and it&#x27;s something of a pain in the ass to set up. One day I hope we get there though, because it really would be a best-in-class solution.
LinuxBender大约 3 年前
I can describe my method that has worked well for a few decades but it might not be for everyone.<p>Before planning a backup I first ensure all the files I care about are isolated into unique directories not shared by anything I don&#x27;t care about. e.g. &#x2F;data&#x2F;something_unique &#x2F;opt&#x2F;something_unique &#x2F;home&#x2F;username&#x2F;something_unique and so on. <i>something_unique</i> just being a unique directory that contains anything or everything I care about. One could also define other shared directories in rsnapshot like &#x2F;home&#x2F;username&#x2F;.config or the entire home directory if you have the disk space for it.<p>I then have rsnapshot installed and it will be a local snapshot of files I consider important enough that I want a few versions of. RSnapshot is just a perl script that uses hardlinks to reduce disk space usage of duplicate files. Rsnapshot is executed in crond. I rsync that snapshot over to a NAS. Rsync is also called by crond. If files are very important I will also copy them to a portable NAS and put it in my vehicle.<p>Anything not defined in &#x2F;etc&#x2F;rsnapshot.conf will be files I do not care about and will be treated as ephemeral just like the rest of the OS.<p>If one does not have their OS set up to be ephemeral (cattle vs kittens) then another lesser-secure option might be to keep your important files in a unique LVM volume and use <i>lvchange</i> to set that volume read-only to reduce the risk of the OS upgrade from touching it.<p>[1] - <a href="https:&#x2F;&#x2F;rsnapshot.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;rsnapshot.org&#x2F;</a>
firebaze大约 3 年前
I never dist-upgrade. i just install fresh, install all software I am using right now, have a backup partition to copy data from if required (which gets deleted when the next dist-upgrade arrives) and enjoy the loss of old stuff. This never took more than two days of tweaking and occurs at ~2 year intervals. Technically, the potential uptime is better that most SaaS offerings.
ohiovr大约 3 年前
Timeshift and storing the system backup folder in an off system portable hard drive has worked for me with system backups. I&#x27;ve restored timeshift backups from bare installs or live disks without issue. For home backups I just use rsync. I keep a few backup scripts in my .local&#x2F;bin folder so they can be easily accessible from any directory.<p>Here is an example of a backup script I use: <a href="https:&#x2F;&#x2F;pastebin.com&#x2F;16MPxby0" rel="nofollow">https:&#x2F;&#x2F;pastebin.com&#x2F;16MPxby0</a><p>this script will show me what files have changed. So if a huge number of files have changed I can perceive that as a potential crypt attack. Or some other bonehead thing I did..<p>This script will DELETE files on the backup that no longer exist in my home directory. I do that so I don&#x27;t have a bunch of zombie files laying around that are no longer needed.
themodelplumber大约 3 年前
sudo rsync -vax --delete --ignore-errors --xattrs --acls &#x2F; &#x2F;media&#x2F;destination&#x2F;partition&#x2F;<p>This is run periodically via your favorite method. You can then boot off the backup destination drive later if needed (GRUB picks it up when plugged in). This seems to work fine for me.<p>BTW generally &quot;broke everything&quot; ought to be listed out, clarified, etc. so you can understand or document your system better. The notes you keep about it can help future upgrades complete with fewer issues.
synicalx大约 3 年前
I try and make my workstation... I guess you&#x27;d say &quot;stateless&quot;?<p>- Nothing important stored &quot;on&quot; the machine itself, I put it in one or more cloud storage options, git, password manager etc. Important documents like photos and legal stuff I keep in two cloud storage services + REALLY important stuff gets burned onto a DVD or BluRay that I lock up somewhere.<p>- I have a.... rather long &quot;sudo apt install blah&quot; script that has every package I&#x27;ve needed or wanted to install. Every time I install something new I just add another entry to that script. Although I have to say, this is looking a bit ridiculous now at 160+ lines most of which are just individual packages.<p>- I have another script to clone in my dot file&#x2F;config file repo and move all of those into position.<p>- I don&#x27;t have anything to setup my user account, but that&#x27;s only a 5 second job so it&#x27;s probably not worth the time.<p>I generally find actual backups are more hassle than they&#x27;re worth for this kind of thing. The old fashioned sysadmin in me knows that no backup actually exists until you test it - and I really don&#x27;t feel like testing my own backups all the time.
runnerup大约 3 年前
Veeam Endpoint Backup is free and works great for me. I use it for both windows and Linux and I’ve been able to restore fine after botched upgrades or unwanted NVidia driver updates.
doubled112大约 3 年前
I just consider my machines disposable. It has saved me a ton of heartache over the years.<p>I have a git repo with some dotfiles and setup scripts - dotbot configures my user, Ansible configures my system.<p>Most files go in a self hosted Nextcloud sync folder. If it is larger it goes on a file share.<p>Anything else is simply forgotten. I can rebuilt in ~ 5 minutes after a clean install. I can keep multiple machines in sync like this as well.
croh大约 3 年前
separate config, codebase, media files and other stuff<p>- config using dot files (may be some remote git repo)<p>- projects in git repo<p>- media and other stuff in different drive<p>Everytime you make changes in config or projects, push them to remote repo immediately. This way, you will be always ready to upgrade.