Hi all,
I am new to solaris and using solaris10u10.I have an issue with zpool with Multipathing software installed on it. The issue is after reboot zpool goes to UNAVAIL state and the temporary solution we are using is export the pool before reboot and import after reboot. I was planning to write a script that would excecute 'zpool import -a' command upon system coming up. Similarly can we write script that will excecute 'zpool export -a' before system shutsdown?? Please suggest me any guide which i can follow to do the above.
Put a file in this directory, owned by root, called K99stopzpool. The K99 part is important.
Place the stop command you want in there.
/etc/rc2.d
Do the samething for a "start" script: S99startzpool. Put your start up command in there.
This is a quick hack. Be sure to remove it later on. And read up on booting, starting and stopping your system in one of the sysadmin guides for Soalris.
As you are using Solaris 10, a better solution would be to take advantage of SMF services. Here's a sample manifest for your case. You need to customize it to add dependencies (optional, but you should do it):
Verify the xml file:
Import the configuration in SMF database:
Enable the service:
Please be advised that this is just a sample manifest which I made from scratch and can contain errors. As I did not have time to test it, please make sure you test it properly before implementing in a production environment.
@admin_xor : Hi thanks for reply, Is the stop command mandatory for smf? As mentioned 'zpool export -a' command was what i wanted to put there. But there ia no -a option for export. So the only way left out is deleting the /etc/zfs/zpool.cache. Can i add rm /etc/zfs/zpool.cache in that xml file for stop command?? ie.,<exec_method type="method" name="stop" exec="/usr/sbin/rm /etc/zfs/zpool.cache ??
Sure, you can put virtually any command in that section (stop command is not mandatory, but keep in mind that SMF will have no handle while trying to shutdown the service). That command will be executed while doing an "svcadm disable" or while shutting down/rebooting the system. But, I would encourage you to make a shell script and implement start and stop method in the script. Later you can call the script with "start" or "stop" argument from the manifest, just as shown in the PDF.
I am not really confident about the consequences of removing zpool.cache. Why don't you try "zpool export pool_name"?
Last edited by admin_xor; 03-07-2012 at 05:55 PM..
@admin_xor: We cant keep track of what all pools customer is using. So it is not possible to write such a script. But i guess setting zpool cachefile=none, is noting but deleting the same. I see that after set cachefile=none <poolz> and ls -al /etc/zfs/zpool.cache says no such file or directory.
"zpool set cachefile=none <pools>" prevents cache file to be created for the pools in the first place. If you have tested the setup and everythings is working fine, then it must be OK.