what i did to get specific data out of my fsarchive

Post here if you have questions about how to use the program
Post Reply
tasker
Posts: 1
Joined: Fri May 27, 2011 11:51 am

what i did to get specific data out of my fsarchive

Post by tasker » Fri May 27, 2011 12:26 pm

restored an old backup i made using fsarchive (which worked amazingly, by the way), and my system is now in a state where things are working correctly again. (of course, i made a backup before the restore just in case)

sadly, i don't make backups often (in fact, this one i just restored from was my first! (no kidding)), and there were many, many, many minor things you (you? me? probably just me) never think of writing down before a restore.

so i began to wonder how to recover certain bits of info from my previous system (config files, certain programs, pictures). i looked into the 'restdir' function, but that can't be used on an archive created with 'savefs'. the archive i made was of my 120G main drive, and i didn't have a spare harddrive i could plug in for temp storage.

so (in short) here's what I did:

Code: Select all

1) # dd if=/dev/zero of=/temp.hdd bs=1 count=1 seek=XXX(G/M)
2) # mkfs.??? ./temp.hdd
3) # losetup /dev/loopN ./temp.hdd
4) # fsasrchiver restfs archivename id=#,dest=/dev/loopN
in detail:
1) this is a very quick way to create a very large file using dd. the XXX at the end of seek indicates how large you want what's going to become a fake block device (the G/M stand for Gig and Meg); for example: "seek=512M" will create a file that is 512 megabytes large"). when creating this file, keep in mind that fsarchiver will restore safely to device that's larger, not smaller, than the data in the archive.

2) according to all i've read about fsarchive, this step is unnecessary, since fsarchive creates a filesystem as it does its work. but this was for my own piece of mind. if you want to use it, check which filesystems are available to you. the mkfs command will ask for confirmation since temp.hdd is not a block device. just say 'y', and it'll do its thing.

3) this command assigns the temp.hdd file to a loop device so it can be treated just like a block device, which fsarchiver likes. make sure to replace N with an appropriate number (0/zero should work in most cases). you can test this by doing

Code: Select all

# mount /dev/loopN /mnt/tmp
if you mounted it, make sure you umount before proceeding or fsarchiver will yell at you.

4) just restore your backup like normal, making sure to set dest=/dev/loopN (for whichever N you chose). fsarchiver will chug away and when it's done, your archive snapshot will be restored to a single file called temp.hdd that you can mount as normal using /dev/loop0. two methods to mount the file are

Code: Select all

# mount -o loop ./temp.hdd /mnt/temp
or
# mount /dev/loop0 /mnt/temp
once the restore is mounted, you can dig through it for whatever you were looking for. and it's easy to clean up too; just umount and delete temp.hdd!

just wanted to share my experiences with fsarchiver. thanks to all the devs for making such a fine piece of software.

- tasker.

Post Reply