Hooray - the blog is now online (though it was online, albeit dormant, a few months ago).
My blog is currently running on a Raspberry Pi (Model 2) configured to run a LAMP stack (Linux, Apache, MySQL, PHP). Previously, it was running on a Raspberry Pi B from a few years ago and, ignorantly, thought the time was ripe for an upgrade. The only issue was that the Model 2 used a MicroSD card for file storage instead of a standard SD card. I then went ahead and purchased a new MicroSD card for use in the Model 2, under the assumption that I could just
dd the contents of the large SD (the server filesystem) onto the new MicroSD card of the same size and everything would be alright.
Unfortunately, I had not yet learnt a very important lesson concerning flash drives: their capacities are almost invariably smaller than what it says on the packaging. This particular MicroSD card (32GB on the packaging) had an actual capacity of 30GB whilst the old SD card containing the filesystem (also 32GB on the packaging) had an actual capacity of 31GB. Even though I had ~10GB free on the SD card (so, as logic seemed to dictate, it would not matter if the last 1GB of the SD card was not copied), it turned out that the option to “Expand root filesystem” I had taken when setting up the server would bring about my detriment. When the filesystem is expanded, the MBR partition table is expanded to include the free bytes; at the end of the free bytes there is about 16KB of data about the MBR table without which the SD card is unreadable. So as the last 1GB was not copied, the final 16KB of data was not copied rendering the MicroSD card unreadable.
Now, the obvious option for me was to shrink the partition table on the original SD card so the final 16KB would be copied with room to spare onto the MicroSD card. All I can say is that having an entirely Mac-based household anything involving a standard BIOS is extremely excruciating, if not impossible, to carry out. Around 3 hours later, I had managed to boot GParted on my Mac off a USB, only to find that the SD card partition table itself was corrupted (I’ve no idea how it was able to boot on the original Pi…). However, I could still read the files on it through osx-fuse plugin on Mac - making my life significantly easier. It seemed that my best option was to just rebuild the server and reconfigure everything.
What seemed a daunting task was actually much easier than I assumed previously - thanks to the fact that many files on the MicroSD were salvageable I was able to import config files for Apache etc. and the server was up within a week. However, next time I probably won’t be so lucky - so in addition to a new backup regime I will be making mini-guides on various different aspects of the server posted on the How-Tos page. Predominantly for my own reference, I also made a small guide as to how I restored the server; it may be of use to those setting up a RPi LAMP server.