We can create an image of Solaris operating system by using the flarcreate
command. This image can be used for reinstall the OS in the other machines. Even that flar is an image of an operating system, flar image deesn’t contain some host specific information like IP address, hostname, routing rules, etc.
To create the flare image we use the following command :
# flarcreate -n solaris9 -c -S -R / -x /sharedspace -x /s10 /s10/solaris9.flar
There are some option for flarcreate
command :
-
-n
: defines name of the flar image -
-c
: add compression to the image result -
-S
: do not include sizing information -
-R
: set root directory of the master operating system. For above example the root OS is/
. -
-x
: exclude the specific directory from the image. For above example flar image created will not contain the directory/s10
&/sharedspace
. - The output image defined in the end of command. For above example the result (called
solaris9.flar
) will be stored in/s10
directory
There are some other option available, you can find the detail in the man
page of flarcreate
command. Sometime we can skip some of options, below is the example :
bash-2.05# flarcreate -n testflar -R / -S /export/fsi/testflar.flar Full Flash Checking integrity... Integrity OK. Running precreation scripts... Precreation scripts done. Creating the archive... bash-2.05#
After we get the output, we can check the output file using “flar info"
command like example below :
bash-2.05# flar info tesflar.flar archive_id=0a408a1bd7f6db712e78398a07930616 files_archived_method=cpio creation_date=20071024081100 creation_master=app-server content_name=tesflar creation_node=app-server creation_hardware_class=sun4us creation_platform=FJSV,GPUZC-M creation_processor=sparc creation_release=5.9 creation_os_name=SunOS creation_os_version=Generic_122300-08 files_compressed_method=none files_archived_size=5551073973 content_architectures=sun4us type=FULL
I’m trying to create a flar of a zfs root pool of an LDOM/Global Zone with all of its component parts to use as input to create a new non-global zone. The resulting output is missing at least the contents of /opt, which has a dataset of rpool/opt . It is not included in the archive. This is the syntax I am using:
sudo flarcreate -S -n 102111 -L cpio -D /u04 /u02/102221_Lcpio.flar
These are the messages:
Archive format requested is cpio
This archiver format is NOT VALID for flash installation of ZFS root pool.
This format is useful for installing the system image into a zone.
Reissue command without -L option to produce an archive for root pool install.
Full Flash
Checking integrity…
Integrity OK.
Any thoughts on how to get /opt (and whatever else has been silently excluded) to be included?
Thanks,
Ken
Hi Ken, have you try using “-R /” to define your root directory?
Is there a way to extract the image to a network path?
Yes, it is. I use nfs shares mounted at i.e. /var/net/mynfsshare
You have to use flarcreate -n solaris9 -c -S -R / -x /var/net/mynfsshare /var/net/mynfsshare/solaris9.flar
Could not able to create flar image, Could you help on the below error.
flarcreate -n solaris9.30062012 -c /haz/solaris9.302 022012.sol9.flar
flarcreate[684]: syntax error at line 684 : `-m’ unexpected
Hazly, remove the double square brackets around line 684 so that it reads this instead:
${MKDIR} -m 700 $TEMP_DIR ||
This worked for me,
Brilliant, I don’t understand however why it would fail on the test for basically a chmod on /tmp/prog.$$ because the [[ is basically a builtin if test…strange. Removing the [[ makes me think that it is failing to find the TMP_DIR, in the end I suppose it is irrelevant because it is only making it so “others” can’t mess around with the directory, considering I’m not worried about this I’m happy, still makes me wonder what is going on. It’s a possibility the Current PID $$ changes or doesn’t exist at that point [BUG IN THE CODE] and I am running Solaris 9 with outdated patches and software on this particular server so in the end, that is probably the answer.
please suggest how to avoid nfs mounts, I want to take only OS partitions. Any option is there??
Please help
There are a lot of ways but you should read the man page, that is at the foundation of unix, unfortunately you need to read, I like the shortcut answer to but then you never learn it. The -x option for exclude is what you want, do a man flarcreate and check out the -x option.
The other more interesting options [EXPERIMENTAL, what you want to use is the -x from flarcreate above ] (just out of curiosity) would be to umount the nfs mounts prior to the flarcreate (I wonder if that would work) If that doesn’t work just umount the nfs mounts and edit the vfstab or fstab and remove the nfs mounts (Just in case flarcreate reads the vfstab/fstab) Make a backup of the vfstab/fstab file first though and if this is a production server, you shouldn’t mess with it.
HI,
I have an requirement.
i have taken the FLAR Archive from X4200 server. (HD naming is c0t1d0s0)
with the same Flar file, i want to install X4270.(HD naming is c0t3aab43eb2479098d0).
Due to which after the installation the X4270 server is not booting.
I’m trying to create a flar of a zfs root pool of an LDOM with all of its component parts to use as input to create a new system. my server is in cluster so how to take backup and DR on other server
and runing OS 11 on Sparct5-2 server
Rather than using flar, you may want to use ZFS snapshot instead.
Please refer to http://tedytirta.com/2013/09/23/cloning-solaris-10-server/