次に示す手順に従って、システムのリブート後に iSCSI ディスクにアクセスします。
iSCSI LUN のエントリを /etc/vfstab ファイルに追加します。mount at boot オプションを no に設定します。
#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # /dev/dsk/c3t600144F04B555F370000093D00495B00d0s0 - /mnt ufs - no - |
システムのリブート後に iSCSI LUN を自動的にマウントする SMF サービスマニフェストを作成します。
たとえば、次の内容を含む XML マニフェストファイル /var/svc/manifest/network/iscsi/iscsimount.xml を作成します。
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="iscsimount">
<service
name="iscsimount"
type="service"
version="1" >
<single_instance/>
<!--
We depend on the iscsi initiator service
-->
<dependency
name="client"
type="service"
grouping="require_all"
restart_on="none">
<service_fmri value="svc:/network/iscsi/initiator"/>
</dependency>
<instance name="default" enabled="false">
<!-- mount iSCSI volumes -->
<exec_method
type="method"
name="start"
exec="/var/tmp/iscsi_mount"
timeout_seconds="60"/>
<!-- umount iSCSI volumes -->
<exec_method
type="method"
name="stop"
exec="/var/tmp/iscsi_umount"
timeout_seconds="60" />
<property_group name="startd" type="framework">
<propval name="duration" type="astring" value="transient"/>
</property_group>
</instance>
<template>
<common_name>
<loctext xml:lang="C">
iSCSI Mount Service
</loctext>
</common_name>
</template>
</service>
</service_bundle>
|
/var/tmp ディレクトリ内に次のファイルを作成します。
次の bash シェルスクリプトは、/mnt ディレクトリで iSCSI ディスクの mount および umount コマンドを実行します。
bash-4.0# cat /var/tmp/iscsi_mount #!/usr/bin/bash mount /mnt #Add multiple iscsi lun(s) to mount bash-4.0# cat /var/tmp/iscsi_umount #!/usr/bin/bash umount /mnt #Add multiple iscsi lun(s) to umount |
これらのスクリプトに実行権を設定します。次に例を示します。
bash-4.0# chmod u+x /var/tmp/iscsi_mount bash-4.0# chmod u+x /var/tmp/iscsi_umount |
マニフェストをインポートします。
# svccfg import /var/svc/manifest/network/iscsi/iscsimount.xml # svccfg enable iscsimount |
このサービスを有効にしたあとで、システムのシャットダウン時またはリブート時に次のメッセージが表示されることがあります。
iscsi: NOTICE: iscsi session(4) - session logout failed (1) iscsi: NOTICE: iscsi discovery failure - SendTargets method is not enabled iscsi: NOTICE: iscsi discovery failure - iSNS method is not enabled |
これらのメッセージは無視しても問題ありません。または、リブートの直前に次のコマンドを実行することで、メッセージの表示を回避できます。
# svcadm disable -t iscsimount |
Solaris iSCSI イニシエータによってデバイスが発見されると、ログインネゴシエーションが自動的に行われます。Solaris iSCSI ドライバは、利用可能な LUN の個数を判断し、デバイスノードを作成します。この時点で、iSCSI デバイスをほかのすべての SCSI デバイスと同様に扱えます。