Upgrading the ‘kgadams.net’ web server

You will have undoubtedly noticed that my blog here has been down over the past several days if you’ve been trying to visit. Have no fear!

I completed a hardware upgrade of the server behind kgadams.net. While I was at it, I upgraded the OS (Fedora) to the latest version, and did some initial ‘tweaking’ to improve WordPress performance. Details follow below if you are interested….

Hardware- Honey, I shrunk the server!

The old web server was a bit of a relic. It was initially installed back in 2008: you can read about it in an earlier post. The only change I made in the intervening years was an ‘emergency’ fix to replace a failed power supply.

The new server is an Intel NUC (next unit of computing) system, which means it is comically tiny and sips power. Basically, it is the innards of a laptop installed in a chassis not much bigger than my hand. The specific model is NUC6I5SYH, which has an Intel Core i5 processor with power management features.

This little chassis contains four times the RAM and about double the processing power of the machine it is replacing. Additionally, instead of a physical hard drive, I configured it with an M.2 SSD. So it is a performance improvement all around, and uses about 1/20th of the power (about 25 watts versus 500 watts) of the machine it replaces.

The machine itself is pretty spiffy. But getting it to work started with copying the contents of the old server’s hard drive to the new machine. As is often the case, this did go as smoothly as I had planned.

Battling with a bad hard drive

The hard drive in the old server has a fair number of bad sectors. I knew this, and in fact it was one of the factors that led to the upgrade. I believed that I should be able to copy this drive painlessly to the new server’s SSD. My belief was built on the perception that, since the old drive was still running the website, it must be good enough to copy.

I was, sadly, wrong in this belief. I started the copy process using PartedMagic, a ‘package’ consisting of CloneZilla and some related components installable on a USB stick or similar. I got power to the old drive using the old chassis, but strung its SATA cable to the new computer. It all seemed to work: the Intel NUC recognized both the new and old drives.

The first attempt at copying failed quite quickly due to bad blocks on the source drive. I read up a bit, and found a parameter that told CloneZilla to continue after finding bad sectors. I tried again, and PartedMagic proceeded with the copy process.

Eight hours later I had what I hoped was a working copy. There was a single error regarding failure of the GRUB initialization process. And unfortunately the copy didn’t boot. I didn’t immediately notice it, but the problem was that most of the partitions were broken. The copy had ‘succeeded’, but instead of valid EXT4 partitions, it had produced ‘data’. GRUB had (rightly) failed to initialize, and nothing was bootable. Figuring this out took a number of hours, followed by another attempted copy using PartedMagic/CloneZilla, before I hit on the ‘right’ solution.

The answer was to revert to an ancient Linux copy tool: dd. After some digging, I found a likely set of parameters:

dd if &lt;source device&gt; of &lt;destination device&gt; conv=noerror,sync
(if you have the ‘new’ dd, you can add status=progress for status updates)

What this is doing is telling dd to not fail on errors, and to ‘sync’ (pad with nulls) any failed block. I referenced a couple of sites regarding using dd to duplicate (clone a drive). I believe it is important to not make any changes to the default (512 byte) block size used by dd: otherwise, a failure could result in a large block being ‘emptied’ (not copied).

The dd command worked, although it took almost 24 hours to complete the copy. The drive was ‘functional’ once the copy was complete, although I had to regenerate the initramfs using dracut to get it to boot successfully.

Updating Fedora from 21 to 25

The last ‘core’ upgrade I made was to update to the latest version of Fedora. The process was a bit complicated, but found a website that had most of the details. The biggest issue was getting and installing the necessary signing keys for the distribution. But compared to the disk copy, this was easy.

Unfortunately, there were some post upgrade hiccups. Notably, I confirmed that the old PHP Gallery is finally broken completely. It doesn’t work at all with PHP7, despite my attempts to make it run. Fortunately, I had long ago migrated my images to NextGEN: I was keeping Gallery around as a ‘fallback’. Unfortunately, there is no fallback any more.