Easy imaging of Solaris using flars – Solaris Flash Archives
As previously posted about, the Solaris install is a bit of a slug due to the way the package manager processes the huge amount of files contained in a package.
Flash Archives (flar files) are one solution to this problem. Let’s say you’ve built a model install – everything is in place, all your custom packages, banners, OE tweaks – the works. Wouldn’t it be nice if you could take an image of that Solaris install, to slap down somewhere else?
Or maybe take point in time image snapshots of an environment, for use by developers to let them quickly roll back to a known previous version of their software?
Flash archives let you do all of this. At their most basic, they’re a way of taking an image of a Solaris install. You end up with a single (large) file, which can then be archived/transferred/restored/whatever.
flars are easy to use – the flarcreate command is all you need:
bash-3.00# flarcreate -n "T2k Sol10 8/07" -x /var/flars -R / /var/flars/sun4v_sol_10_Generic_120011-14.flar Full Flash Checking integrity... Integrity OK. Running precreation scripts... Precreation scripts done. Creating the archive... 2019951681 blocks Archive creation complete. Running postcreation scripts... Postcreation scripts done. Running pre-exit scripts... Pre-exit scripts done. bash-3.00#
The syntax is pretty straightforward:
- -n specifies the name you’re giving to your flar
- -x says what files and directories to exclude – in this case, we don’t want to include the directory where we’re creating and storing our flars
- -R says where the root of the flar will be – in this case we’re imaging a full Solaris install, so we want to start from /
- and the final part is the full path and filename of the flar we are creating
One thing that it’s important to remember, is that flarcreate will follow symlinks and mount points. If you have a 100gb /export/home, it will try and add that to your flar. This may not be what you want – especially if you’re creating a Solaris image for Jumpstart – so flars are best created from single user mode, when the system is idle and nothing unnecessary is mounted or running.
Another important point to note is that flars are hardware class dependant. If I create an image of a sun4v Solaris install (in this case, a trusty Sun T2000) then the flar will just contain the kernel and driver files for sun4v. If you try and boot a sun4u box (like a Sun V440) it’s going to go horribly wrong.
If you want to use flars to Jumpstart machines, you’ll need to have a master flar image for each machine hardware class you have in your estate – we can find this out with the uname command:
bash-3.00# uname -m sun4u
We can use flar info to query a flar file to see what it contains:
bash-3.00# flar info sun4v_sol_10_Generic_120011-14.flar archive_id=afe30bf4ebb65085a54c5179a6f62a1c files_archived_method=cpio creation_date=20081118211329 creation_master=sunt2k-001 content_name=solaris_10_4v_Generic_120011-14 creation_node=sunt2k-001 creation_hardware_class=sun4v creation_platform=SUNW,Sun-Fire-T200 creation_processor=sparc creation_release=5.10 creation_os_name=SunOS creation_os_version=Generic_120011-14 files_compressed_method=none files_archived_size=4039903362 files_unarchived_size=4039903362 content_architectures=sun4v type=FULL
And that’s it, basically. There’s not much to it, and it’s pretty simple to use. flars function in pretty much the same way as a normal archive file – we can use the flar command to list files inside the archive and find out more about the archive itself.