How I almost lost 16 years of data in 3 seconds

Or, why you shouldn’t reformat your laptop before your morning coffee.

So this is a classic story to anyone in the I.T. world. I was having some annoying software issues with my laptop, so I decided to do a complete reinstall and refresh. I’ve done these plenty of times before, so I felt I had a pretty good process down and could do it without putting too much thought into it. I copied my settings (note: settings, not files) to a backup hard drive, reinstalled the OS, and copied my settings back over. I then started up my file-sharing program, which would download all of my personal documents, projects, writing, and other important files from my file-sharing service.

Well, Things Happened™, and not only were my files not downloaded, they were deleted from the service.

ALL of them.

Music, family photos, tax records, code projects, novels, poetry, passwords. All of it, gone, in just 3 seconds.

My face when all my files disappeared

So what happened?

Innocent beginnings

First, some context. I run my own private server that I use for hosting a personal file-sharing service called Nextcloud. This is mostly for privacy reasons (I don’t trust Google, Microsoft, or other companies with my data), but I also use the server as a place to back up my files without having to spend exorbitant amounts of money sending data to and from the cloud.

That said, I do back up my server to the cloud using a backup program called Duplicacy, and a cloud storage platform called Backblaze B2. Backblaze B2 is designed for storing large amounts of data that you only use infrequently, as it charges for both storage and data transfer. So even though I have about 300 GB of encrypted backups stored in B2, I only access a tiny amount each day, so it costs me less than $2 per month to store all of it. Everything on my server gets backed up to B2, including Nextcloud. This would end up saving my butt later.

Moment of terror

When I went to reformat my laptop, I followed my usual process of copying all of my settings to an external hard drive so I wouldn’t have to reconfigure all of my applications. I normally avoid copying files as the external drive only has a limited amount of space, and since I was just going to pull all of my files off of Nextcloud, copying them to the drive would just be a waste of time and space.

The reformat went smoothly. I plugged the external back into my laptop, copied my settings over, then reinstalled the Nextcloud desktop client, which is what synchronizes your computer with the Nextcloud server. Here’s where things go sideways real quick.

When I started the Nextcloud client, it had the same settings it did from before the reformat. In other words, it expected to find all of my files in the same locations as before. Of course, the laptop was now completely blank, so when Nextcloud looked for those files, all it found were empty directories. I knew this would happen, and my pre-caffeinated brain thought “oh, it’ll realize those files are missing and just download them.” Instead, it assumed that I had deleted those files myself, and so it started deleting the files from the server.

My server uses a super-fast solid state drive (SSD) for storage, so this was the equivalent of setting off a nuclear warhead. Nextcloud went on a rampage, deleting as many files as it possibly could as quickly as it could.

Mushroom cloud

I only realized this was happening when I clicked on the desktop client and saw a list of deleted files fill my screen.


I closed the client, but the damage was already done. The data usage on my Nextcloud instance had dropped from 20 GB to 2 GB, and all of my most important files were gone. Nextcloud has a trash (or recycle bin) feature, but there were so many files crammed into it that it timed out simply trying to list them all. I thought I was screwed.

How I learned to love the backup

Thankfully, after a moment of suppressed panic, I remembered I still had my cloud backup. I opened up Duplicacy, browsed to my latest backup, and restored the folder where all of my Nextcloud server application files were stored. It only took about 2 hours to pull all of it from B2, and once it was on my server, I simply had to stop the Nextcloud service, replace the folder, then restart it, and everything was back to normal.

I lost about 4 hours of data, but since it was from 4am to 8am, I wasn’t too worried. Nothing super important got lost. And despite pulling down over 20 GB of data from B2, it only cost $0.24. I’ll gladly pay less than a quarter for the quick recovery and peace of mind it gave me.

So if there’s anything you should take away from this story, it’s this:

  1. Don’t casually reformat your computer.
  3. Remember your 3-2-1: make at least 3 copies of your data, store 2 of them on two different devices, and store 1 copy outside of your house or in the cloud.

Leave a Reply