It was back in the mid-nineties, when I first received a Slackware 3 install CD. I somewhat recall the install process, the terror of wiping out the other OS from the single disk I had. Since then I tried many releases of RedHat and Fedora Core, until recently I turned to Xubuntu for old PCs.
I used Xubuntu also for my media server, which is a network-only small box filled with a 1Tb hd I keep beside my TV. This media server hosts my video and, most important, all my pictures. I have photographies back from 10 years ago, tons of photographies… when I stored (a downsized version of) them into my wife Digital Photo Frame, I counted 14000 pictures.
So, last Friday (Friday 17th, I am not superstitious, mind that) I had a couple of hours of free time and I decided to upgrade the XUbuntu version of my media server.
I saved main configuration files, a couple of packages I installed that were not part of the distribution. Since the linux is located on a CF card and the 1Tb disk is just data, I didn’t mind about backing it up. I mean I have a backup disk I sometimes sync with my actual data, but I didn’t feel the urge to do so.
I started the installation and selected to update the current installation.
After a while I heard my disk head tickling… and the fear rose. I went into a shell, checked for the mounted partition and found my data disk was mounted, issued a ls in the directory and found that more than half of the directories were gone.
Terrified I switched the box off, and turned to the other computer to search for an undelete.
What happened? My data disk was mounted under /var/storage. I choose this because this was a permanent presence in the file system and because under /var is where mysql and postgresql keep their database data. By analogy I thought it was a proper place for my media data base. Well I was wrong (or at least Xubuntu install program thought this was wrong), in fact Xubuntu upgrade wipes out the content of /var, maybe it preserves something, but nothing is asked.
Googling for the right words, I found the way to recover deleted files on a reiserfs partition. Information is a bit dated, but everything worked as expected. I guess I got back 90% of the original data. Recovered stuff was in /lost+found directory, some files had their real name, other files were renamed after their i-node number. Luckily being Picture, I could recover information from the Exif data.
Well… at the end it was just a big panic moment, but everything was sorted out. I have still maybe two/three evenings of work to put everything back in place.
As my esteemed colleague often says – if it nearly works that’s enough, do not change it or it breaks (in Italian sounds much better “Se tanto va che quasi basta, non toccar se no si guasta).