Using swap files located outside of / and /usr (Solaris 10)

Solaris 10 upto and including Sol10u3 (and possibly later) don't mount swap files at boot that are located outside of the / and /usr filesystems if nfs/client is disabled.

It's not always desirable to start nfs/client so we use an additional SMF service.

Put this in  (chmod it 444):-

 <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">









 

 





  



 <loctext xml:lang='C'> Add additional swap outside of / and /usr filesystems </common_name>

</service_bundle>

Then put the following at  (chmod it 555):-


 * 1) !/sbin/sh
 * 2) Add additional 'swap files' located on filesystems other than / and /usr
 * 3) Gordon Johnston - 16/07/2007
 * 1) Gordon Johnston - 16/07/2007
 * 1) Gordon Johnston - 16/07/2007

. /lib/svc/share/smf_include.sh


 * 1) swapadd -2 adds swap files that were not mounted by the call to swapadd in filesystem/fs-usr

/sbin/swapadd -2

exit $SMF_EXIT_OK

Then import the service:-

svccfg -v import /var/svc/manifest/system/filesystem/RKswap.xml

Then you can enable and start the service with:-

svcadm enable RKswap

To remove the swap again use 'swap -d' using svcadm disable will not umount the swap, it will however prevent it from being used at the next boot.

Don't forget to exclude the swap file from NetBackup!