Recover root files from a formatted partition

Hello, I would like to recover root files from a partition that was formatted by mistake. I have backups made but there are few files that are older by few weeks and I was wondering if I can avoid redoing some of the work. Just like I can use foremost command line tool in linux that allows me to recover image files such as jpeg, gif, etc. is there anyway to do something similar to recover root files? may be a bash script that I can run. Any help would be nice.


see documentation of TFile::Recover at:



assuming that this is for a dd-like big blob of data (i.e. a binary partition image) I’d use foremost :slight_smile: Next comes the version, which you can use to restrict the max size of the file. If you find a configuration that works for you then please post it!

TFile::Recover() is only for file system objects (aka files), not raw bytes from a partition.

Cheers, Axel.

Thanks for your quick response. This is what I’ve have so far…

I looked at the foremost.conf file and I can specify extention, case sensitive, size, header, and footer. So, I added a line

root y 5000000 \x72\x6f\x6f\x74

As it reads an image.dd file for example, it made a .root file every time foremost encountered the word “root” which could have been in text files. So, how do I specify a footer which tells foremost that this is the end of the root file since the size of root files vary? I looked at the TFile page and I am not sure how I can determine the eof or footer.