Recover XRNS Files From Accidental Drive Format!

What you need:

  • External Hard drive that is 2x the size your hard drive partition is (or second hard drive installed)
  • Pen Drive
  • Ubuntu Live CD ISO

not to ge to much into the background of the cause, I was writting a Linux script to backup my drive with rsync and accidently formatted(mkfs.ext3) my entire drive. I use a windows partition for music and I was so happy to recover my renoise files I though I would share. Technically this could work with a damaged drive too.

OK My drive is empty:

When in the ubuntu enviroment open a terminal and type:
sudo apt-get install foremost
sudo apt-get install dd

This is the part you will have to use some brain power. Open the Disk utility and find the partition or drive you need to recover and figure out what /dev/ device its on. If its the “main” hard drive its probably /dev/sda. If you only have one OS on your drive the partition is probably 1, but check, some vendors put recovery partitions on the hard drives. With my Dell Laptop it was labeled “OS” and was /dev/sda3. Once you discover which hard drive and which partition it is then we will make an image of it to work from.

Mount your second/external Hard Drive in /media/ (something like)
sudo mount /dev/sdb1 /media/
create image of drive:
dd if=/dev/sda3 of=/dev/media/RecoverMe.img (change /dev/sda3 to the partition to recover)

It will take a while becasue it has to image the entire partition, mine was 2 hours for 250 gig.

Once thats done make a new directory for foremost to use.
mkdir /media/HOLD
cd /media/
foremost -vqQ -o HOLD/ -t zip -i RecoverMe.img

You might be asking why look for zip files, I discovered the xrns files are really zip files(developers please dont EVER change this lol).

after thats done you will have a new directory /media/HOLD/zip
cd /media/HOLD/zip
now we have to use a script to find the xrns files, because these are recovered files the names are lost and the xrns extention is changed to .zip. This is becasue the headers/footers of the files are consistant with .zip files.

I wrote this to go through all the zip files and list the contents.

ls | grep --color=no .zip | while read i; do echo -e “\n $i\n” ;unzip -l $i;done |more
and when you see something like:



<?xml version="1.0" encoding="UTF-8"?> 4 2 135 4 12 4 4 false 0 0 0 0 Syntechtic Sugar


That is a renoise file and the file name is, open a second terminal and copy that anywhere on the external drive

Do that for all your renoise files and rename them to whatever the name is .xrns, in this case SyntechticSugar.xrns. I hope this helps someone else.

And here are the instructions to prevent accidentally formatting the wrong drive:
Label your drives appropriately so you know which drive is what.

lol it was a problem with my script, I forgot to have it change the output of sda’s drive labeling to sdb’s so it just rewrote the partition map of sda and formatted them. Regardless, im using dropbox now lol