Live data from Hacker News

The wrong way to switch operating systems on your server

figbert.com

1–10 of 77 posts

Re: The wrong way to switch operating systems on your server

#2
On my server, I have three 'root' partitions. One for general day-to-day use, one for a backup if something catastrophic happens to my main system, and one for experimentation. The extra disk space taken up for my having two extra 'root' partitions is a miserable 40-50 gig.

But I know that I can swap operating systems over almost instantaneously and then back again just as quickly if I did something wrong.

Great peace of mind for practically no cost.

The second error I see in the article is to use software that we haven't used previously for something important. My first wife had the habit of trying new recipes when we had a dinner-party. I tried to tell her repeatedly to try the recipe on us first, then she would have it down pat when she wanted to impress.

The third error of course was the need to have restorable daily backups and the use of them to restore the system when need be, associated with modularity of the system.

I back up my whole system daily. but the most important part of that is not backing up the distro itself (we have re-installs for that) but backing up all the config files, all the databases, all the local binaries, and a current list of all of the installed distro packages. I can replace the whole operating system from a complete wipe-out in less than two hours.

I store these backups in a pseudo-exponential policy. I have more recent backups, fewer older backups. Currently I have 15 backups covering 9 years, with five of those covering just the last 3 weeks, and four covering the last five days. To augment this, I have a monthly snapshot backup also stashed away.

The other stuff, personal docs etc, is deliberately kept small. Total daily backup of base system and /home is approximately 12 gigs. That is easily transported on a USB stick.

I don't store music, photos, magazine .PDFs, old software, etc in my /home directory. That stuff all goes in an archive directory that's write-once, and store (practically) forever. That gets rsynced to two external USB drives daily. Most days, there's practically nothing that gets transferred out.

Having several times lost much valuable data, I suppose I am really paranoid, but I still think I haven't been paranoid enough.

Re: The wrong way to switch operating systems on your server

#4
These experiences are relatively common, we just don't see writeups that often. Kudos to the author for writing this up. I do disagree with some of the lessons here.

You want to switch operating systems on your server?

1. Set up monitoring. If you don't have monitoring already, hack something together with simple scripts.

2. Start up a new server.

3. Migrate services and data from your existing server to your new server. Do this at whatever pace you feel is appropriate. Point the monitoring scripts at your new server.

4. Switch DNS records.

5. Wait. You are not in a hurry to turn off the previous server. Why not wait one or two months?

6. Turn off the old server.

7. Wait some more, and then delete the old server.

The idea here is that steps which might take your site offline are easily reversible. For example, switching DNS records. It's trivial to switch the DNS records back if your migration unexpectedly failed. As much as reasonable, you want the ability to go backwards and undo the steps that you've done to get back to a known good setup.

In particular, I would say that backups are usually not the right tool for migration. This is missing from the lessons at the bottom of the article. The way you get more confidence in your backups is by doing restore tests into a sandbox environment, by adding automated monitoring to your backups, etc. Trying to address a lack of confidence by increasing the backup frequency doesn't make sense. The backup frequency is the most trivial thing to adjust and doesn't address deeper issues, like the fact that you need to dump/restore databases properly and shouldn't copy files from a live database. These issues are discovered through restore testing.

The saying goes, "Nobody wants a backup system, everyone wants a restore system." If you are making backups but not testing restores, you're gonna get bitten. Test the part of backups that you care about--the ability to restore data--and don't test it live. Test it in a sandbox.

Re: The wrong way to switch operating systems on your server

#5
Someone tell me if I'm missing something, but isn't the whole point of hosting things in a virtual environment so that when you want to switch/upgrade OSes, you stand up a second server and start migrating apps over one at a time?

I can't understand why that doesn't done here.

Re: The wrong way to switch operating systems on your server

#6
Don't consider it a backup until you've successfully restored the data from it.

The first thing I do after setting up a new data backup is test a restore of the data. Only after that will I feel confident that the backup procedure works right.

In the article author's case, an attempt to restore would have caught the problem of the missing .env files and the large movie files.

As for the Ctrl-C on both the backup and restore, you should check your I/O (network and disk) before terminating a process. Doing that would have confirmed that the process was still going, and indicate the rate at which the process was going.

Re: The wrong way to switch operating systems on your server

#7

Don't consider it a backup until you've successfully restored the data from it. The first thing I do after setting up a new data backup is test a restore of the data. Only after that will I feel confident that the backup procedure works right. In the article author's case, an attempt to restore would have caught the problem of the missing .env files and the large movie files. As for the Ctrl-C on both the backup and…

+1. `strace` can be very helpful here, to see if a process is stuck waiting on something or whether it's just zooming along with no output.

Re: The wrong way to switch operating systems on your server

#9
post #4

These experiences are relatively common, we just don't see writeups that often. Kudos to the author for writing this up. I do disagree with some of the lessons here. You want to switch operating systems on your server? 1. Set up monitoring. If you don't have monitoring already, hack something together with simple scripts. 2. Start up a new server. 3. Migrate services and data from your existing server to your new ser…

This approach saved my bacon on a migration just yesterday. I had gotten to testing files after having done a big baseline rsync, stopping file services on the old server, and doing a catch-up rsync incremental. Oh shit - one veracrypt container is corrupted and won't mount. Turns out rsync diff updates and mounted containers being written to don't play nice together.

Since the old machine was still sitting there with all the data accessible, I was able to just blow away the corrupted volume, confirm it was unmounted on the source, then copy the whole thing over. If I just had a one-time copy that I'd thrown at b2 or something, I would have been very sad.

So, yeah, test restoring your backups. Even fancy checksumming filesystems and shit won't save you from bad assumptions about the integrity of your data.

Post reply on HN