マウント・ターゲットを作成する場合、そのトランジット暗号化タイプは、共有で許可されているトランジット暗号化モードを反映している必要があります。 異なる VPC 内のリソースによって使用される場合は、共有に対して複数のマウント・ターゲットを作成できます。 ファイル共有のマウントターゲットは、VPCごとに1つ作成できます。
CLIからファイル共有を作成する
開始前に
CLI を使用する前に、IBM Cloud CLI および VPC CLI プラグインをインストールする必要があります。 詳しくは、CLI の前提条件を参照してください。
CLIからの情報収集
ibmcloud is share-create
コマンドを実行する前に、他のファイル共有、マウント・ターゲット、およびファイル・ストレージ・プロファイルに関する情報を表示することで、共有のプロビジョニングに必要な情報を収集できます。
ファイル共有の作成に関する詳細。
詳細 |
リスト・オプション |
内容 |
ファイル共有 |
ibmcloud is shares |
リージョン内のすべての共有をリスト表示します。 |
ファイル共有の詳細 |
ibmcloud is share SHARE_ID |
共有の詳細を確認します。 |
ファイル共有のスナップショット |
ibmcloud is share-snapshots |
ゾーン内で利用可能なスナップショットを一覧表示する。 |
ファイル共有プロファイル |
ibmcloud is share-profiles |
リージョン内のすべてのファイル共有プロファイルをリスト表示します。 ファイル共有の作成に使用できるのは、 dp2 のみです。 |
マウント・ターゲット |
ibmcloud is share-mount-targets SHARE_ID |
ファイル共有のすべてのマウント・ターゲットをリスト表示します。 |
Subnets |
ibmcloud is subnets |
すべてのサブネットをリストします。 |
予約済み IP アドレス |
ibmcloud is subnet-reserved-ips |
サブネット内のすべての予約済みIPアドレスをリストする。 |
セキュリティー・グループ |
ibmcloud is security-groups |
すべてのセキュリティー・グループをリストします。 |
CLIからマウントターゲットなしでファイル共有を作成する
ibmcloud is share-create
コマンドを使用すると、選択したゾーン内のファイル共有を、 dp2
プロファイルを使用して、特定の容量と IOPS 値でプロビジョンできます。 以下の例は、 us-south-2 ゾーンに 1000 IOPS で 1000-GB のファイル共有を作成する方法を示しています。 このファイル共有は、デフォルトのセキュリティー・グループ・アクセス・モードおよびプロバイダー管理の暗号化を使用して作成されます。
$ ibmcloud is share-create --name my-file-share --zone us-south-2 --profile dp2 --size 1000 --iops 1000
Creating file share my-file-share under account Test Account as user test.user@ibm.com...
ID r006-446e7246-9a7f-4585-b4fc-38b549f71ab3
Name my-file-share
CRN crn:v1:bluemix:public:is:us-south-2:a/a1234567::share:r006-446e7246-9a7f-4585-b4fc-38b549f71ab3
Lifecycle state pending
Access control mode security_group
Accessor binding role none
Allowed transit encryption modes user_managed,none
Zone us-south-2
Profile dp2
Size(GB) 1000
IOPS 1000
Encryption provider_managed
Mount Targets ID Name
No mounted targets found.
Resource group ID Name
6edefe513d934fdd872e78ee6a8e73ef defaults
Created 2025-04-18T19:18:37+00:00
Replication role none
Replication status none
Replication status reasons Status code Status message
- -
Snapshot count 0
Snapshot size 0
Source snapshot -
セキュリティー・グループのアクセス・モードはデフォルトであり、推奨される設定です。 ただし、VPC 内のすべてのコンピュート・ホストがファイル共有をマウントできるようにする VPC アクセス・モードでファイル共有を作成することを選択できます。 以下の例を参照してください。
$ ibmcloud is share-create --name my-vpc-file-share --zone us-south-2 --profile dp2 --size 1000 --iops 500 --access-control-mode vpc
Creating file share my-vpc-file-share under account Test Account as user test.user@ibm.com...
ID r006-5016920c-a53a-44ad-86c3-ea0f76e88876
Name my-vpc-file-share
CRN crn:v1:bluemix:public:is:us-south-2:a/a1234567::share:r006-5016920c-a53a-44ad-86c3-ea0f76e88876
Lifecycle state pending
Access control mode vpc
Accessor binding role none
Zone us-south-2
Profile dp2
Size(GB) 1000
IOPS 500
Encryption provider_managed
Mount Targets ID Name
No mounted targets found.
Resource group ID Name
6edefe513d934fdd872e78ee6a8e73ef defaults
Created 2025-04-18T19:22:41+00:00
Replication role none
Replication status none
Replication status reasons Status code Status message
- -
Snapshot count 0
Snapshot size 0
Source snapshot -
コマンド・オプションについて詳しくは、「 ibmcloud is share-create
」を参照してください。
CLIからファイル共有のマウントターゲットを作成する
ファイル共有のマウント・ターゲットを作成するには、 share-mount-target-create
コマンドを実行します。 始める前に、必要な情報を収集してください。
マウント・ターゲットを作成するときは、そのターゲットの対象となるファイル・シェアを指定する必要があります。 ファイル共有の名前または ID を使用できます。 VPC も、その ID または名前を使用して指定する必要があります。 VPC は各マウント・ターゲットにおいて固有でなければなりません。 共有へのアクセスを管理するために使用するセキュリティー・アクセス・グループも指定する必要があります。 マウント・ターゲットに関連付けるセキュリティ・グループは、共有をマウントするすべてのサーバーから、
NFS ポートでの TCP プロトコルのインバウンド・アクセスを許可する必要があります。
最後に、マウント・ターゲットの 仮想ネットワーク・インターフェース を作成するために必要なオプションの値を指定する必要があります。 適切な CLI コマンドを使用して、使用可能な サブネット、 サブネット内の予約 IP アドレス、
セキュリティー・グループ をリストし、必要な情報を取得します。
以下の例では、セキュリティー・グループ・アクセス・モードを持つファイル共有の仮想ネットワーク・インターフェースを使用して、マウント・ターゲットを作成します。
$ ibmcloud is share-mount-target-create my-file-share --subnet my-subnet --name my-cli-share-mount-target-1 --vni-name my-share-vni-1 --vni-sgs my-sg --resource-group-name Default --vpc my-vpc
Mounting target for share r006-b696742a-92ee-4f6a-bfd7-921d6ddf8fa6 under account Test Account as user test.user@ibm.com...
ID r006-dd497561-c7c9-4dfb-af0a-c84eeee78b61
Name my-cli-share-mount-target-1
VPC ID Name
r006-6e8fb140-5668-45b8-b98a-d5cb0e0bf39b my-vpc
Access control mode security_group
Resource type share_mount_target
Virtual network interface ID Name
r006-13c070d8-d038-49c6-95f5-e8503c5595e3 my-share-vni-1
Lifecycle state pending
Mount path -
Transit Encryption none
以下の例では、VPC アクセス・モードを持つファイル共有のマウント・ターゲットを作成します。
$ ibmcloud is share-mount-target-create my-vpc-file-share --vpc my-vpc --name my-vpc-mount-target
Mounting target for share r006-b1707390-3825-41eb-a5bb-1161f77f8a58 under account Test Account as user test.user@ibm.com...
ID r006-5ed68506-860e-4dea-a1eb-9634704e3c4d
Name my-vpc-mount-target
VPC ID Name
r006-6e8fb140-5668-45b8-b98a-d5cb0e0bf39b my-vpc
Access control mode vpc
Resource type share_mount_target
Lifecycle state pending
Mount path -
Transit Encryption none
Created 2023-10-18T23:09:43+00:00
コマンド・オプションについて詳しくは、「 ibmcloud is share-mount-target-create
」を参照してください。
CLIからマウントターゲットでファイル共有を作成する
ibmcloud is share-create
コマンドを使用して、1 つ以上のマウント・ターゲットとのファイル共有を 1 つのステップで作成できます。 ゾーン名、 ファイル共有プロファイル、ファイル共有サイズ、および IOPS を指定する必要があります。 名前、ユーザー・タグ、および初期所有者 UID を指定することもできます。 マウント・ターゲットを作成するには、マウント・ターゲット情報を
JSON 形式で指定する必要があります。
以下の例は、 us-south-2
ゾーンで 500 GB の容量と 2000 IOPS を持つファイル共有を作成する方法を示しています。 ファイル共有は env:dev
でタグ付けされ、セキュリティー・グループ・アクセス制御モードを持ちます。 ファイル共有は、マウント・ターゲット my-new-mount-target
を使用して、許可された仮想サーバーにマウントできます。
$ ibmcloud is share-create --name my-new-file-share --zone us-south-2 --profile dp2 --size 500 --iops 2000 --allowed-transit-encryption-modes user_managed,none --user-tags env:dev --mount-targets '
>[{"name":"my-new-mount-target","virtual_network_interface": {"name":"my-vni","subnet": {"id":"r006-298acd6c-e71e-4204-a04f-fe4a4dd89805"}}}]'
Creating file share my-new-file-share under account Test Account as user test.user@ibm.com...
ID r006-925214bc-ded5-4626-9d8e-bc4e2e579232
Name my-new-file-share
CRN crn:v1:bluemix:public:is:us-south-2:a/a1234567::share:r006-925214bc-ded5-4626-9d8e-bc4e2e579232
Lifecycle state pending
Access control mode security_group
Accessor binding role origin
Allowed transit encryption modes user_managed,none
Zone us-south-2
Profile dp2
Size(GB) 500
IOPS 2000
User Tags env:dev
Encryption provider_managed
Mount Targets ID Name
r006-ad313f6b-ccb5-4941-a5f7-0c953f1043df my-new-mount-target
Resource group ID Name
db8e8d865a83e0aae03f25a492c5b39e Default
Created 2023-10-19T00:30:11+00:00
Replication role none
Replication status none
Replication status reasons Status code Status message
- -
Snapshot count 0
Snapshot size 0
Source snapshot -
以下の例では、VPC アクセス・モードのファイル共有と、VPC 内の任意の仮想サーバー・インスタンスで使用できるマウント・ターゲットを作成します。
$ ibmcloud is share-create --name my-file-share-8 --zone us-south-1 --profile dp2 --size 40 --iops 2000 --user-tags env:dev --mount-targets '[{"name": "my-new-mount-target","vpc": {"name": "my-vpc"}}]'
Creating file share my-file-share-8 under account Test Account as user test.user@ibm.com...
ID r006-95ec87ba-c5fd-4178-a114-2a55c4d907d4
Name my-file-share-8
CRN crn:v1:bluemix:public:is:us-south-1:a/a1234567::share:r006-95ec87ba-c5fd-4178-a114-2a55c4d907d4
Lifecycle state pending
Access control mode vpc
Accessor binding role none
Zone us-south-1
Profile dp2
Size(GB) 40
IOPS 2000
User Tags env:dev
Encryption provider_managed
Mount Targets ID Name
r006-8b917757-ad19-4bec-8417-83157b047cea my-new-mount-target
Resource group ID Name
6edefe513d934fdd872e78ee6a8e73ef defaults
Created 2025-04-18T19:36:35+00:00
Replication role none
Replication status none
Replication status reasons Status code Status message
- -
Snapshot count 0
Snapshot size 0
Source snapshot -
CLI からのお客様管理の暗号化を使用したファイル共有の作成
デフォルトでは、 File Storage for VPC 共有は、 IBM-管理された暗号化で暗号化される。 ただし、サポートされているいずれかの鍵管理サービスを使用して独自のルート鍵を作成またはインポートすることにより、ファイル共有のエンベロープ暗号化を作成することもできます。 詳しくは、 エンベロープ暗号化を使用したデータ保護 を参照してください。
お客様管理の暗号化を使用してファイル共有を作成する方法について詳しくは、 お客様管理の暗号化を使用したファイル共有の作成 を参照してください。
CLIからスナップショットからファイル共有を作成する
ファイル共有のスナップショットを使用して、同じゾーンに別のファイル共有を作成できます。 スナップショットに基づいてファイル共有を作成するには、 ibmcloud is share-create
コマンドを実行します。
スナップショットの名前、ID、またはCRNを指定できます。 スナップショットの名前を指定する場合は、スナップショットが属するファイル共有の名前またはIDも指定する必要があります。 スナップショット名はファイル共有レベルで一意でなければなりませんが、別のファイル共有が同じ名前のスナップショットを持つことができます。
ibmcloud is share-create --snapshot r026-7647ba64-9728-4bb4-be2f-d958f738fdae
スナップショットからファイル共有を作成する方法の詳細とその他の例については、 ファイル共有スナップショットからデータを復元する を参照してください。
CLIでファイル共有を作成する際の補足IDの追加
CLIでは、 --initial-owner-uid
と --initial-owner-gid
プロパティに UID
と GID
の値を設定して、ファイル共有へのアクセスを制御することができます。 ファイル共有をマウントする場合は、ルート・フォルダーは必ずそのユーザー ID とグループ ID の所有者を使用します。 共有の作成時に、 UID
または
GID
、あるいはその両方を設定することができます。
仮想サーバーインスタンスから補足ID(UIDまたはGID)を変更した場合、変更されたことを判別することはできません。 その結果、 initial_owner
、ファイル・ストレージ・システムでのみ変更が行われるが、CLIやAPIのレスポンスには変更が反映されない。
表1に、設定できるUIDとGIDの値、および予約されている値を示す。
Unix/Linux® supplemental ID values.
ID 値 |
説明 |
UID |
|
UID 0 |
root 用に予約済み。 |
UID 1 から 99 |
事前定義アカウント用に予約済み。 |
UID 100 から 999 |
システムによって管理システム・アカウントおよびグループ用に予約済み。 |
UID 1000 から 10000 |
アプリケーション・アカウントによって使用されます。 |
UID 10000+ |
ユーザー・アカウントに使用できます。 |
GID |
|
GID 0 |
root 用に予約済み。 |
GID 1 から 99 |
システムおよびアプリケーションで使用するために予約済み。 |
GID 100+ |
ユーザーのグループに割り振られます。 |
共有作成時に補足IDを設定するには、 ibmcloud is share-create
コマンドを実行し、 --initial-owner-gid
と --initial-owner-gid
プロパティに補足IDを指定します。 以下の例を参照してください。
$ ibmcloud is share-create --name my-file-share --zone us-south-2 --profile dp2 --size 1000 --iops 1000 --initial-owner-gid 101 --initial-owner-uid 10001
Creating file share my-file-share under account Test Account as user test.user@ibm.com...
ID r006-1579b805-1b6f-4a2e-be9b-e0041ef018c9
Name my-file-share
CRN crn:v1:bluemix:public:is:us-south-2:a/a123456::share:r006-1579b805-1b6f-4a2e-be9b-e0041ef018c9
Lifecycle state pending
Access control mode security_group
Accessor binding role none
Allowed transit encryption modes user_managed,none
Zone us-south-2
Profile dp2
Size(GB) 1000
IOPS 1000
Encryption provider_managed
Mount Targets ID Name
No mounted targets found.
Resource group ID Name
6edefe513d934fdd872e78ee6a8e73ef defaults
Created 2025-04-18T19:18:37+00:00
Replication role none
Replication status none
Replication status reasons Status code Status message
- -
Snapshot count 0
Snapshot size 0
Source snapshot -
APIでファイル共有を作成する
REST API を直接呼び出して、ファイル共有とマウント・ターゲットを作成できます。
開始前に
API環境をセットアップする。 IAM トークン、API エンドポイント、および API バージョンを表す変数を定義します。 手順については、API および CLI の環境のセットアップを参照してください。
generation
パラメーターを指定し、 generation=2
を指定する必要があります。 詳細については、 Virtual Private Cloud API リファレンスの Generation を参照してください。
API についての知識を身に付けるには、IBM Cloud コンソールのプロビジョニングのページの**「サンプル API 呼び出しの取得 (Get sample API call)」**をクリックしてください。 API 要求の正しい順序を確認し、アクションとその依存関係について理解を深めることができます。
APIでファイル共有を作成する
ファイル共有を作成するための POST /shares
要求を行います。 ファイル共有のサイズ、名前、IOPS プロファイル、ゾーンを指定します。 きめ細かなアクセス権限でファイル共有を作成したい場合は、アクセスモードとして「security_group
指定する。 セキュリティグループアクセスモードを持つ共有は、転送中の暗号化、クロスゾーンマウント、スナップショット、バックアップもサポートするように設定できる。 以下の例を参照してください。
curl -X POST \
"$vpc_api_endpoint/v1/shares?version=2024-05-06&generation=2"\
-H "Authorization: $iam_token" \
-d '{
"access_control_mode": "security-group",
"allowed_transit_encryption_modes": ["none", "user-managed"],
"size": 4800,
"iops": 3000,
"name": "myshare-1",
"profile": {"name": "dp2"},
"zone": {"name": "us-south-1"}
}
マ ウ ン ト タ ーゲ ッ ト を作成す る 際に、 仮想サーバ イ ン ス タ ン ス が属す る セキ ュ リ テ ィ グループのメンバである仮想ネッ ト ワーク イ ン タ ーフ ェ イ ス を指定す る 必要があ る こ と を確認 し て く だ さ い。
次の例は、4800GBのファイル共有を作成するリクエストを示しています。 これは、アクセス制御モード vpc
を指定します。これにより、各マウント・ターゲットの VPC 内のすべてのクライアントがこのファイル共有にアクセスできるようになります。 このオプションは安全性が低く、新しい機能をサポートしていない。
curl -X POST \
"$vpc_api_endpoint/v1/shares?version=2023-08-08&generation=2"\
-H "Authorization: $iam_token" \
-d '{
"size": 4800,
"iops": 3000,
"name": "myshare-1",
"profile": {"name": "dp2"},
"access_control_mode": "vpc",
"zone": {"name": "us-south-1"}
}'
正常な応答は、次の例のようになります。
{
"access_control_mode": "vpc",
"created_at": "2023-08-08T22:31:50Z",
"crn": "crn:[...]",
"encryption": "provider_managed",
"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/acd96d70-b8d3-4b56-ad7f-9c1035df93b2",
"id": "acd96d70-b8d3-4b56-ad7f-9c1035df93b2",
"initial_owner": {
"gid": 0,
"uid": 0
},
"iops": 3000,
"lifecycle_state": "pending",
"name": "myshare-1",
"profile": {
"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/dp2",
"name": "dp2",
"resource_type": "share_profile"
},
"replication_role": "none",
"replication_status": "none",
"replication_status_reasons": [],
"resource_group": {
"crn": "crn:v1:public:resource-controller::a/e2f80b84-bc75-4f53-8737-8193ef1d1a7b::resource-group:e96d1fa9-76f2-4c87-a737-dbab3a947b24",
"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/e96d1fa9-76f2-4c87-a737-dbab3a947b24",
"id": "e96d1fa9-76f2-4c87-a737-dbab3a947b24",
"name": "Default"
},
"resource_type": "share",
"size": 4800,
"mount_targets": [],
"zone": {
"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1",
"name": "us-south-1"
}
}
API を使用したファイル共有のマウント・ターゲットの作成
このリクエストは、既存のファイル共有にマウントターゲットを作成または追加します。 この例では、ファイル共有のアクセス制御モードが vpc
であるため、 vpc
プロパティーが指定されています。 転送中のデータ暗号化は有効にできない。
マウント・ターゲットと共有のアクセス制御モードが一致している必要があります。 両方とも vpc
または security_group
のいずれかでなければなりません。 security_group
アクセス・モードでマウント・ターゲットを作成する場合は、共有の allowed_transit_encryption_modes
に注意してください。 transit_encryption
値は、共有に許可されている内容を反映している必要があります。
curl -X POST \
"$vpc_api_endpoint/v1/shares/$share_id/mount_targets?version=2023-08-08&generation=2"\
-H "Authorization: Bearer $iam_token"\
-H 'Content-Type: application/json'\
-d '{
"access_control_mode": "vpc"
"name": "mount-target-name1",
"vpc": {"id": "6e01bc24-4a6e-4a0c-a1bd-4caa0c8159e7"},
"transit_encryption": "none"
}'
正常な応答は、次の例のようになります。
{
"access_control_mode": "vpc",
"created_at": "2023-08-08T23:31:59Z",
"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/ff859972-8c39-4528-91df-eb9160eae918/mount_targets/9fdf4438-f5b4-4b6f-8bca-602494fd6c31",
"id": "9fdf4438-f5b4-4b6f-8bca-602494fd6c31",
"lifecycle_state": "pending",
"mount_path": "domain.com:/vol_xyz_2891fd0a_63aa_4deb_9ed5_1159e37cb5aa",
"name": "mount-target-name1",
"resource_type": "share_target",
"transit_encryption": "none",
"vpc": {
"crn": "crn:[...]",
"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/e6ff7b61-feb4-4c87-94aa-277d6f93e164",
"id": "e6ff7b61-feb4-4c87-94aa-277d6f93e164",
"name": "vpc-name1",
"resource_type": "vpc"
}
}
サブネットとセキュリティー・グループを指定して、既存のファイル共有にマウント・ターゲットを追加する
POST /shares/{share_id}/mount_targets
要求を行い、マウント・ターゲット・ネットワーク・インターフェースのサブネットおよびセキュリティー・グループを指定します。 マウント・ターゲットに関連付けるセキュリティ・グループは、共有をマウントするすべてのサーバーから、 NFS ポートでの TCP プロトコルのインバウンド・アクセスを許可する必要があります。
この例では、ID で識別される既存のファイル共有にマウント・ターゲットを追加し、ネットワーク・インターフェースを定義するためのサブネットとセキュリティー・グループを提供します。 転送中の暗号化が有効になっている。
curl -X POST "$vpc_api_endpoint/v1/shares/f1ab81ef-dd30-459a-85e0-9094164978b1/mount_targets/?version=2023-07-18&generation=2"\
-d '{
"virtual_network_interface": {
"subnet": {"id": "1a0b3d75-8a62-4c78-9263-f9bcd25a8759"},
"security_groups": [{"id": "b2599112-7027-480e-ad1b-fd917d2fcb84"}]
},
"transit_encryption": "user_managed"
}'
APIを使ったファイル共有とマウントターゲットの作成
以下の要求例では、VPC 全体のアクセス・モードを持つファイル共有と、指定された VPC 内のすべての仮想サーバー・インスタンスで使用できるマウント・ターゲットを作成します。 また、 ユーザー・タグ も共有に追加されます。
マウント・ターゲットへのアクセスは VPC 全体にわたります。VPC 内のすべてのインスタンスがこのファイル共有にアクセスできます。 クロスゾーン・マウンティングやトランジット中のデータ暗号化といった新しい機能はサポートされていない。
curl -X POST \
"$vpc_api_endpoint/v1/shares?version=2025-04-08&generation=2\
-H "Authorization: Bearer $iam_token"\
-H 'Content-Type: application/json'\
-d '{
"access_control_mode": "vpc",
"size": 4800,
"iops": 48000,
"mount_targets": [
{
"name": "mount-target-name1",
"vpc": {"id": "a1fb6c4f-6a63-4d34-8bf6-55fab89e932a"}
}
],
"name": "share-name1",
"profile": {"name": "dp2"},
"user_tags": [
"env:test",
"env:prod"
],
"resource_group": {},
"zone": {"name": "us-south-1"}
}'
正常な応答は、次の例のようになります。
{
"access_control_mode": "vpc",
"allowed_transit_encryption_modes": "none",
"created_at": "2025-04-08T23:31:59Z",
"crn": "crn:[...]",
"encryption": "provider_managed",
"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/ff859972-8c39-4528-91df-eb9160eae918",
"id": "ff859972-8c39-4528-91df-eb9160eae918",
"iops": 48000,
"lifecycle_state": "stable",
"name": "share-name1",
"profile": {
"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/dp2",
"name": "dp2",
"resource_type": "share_profile"
},
"replication_role": "none",
"replication_status": "none",
"replication_status_reasons": [],
"resource_group": {
"crn": "crn:[...]",
"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/6b45d0aa-e0a6-478b-a5d9-bb45b106676d",
"id": "6b45d0aa-e0a6-478b-a5d9-bb45b106676d",
"name": "Default"
},
"resource_type": "share",
"size": 4800,
"mount_targets": [
{
"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/ff859972-8c39-4528-91df-eb9160eae918/mount_targets/9fdf4438-f5b4-4b6f-8bca-602494fd6c31",
"id": "9fdf4438-f5b4-4b6f-8bca-602494fd6c31",
"name": "mount-target-name1",
"resource_type": "share_target",
"vpc": {
"crn": "crn:[...]",
"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/e6ff7b61-feb4-4c87-94aa-277d6f93e164",
"id": "e6ff7b61-feb4-4c87-94aa-277d6f93e164",
"name": "vpc-name1",
"resource_type": "vpc"
}
}
],
"user_tags": ["env:test","env:prod"],
"zone": {
"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1",
"name": "us-south-1"
}
}
サブネットの指定によるファイル共有およびマウント・ターゲットの作成
ファイル共有のデフォルトのアクセス制御モードは security_group
です。 vpc-wideオプションよりも安全で、より新しい機能をサポートしている。 ファイル共有の作成と同時にネットワーク・インターフェイスでマウント・ターゲットを作成するには、「POST /shares
リクエストをしてサブネットを指定する。 subnet
プロパティの指定は、仮想ネットワーク・インターフェイス を指定していない場合に必要です。
以下の例では、予約済みIPアドレスでマウントターゲットに 仮想ネットワークインタフェース を作成してアタッチし、選択したセキュリティグループのルールを適用しています。 マウント・ターゲットに関連付けるセキュリティ・グループは、共有をマウントするすべてのサーバーから、 NFS ポートでの TCP プロトコルのインバウンド・アクセスを許可する必要があります。
この例では、マウント・ターゲット・セクションはサブネット ID を指定しています。 システムは、マウント・ターゲットの作成時に、そのサブネットから 仮想ネットワーク・インターフェース 用の予約 IP を選択します。
curl -X POST "$vpc_api_endpoint/v1/shares?version=2023-08-08&generation=2"\
-H "Authorization: $iam_token"\
-d '{
"allowed_transit_encryption_modes": ["user-managed"],
"size": 10,
"name": "my-share-1",
"profile": {"name": "dp2"},
"zone": {"name": "us-south-1"},
"mount_targets": [{
"virtual_network_interface": {"subnet": {"id": "4e95744c-7e64-48c9-b5d2-3b6481b1dfde"}},
"transit_encryption": {"user_managed"}}]
}'
transit_encryption
プロパティーが user_managed
に設定されている場合、インスタンス ID 証明書を使用した転送中の暗号化が有効になります。 transit_encryption
プロパティのデフォルト値は「none
であり、転送中の暗号化を無効にする。 ただし、'allowed_transit_encryption_modes
を 'user-managed
と指定した場合、マウントターゲットは 'transit_encryption
の値として 'user_managed
持たなければならない。
正常な応答は、次の例のようになります。
{
"access_control_mode": "security_group",
"allowed_transit_encryption_modes": ["user-managed"],
"created_at": "2023-08-08T12:15:12Z",
"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/90c4bb62-1724-47bd-8c45-f7d37d7c3508/mount_targets/7e5bdb52-676d-43b2-991f-2053cf6855eb",
"id": "7e5bdb52-676d-43b2-991f-2053cf6855eb",
"lifecycle_state": "pending",
"mount_path": "",
"name": "myshare-1",
"primary_ip": {"address": ""},
"resource_type": "share_target",
"size": 10,
"snapshot_count": 0,
"snapshot_size": 0,
"subnet": {
"crn": "crn:[...]",
"href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/4e95744c-7e64-48c9-b5d2-3b6481b1dfde",
"id": "4e95744c-7e64-48c9-b5d2-3b6481b1dfde",
"name": "subnet-2",
"resource_type": "subnet"
},
"transit_encryption": "user-managed",
"virtual_network_interface": {
"crn": "crn:[...]",
"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interface/710y-b8aa945c-7eac-4c15-bad6-a56db9d1e9bd",
"id": "710y-b8aa945c-7eac-4c15-bad6-a56db9d1e9bd",
"name": "enlace-traverse-oat-console",
"resource_type": "VirtualNetworkInterface"
},
"vpc": {
"crn": "crn:[...]",
"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/82fa21ae-a645-4dd5-9136-d48a723bf00e",
"id": "82fa21ae-a645-4dd5-9136-d48a723bf00e",
"name": "my-vpc-2",
"resource_type": "vpc"
},
"user_tags": []
}
サブネットおよびセキュリティー・グループの指定によるファイル共有およびマウント・ターゲットの作成
マウント・ターゲット・ネットワーク・インターフェースを作成するには、 POST /shares
要求を行い、サブネットとセキュリティー・グループを指定します。 マウント・ターゲットに関連付けるセキュリティ・グループは、共有をマウントするすべてのサーバーから、 NFS ポートでの TCP プロトコルのインバウンド・アクセスを許可する必要があります。
この例では、 mount_targets
プロパティーはサブネット ID とセキュリティー・グループ ID を指定します。 transit_encryption
プロパティーを user_managed
に設定すると、インスタンス ID 証明書を使用して転送中の暗号化が有効になります。 デフォルト値は none で、転送中の暗号化を無効にします。
curl -X POST "$vpc_api_endpoint/v1/shares?version=2023-08-08&generation=2"\
-H "Authorization: $iam_token" \
-d '{
"size": 20,
"iops": 100,
"name": "myshare-3",
"profile": {"name": "dp2"},
"zone": {"name": "us-south-1"},
"allowed_transit_encryption_modes": ["user-managed"],
"mount_targets": [{
"virtual_network_interface": {
"subnet": {"id": "4e95744c-7e64-48c9-b5d2-3b6481b1dfde"},
"security_groups": [{"id": "34c09abb-37bf-4ef6-88bb-f63a0ef28915"}]
},
"transit_encryption": {"user_managed"}}
]
}'
以下の応答は、アクセス制御モードが security_group
(デフォルト値) であることを示しています。
{
"access_control_mode": "security_group",
"allowed_transit_encryption_modes": ["user-managed"],
"created_at": "2023-08-08T12:55:40Z",
"crn": "crn:[...]",
"encryption": "provider_managed",
"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-56f91d4a-2801-470a-b368-176bde64e954",
"id": "r006-56f91d4a-2801-470a-b368-176bde64e954",
"initial_owner": {
"gid": 0,
"uid": 0
},
"iops": 100,
"lifecycle_state": "pending",
"name": "myshare-3",
"mount_targets": [
{
"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-56f91d4a-2801-470a-b368-176bde64e954/mount_targets/r006-b8573e2c-60ee-4ecc-9eae-c52f890a8195",
"id": "r006-b8573e2c-60ee-4ecc-9eae-c52f890a8195",
"name": "sticky-idealist-spoiled-sloppily",
"resource_type": "share_target",
"transit_encryption": {"user_managed"}
}
],
"profile": {
"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/dp2",
"name": "dp2",
"resource_type": "share_profile"
},
"replication_role": "none",
"replication_status": "none",
"replication_status_reasons": [],
"resource_group": {
"crn": "crn:[...]",
"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups//678523bcbe2b4eada913d32640909956",
"id": "678523bcbe2b4eada913d32640909956",
"name": "Default"
},
"resource_type": "share",
"size": 20,
"snapshot_count": 10,
"snapshot_size": 10,
"user_tags": [],
"zone": {
"href": "https://us-south.cloud.ibm.com/v1/regions/us-south/zones/us-south-1",
"name": "us-south-1"
}
}
仮想ネットワーク・インターフェースの指定によるファイル共有およびマウント・ターゲットの作成
この操作を実行するには、すでに 仮想ネットワークインターフェイス があり、その仮想ネットワークインターフェイスが他のリソースにアタッチされていない必要があります。
POST /shares
要求を行い、仮想ネットワーク・インターフェースを使用してマウント・ターゲットを作成します。 マウント・ターゲットの「virtual_network_interface
プロパティに、アタッチされていない仮想ネットワーク・インターフェイスのIDを指定する。
curl -X POST "$vpc_api_endpoint/v1/shares?version=2023-08-08&generation=2" \
-H "Authorization: $iam_token" \
-d '{
"size": 10,
"name": "my-share-sc-2",
"profile": {"name": "dp2"},
"zone": {"name": "us-south-3"},
"allowed_transit_encryption_modes": ["none"],
"mount_targets": [{
"name": "mount-target-1",
"transit_encryption": {"none"},
"virtual_network_interface": {"id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9"}
}]
}'
APIでファイル共有を作成する際の補足IDの追加
API を使用して、initial_owner
プロパティーの UID
値と GID
値を設定して、ファイル共有へのアクセスを制御できます。 ファイル共有をマウントする場合は、ルート・フォルダーは必ずそのユーザー ID とグループ ID の所有者を使用します。 POST /shares
呼び出しで共有を作成するときに、 UID
または GID
、あるいはその両方を設定します。
仮想サーバーインスタンスから補足ID(UIDまたはGID)を変更した場合、変更されたことを判別することはできません。 その結果、 initial_owner
はAPIデータベースでは変更されず、ファイル・ストレージ・システムでのみ変更される。
表1に、設定できるUIDとGIDの値、および予約されている値を示す。
Unix/Linux® supplemental ID values.
ID 値 |
説明 |
UID |
|
UID 0 |
root 用に予約済み。 |
UID 1 から 99 |
事前定義アカウント用に予約済み。 |
UID 100 から 999 |
システムによって管理システム・アカウントおよびグループ用に予約済み。 |
UID 1000 から 10000 |
アプリケーション・アカウントによって使用されます。 |
UID 10000+ |
ユーザー・アカウントに使用できます。 |
GID |
|
GID 0 |
root 用に予約済み。 |
GID 1 から 99 |
システムおよびアプリケーションで使用するために予約済み。 |
GID 100+ |
ユーザーのグループに割り振られます。 |
共有の作成時に補足 ID を設定するには、 POST /shares
呼び出しを行い、補足 ID を使用して initial_owner
プロパティーを指定します。 以下の例を参照してください。
curl -X POST \
"$vpc_api_endpoint/v1/shares?version=2023-08-08&generation=2"\
-H "Authorization: $iam_token" \
-d '{
"initial_owner": {"gid": 101,"uid": 10001},
"size": 4800,
"name": "share-name",
"profile": {"name": "dp2"},
"zone": {"name": "us-south-1"}
.
.
.
}'