ninethehacker.xyz Nuking my DB

Nuking my DB

everybody hurts


It finally happened, I nuked it. Here’s what I did and what happens next.

file restoration on linux

Of course I didn’t have a backup, what are you fucking stupid? There’s a lot of information on the web about recovering files from a linux machine. Most of this information is wrong. ext4magic is the real shit, power down your cloud vm and make a restore point immediately.

I chose to use use a live restore iso based on Debian. It’s called Finnix, and you can get it here. It worked pretty well, genuinely curious if anybody knows anything better.

# install ext4magic to the session and get your files back
apt install ext4magic
ext4magic /dev/vda1 -f /path/to/files/* --restore-files

# might as well chuck them back on the disk
mount /dev/vda1 /mnt
cp -rv RESTOREDIR /mnt/home/<user>/

Unfortunately the DB came back with 0 bytes. FUCK. On the bright side the multimedia content was saved.

getting the data back

Unfortunately my site isn’t all that popular. Not much of it was cached by google. I managed to get some publish dates, I had some data saved in my notebook app. Not a shitload to go on, but I don’t write enough so it wasn’t too much of a loss.

The fun is going to begin when I try to fix the publish dates in the DB. I’m seriously considering moving the tables over to postres, it’s faster, but it’s probably easier to write a crontab to save a versioned backup of the site’s content if it’s all in the filesystem.

moving on from here

Running a site on the web is a bit like minecraft: all your shit gets destroyed occasionally, but you learn so much making it that it comes back better, code, layouts, schema design, building from a clean slate is very liberating.

product screenshot One of the things I never noticed was the lack of acknowledgement that the article list was empty, this kind of polish is vital if you want to make your source a product one day.

Deploying the site again gave me the opportunity to fix some pain points, redesign my schemas for some new features, and gave me the motivation to port my article list and headers to bootstrap 4 cards.

new goals

It occured to me that the SEO I’d never given a shit about would have saved my arse when it came to getting all of my content back. I think I need to set up robots.txt and make the distinction between content and navigation clearer to web crawlers.

In fact, I should really clean up a lot of the pain points that upset me, make it tedious to publish content, and put in the missing stuff that prevents my stupid hobby site from making wordpress look like a little bitch, while I’m at it vanilla bootstrap is looking pretty grotty, I think it’s time to set up theming.


there are no comments yet


all comments are manually reviewed before publication