#4, published 2026-03-28 by admin.

Lessons learned: BACK IT UP!!

Today, I attempted to upgrade the operating system of my Raspberry Pi from Raspbian 10 x86 to Raspberry Pi OS 13 x64. I turned it off, tried to unplug the microSD card, but it wouldn't budge. I tried harder. It still wouldn't budge. So, I grabbed some tweezers. I yanked out the microSD card with the tweezers. It still wouldn't budge. I tried again, and this time it came out!! Yay!!!! Oh, but I remembered it would be easier to restore my database if I did a mysql_dump on the live system, rather than trying to find it on the disk. So, I plugged it back into my Raspberry Pi, and turned it back on.

Unable to read partition as FAT
Failed to open device: 'sdcard'

As I put it today at 09:27am, "AAAAAAAAAAAAAAA". I probably just corrupted my entire disk (spoiler: I did), without a back-up (I was planning to make the back-up by plugging the card into my computer and using DD to clone it to a file). The most recent database back-up I had was from 20 days ago. So, I frantically tried countless different ways to get the data back (without having to spend $$$ on professional data recovery). Microsoft Windows said I needed to format the drive; diskmgmt.msc showed a 30.6MB RAW filesystem. GNU/Linux's lsblk showed two drives: a 30.6MB /dev/sda (which, when I DD'ed that to a file, was all null bytes), and a 0B /dev/sdb (which I presumed was the one with all my stuff on). I even tried to see if my Canon photocamera could read from the drive, and nope: "Card cannot be accessed". One thing I did notice though was that whenever I unplugged the microSD card, it and the USB adapter I used for it were always really hot. Boiling hot, even. Hmm...
"You broke the controller when you used those tweezers, and created a short between 3.3V VCC and GND, turning it into a heater. Your microSD card is essentially e-waste now."
-ChatGPT (paraphrased)

Eventually, me (and ChatGPT, or as my computing teacher likes to say, ChatPGT) gave up. I ordered a new microSD card (which are so expensive by the way!!!!! Stop generating cute latte videos or whatever that one tweet was) and admitted defeat. But then I realised, SD cards are not the only form of removable media that Raspberry Pis can boot off of! I grabbed one of my old, 32GB USB 2.0 keys and flashed Raspberry Pi OS 13 on it. It didn't work... on Microsoft Windows that is! So I tried on my Debian laptop and it worked there :).

Sick and tired of being sick and tired, I plugged the newly flashed USB key into my Raspberry Pi, and... it booted! I originally thought it was bootlooping because of how long it took (USB 2.0 R/W speed is not what one would consider "top notch"), but it booted as soon as I opened a new tab to Google "Raspberry Pi bootlooping from USB boot device". Surprisingly, I managed to set everything back up pretty quickly, even though PHP 7.3 (which was powering this website previously) and PHP 8.4 (which is what's running now) aren't compatible with each other. I stupidly gitignore'd some assets I wasn't supposed to, but they were cached by my browser so everything was fine (apart from missing 20 days of database changes and everything from /files/filedump).

Next Steps

Here are the things that I am going to do to avoid this from happening again in the future, and also just for general maintenance. I'm gonna go set-up that back-up now (and also reconfigure php.ini so it stops signing me out!), bye!
PS: this is the second time I've accidentally melted a removable media device!