I have a linux question about recovering files after a reinstall. But first I’d like to give some context. I have a home lab and I rebuild systems often. I was building a set of VMS with KVM, using centos 7 as the hypervisor and the VMS. I used qcow2 as the disk format. The main partition was formatted with XFS which is the new centos default. I ended up rebuilding the operating systems and later realized there were some files on one of the VMs I needed.
Is there anyway I can recover these files? Or does anyone know of a paid service that can help me recover the files I need? I tried foremost and scalpel for a few hours but I was not successful.
In step 3 you mention search for the signature? I don’t have any hashes or file signatures. I know possible file names and extensions and the paths to the files, but I don’t have any other signatures I can go off of.
Also, how do I do that search? What command or software can I use to do this type of search?
You have two options: Mount the qcow2-file(s) inside a VM or straight into the host:
Mounting inside a vm: libvirt-storage Just add the qcow2-file(s) as a virtual disk inside a VM and you can access the data inside the VM.
Mounting the qcow2-file(s) inside linux (on the host system) described here
I’d suggest going with the VM option first - The data should be presented as a disk just like normally installed VM OS. Backup the data from the VM however you like.
Thanks Pollo. I think that should give me access to scan the disk, but I still need some software or process to scan the disks and recover the files. The partitions were deleted and the operating system was reinstalled.
you can use scalpel (or xxd) to search for the files, and can just extract them with plain dd if you want, but as mentioned you need to know the file type and you need to get the header and footer for that file type to find it.
The thing that I can’t remember is if the qcow image (if its not encrypted) is readable as a raw ‘disk’ straight from the file. if it is you can just search it with the above tools directly. If its not you can probably add the disk to a VM as suggested and then perform a search of the whole disk.
You do need to know the file type and layout though, and even then its no guarantee it even exists or is stored in one continuous block.