Bad Code: Owner Accidentally Deletes His Entire Business, Including Backups

Due to an error in a line of code, a small hosting company is pretty much no longer hosting anything. In one fell swoop, the owner managed to delete his entire business, all his client’s website files — and even the backups — after using a line of bad code. This is one of those classic examples where an “undo” option would be so helpful.

Marco Marsala has reportedly removed every trace of his company and the websites he hosts for his customers due to one poorly-written piece of code.

According to the Telegraph, Marsala headed to ServerFault, a forum for server experts, telling his tale of woe and explaining he had accidentally run destructive code on his own computers.

However, most of the experts on the forum advised him there’s no way to come back from this, and he had most likely destroyed his entire company. Possibly due to the story’s popularity in the media, the particular forum thread has since been removed.

Marsala wrote, “I run a small hosting provider with more or less 1,535 customers and I use Ansible to automate some operations to be run on all servers.”

“Last night I accidentally ran, on all servers, a Bash script with a rm -rf {foo}/{bar} with those variables undefined due to a bug in the code above this line.”

The piece of code Marsala had used was “rm –rf,” a code that will delete everything it is told to. Reportedly “rm” tells the computer to remove, while the “r” deletes everything contained in a particular directory. The “f” part of the code stands for “force,” and informs the computer to ignore all the usual warnings that come when deleting files.

According to the Independent, that particular piece of code has become something of a joke within computing circles because it is so famously destructive if used in the wrong hands.

Normally, a particular directory would be specified and there would be no problem. However, in Marsala’s case, the way he wrote the code didn’t actually specify a specific location, so the computer took the line of code as it stood and removed everything on the computer.

What made matters far worse was the fact that the bad code also deleted all of his backups. Reportedly, the drives that were used for backups were mounted to the computer at the time, so all the files were deleted there, too.

Marsala’s forum entry continued, “All servers got deleted and the offsite backups too, because the remote storage was mounted just before by the same script (that is a backup maintenance script).”

The majority of the users on the forum agreed it was unlikely the hosting company owner would be able to recover any of his data, and that his business would probably not recover from the error.

One user called Sven wrote, “I feel sorry to say that your company is now essentially dead.”

“You might have an extremely slim chance to recover from this if you turn off everything right now and hand your disks over to a reputable data recovery company.”

However, Sven continued by saying this would be extremely expensive and time-consuming and unlikely to rescue him from his predicament.

Other users said maybe Marsala was on the wrong forum, with Michael Hampton writing, “You’re going out of business. You don’t need technical advice, you need to call your lawyer.”

Andre Borie wrote rather strongly, “If you really don’t have any backups, I am sorry to say but you just nuked your entire company.”

However, many users stressed that he should have thought matters out before making the fatal error and should have been protecting his customers’ data with proper offsite backups.

A user named Tim wrote, “Backups need to be offsite, offline, and incremental.”

No doubt Marsala’s approximately 1,535 customers are wishing he had done just that.

[Photo via Flickr by compassrose_04 | Cropped and Resized | CC BY-NC-ND 2.0]