← Home ← Code

Whoops, I deleted stuff again

Gosh, darn it! I did it again. I have accidentally deleted stuff from my website.

The great collapse

Once upon a time, I made a silly typo and, instead of rm -rf ./, I ran rm -rf /. On my server. Yeah.

For those who don't know what that does, rm is the command for removing files and directories. -rf means removing all files within a folder recursively. The difference between ./ and / is that the former says "delete the current working directory" (which is a fancy way of saying "the folder I'm looking at right now") whereas / is the root of the system. So rm -rf / attempts to delete every single file on the system. Actually, it can't quite delete everything, due to permissions. But it deletes a whole lot, to the point that the server becomes unusable; even the package installers are removed, so you only have very basic operations left.

Did I have a backup? Well, no. I didn't. Not for everything, anyway. A lot of the stuff I had made was way before I had discovered the beauty of version control software. For a very long time I had been programming with just my text editor, and uploading files with an FTP client. Luckily, the more recent things lived on GitHub, and those were fine. But some of the really old stuff was just gone. Even archive.org could't salvage it.

The repeat

I learned from my mistake. I have backups now! And I have not run rm -rf / since. What I did instead, and this actually took me a day or two to realize, is delete everything from this very website except for the blog. In a nutshell, I set up a workflow to synchronize the build output for this blog with what's on the server, and that also deletes the other stuff that was on the server but not part of the blog.

The positive part is, not much was impacted. Not only was there not a whole lot on this site besides the blog, but also it probably gets fewer visits than I do in real life.

I'll be either re-building or re-uploading the missing pieces soon enough, though probably in a format that fits this blog.