How To Create A Solaris Flash Archive (FLAR)
Imagine yourself building a server. The build process is at a critical point. You’ve been slaving away for days and the next step could have this sexy new feature running or it could leave the server in a flaming heap. Do you hit Enter or not?
Or maybe you’ve reached that golden point when the server is just perfect and you’d want all other servers built exactly the same way. You’d bottle this configuration if you could, but how?
Well, aren’t you lucky? Solaris has a feature known as flash archive (FLAR) that will allow you to take a “snapshot” of your server and put it away in a safe location. Sort of like an insurance policy. But what makes this insurance policy good is it gives you options. You can restore a flash archive not only from a CD install but also from Jumpstart or Live Upgrade.
In this example, we create a flash archive and save it to an NFS-mounted filesystem in another server. This approach allows us to store the flash archive off the server being built yet making it immediately available in case we have a need to restore it.
# df -h /flash Filesystem size used avail capacity Mounted on solaris-nfs:/u09/flash 39G 40M 39G 1% /flash #
Once the destination is set it is but a matter of running the flarcreate command to create the FLAR. We give the flash archive a human-readable name using the -n parameter, -a identifies its author and the -R parameter specifies its root directory.
We exclude the /flash directory using -x. It is important to do this if you are saving the flash archive to a locally-mounted filesystem, otherwise you’ll end up having recursive copies of /flash in your FLAR. NFS-mounted filesystems are excluded by default. The last argument is the filename that we want to save the flash archive as. It’s a good idea to put the hostname and the date the flash archive was created in the name of the file.
# flarcreate -n "SOL M4000 sol10_u9 - v0.10" -a "email@example.com" \ -R / -x /flash /flash/SOL-m4000-sol10_u9-`uname -n`-`date "+%Y%m%d"`.flar Full Flash Checking integrity... Integrity OK. Running precreation scripts... Precreation scripts done. Determining the size of the archive... 18411341 blocks The archive will be approximately 8.77GB. Creating the archive... 18411341 blocks Archive creation complete. Running postcreation scripts... Postcreation scripts done. Running pre-exit scripts... Pre-exit scripts done. # # ls -lh /flash total 18420384 -rw-r--r-- 1 nobody nobody 8.8G Oct 27 12:47 SOL-m4000-sol10_u9-solaris-srv-20111027.flar #
Run the flar command to check the attributes of the flash archive.
# flar info /flash/SOL-m4000-sol10_u9-solaris-srv-20111027.flar archive_id=ea75451974d94ed4d9d222d07eccd5f0 files_archived_method=cpio creation_date=20111027000219 creation_master=solaris-srv content_name=SOL M4000 sol10_u9 - v0.10 creation_node=solaris-srv creation_hardware_class=sun4u creation_platform=SUNW,SPARC-Enterprise creation_processor=sparc creation_release=5.10 creation_os_name=SunOS creation_os_version=Generic_144488-06 files_compressed_method=none files_archived_size=9426618319 files_unarchived_size=9426618319 firstname.lastname@example.org content_architectures=sun4u type=FULL #