Thursday, 1 December 2011

Solaris - Restore a file or directory from flash archive

Flash archives (flar files) are useful to create new servers or recover old ones, but sometimes only need few files or directories from the image.  Here is how to recover individual files from the archive.

First, split the flar file into its components.  This will put everything in tempdir.
# mkdir /tmp/tempdir

Go to the directory where flash (flar file) exist:

# flar -s -d /tmp/tempdir flasharchive.flash

Optionally, list the contents of the archive.  This assumes the flar file was created with the -c, or compress, option:
# cat archive | uncompress | cpio -it

Extract the files.  The flar command doesn't put the initial /, so this will extract the files into the current directory:

# cat archive | uncompress | cpio -idm "opt/sec_mgmt/*"