管理檔案共用、存取元共用連結及裝載目標

透過重新命名、擴充容量、調整 IOPS 和頻寬、新增掛載目標,以及管理存取者共用資料夾的綁定,來管理 File Storage for VPC 共用資料夾。

File Storage for VPC 服務需要 IAM 權限以進行角色式存取控制。 例如,若要建立檔案共用,您至少需要具有編輯者權限。 有關更多信息,請參閱 管理 VPC 基礎設施服務的 IAM 訪問 用於檔案共享。

處理一般檔案共用及存取器共用的差異

下列各節包含修改及更新檔案共用及裝載目標的各種內容的指示。 由於存取元共用的本質,部分內容 (例如,檔案共用設定檔、存取控制模式或容許的傳輸加密模式) 無法變更。 這些內容繼承自原始共用。 對於可修改的存取元共用內容,步驟與更新一般共用相同。 雖然無法建立訪客共用的快照,但如果來源共用有快照,您可以存取訪客共用中的快照。.snapshot 目錄。 此目錄為唯讀。

在主控台中管理檔案共用、存取器共用綁定和掛載目標

在主控台中,您可以:

在主控台中,您可以管理一般檔案共用及存取器共用。 只有共用擁有者可以修改存取控制模式、IOPS 及設定檔之類的內容。 存取元帳戶無法編輯原始共用,並且可以修改存取元共用的較小內容集。

只有以安全群組作為存取控制模式的共用才支援快照。 除非刪除共享的所有快照,否則您無法將存取控制模式變更為 VPC。

在主控台中重新命名檔案共用

  1. 檔案共用詳細資料 頁面上,按一下檔案共用名稱旁邊的 編輯圖示 「編輯」圖示

  2. 請為此檔案共用指定一個新名稱。

有效的檔案共用名稱可以包含小寫英文字母、數字(a-z、0-9)以及連字號(-)的組合,長度最多為 63 個字元。 檔案共用名稱必須以小寫字母開頭。

在主控台中重新命名檔案共用的掛載目標

  1. 移至 檔案共用詳細資料 頁面。
  2. 按一下「動作」圖示 「動作」圖示
  3. 選取 重新命名
  4. 輸入新名稱,然後按一下 重新命名

有效的掛載目標名稱可以包含小寫字母、數字(a-z、0-9)以及連字號(-)的組合,長度最多為 63 個字元。 裝載目標名稱必須以小寫字母開頭。

在主控台中更新檔案共用設定檔

這些指示適用於 beta 版區域檔案共用中使用的上一代檔案共用設定檔(一般用途、5-iops、10-iops 或自訂)。 截至 2026 年 5 月 6 日,這些股份概況已停用。 若要存取目前的功能,您必須將共用的 IOPS 設定檔變更為 dp2。 無法變更使用 dp2rfs 設定檔建立的檔案共用的設定檔。

您可以將檔案共用的設定檔從現行設定檔變更為另一個 IOPS 層級 設定檔、自訂 設定檔或高效能 dp2 設定檔。 您的帳單會根據您選擇的設定檔進行調整。

  1. 移至 檔案共用詳細資料 頁面。
  2. 按一下現行設定檔旁邊的 編輯圖示 「編輯」圖示,或使用 動作 功能表 「動作」圖示,然後選取 編輯 IOPS 設定檔。 側邊畫面會顯示現行設定檔、檔案共用大小及 IOPS 上限。
  3. 對於 新建設定檔,按一下向下箭頭。 您可以選取新的 IOPS 層級、自訂設定檔或 dp2。 對於 自訂 IOPSdp2,根據檔案共用大小指定新的 IOPS 上限。 檔案共用價格會根據您的選擇自動計算。
  4. 點擊「儲存並繼續」。

更新主控台中允許的傳輸加密模式

共用的擁有者可以變更允許的傳輸加密模式。 不過,必須先刪除所有連結,才能變更此內容。 刪除連結會提供原始檔案共用與存取器共用之間的網路路徑,並將連接至存取器共用的裝載目標置於失敗狀態。 如需相關資訊,請參閱 從其他帳戶移除檔案共用的存取權

  1. 檔案共用清單 中選取檔案共用。
  2. 在「檔案共用詳細資料」頁面上,尋找容許的傳輸加密模式。
  3. 按一下 編輯圖示 「編輯」圖示,以變更現行值。

從 CLI 管理檔案共用、存取元共用連結及裝載目標

透過使用 CLI,您可以:

只有以安全群組作為存取控制模式的共用才支援快照。 除非刪除共享的所有快照,否則您無法將存取控制模式變更為 VPC。

從 CLI 重新命名檔案共用

  1. 使用 ibmcloud is shares 指令列出區域中的檔案共用,以找出您要重新命名的檔案共用。 記下檔案共用的名稱和 ID。

    ibmcloud is shares
    
    Listing shares in all resource groups and region us-south under account Test Account as user test.user@ibm.com...
    ID                                          Name                    Lifecycle state   Zone         Profile    Size(GB)   Resource group   Replication role   Accessor binding role   Snapshot count   Snapshot size
    r006-a8d6af48-0c97-4c6b-bab1-fbefdc1e1e03   my-file-share           stable            us-south-2   dp2        10         defaults         none               none                    0                0
    r006-aaf4bfe9-358c-4faa-a4ec-0b955090b940   my-file-share-2         stable            us-south-2   dp2        10         defaults         none               none                    0                0
    r006-a60bfa90-a893-40ad-be34-28ab51a963f9   replica-dal-2           stable            us-south-2   dp2        10         defaults         replica            none                    0                0
    r006-3f21e3c3-e12d-425f-ab77-810cabfde8df   source-dal-1            stable            us-south-1   dp2        10         defaults         source             none                    0                0
    r006-455b601c-8fc1-4476-8771-4708c49c8ef7   my-replica-share-dal-1  stable            us-south-1   dp2        10         defaults         replica            none                    0                0
    r006-4dadac27-cd17-42df-a5fe-1388705d33e0   my-source-share-dal-2   stable            us-south-2   dp2        10         defaults         source             none                    0                0
    r006-cc7ab6a0-bb71-4e03-8ef7-dcffca43717f   my-old-file-share       stable            us-south-1   tier-3iops 40         defaults         none               -                       -                -
    
  2. 執行 ibmcloud is share-update 指令,並使用 --name 選項指定新的檔案共用名稱。

    ibmcloud is share-update r006-a8d6af48-0c97-4c6b-bab1-fbefdc1e1e03 --name my-renamed-share
    
    Updating file share r006-a8d6af48-0c97-4c6b-bab1-fbefdc1e1e03 under account Test Account as user test.user@ibm.com...
    ID                           r006-a8d6af48-0c97-4c6b-bab1-fbefdc1e1e03
    Name                         my-renamed-share
    CRN                          crn:v1:bluemix:public:is:us-south-2:a/a1234567::share:r006-a8d6af48-0c97-4c6b-bab1-fbefdc1e1e03
    Lifecycle state              stable
    Access control mode          vpc
    Zone                         us-south-2
    Profile                      dp2
    Size(GB)                     100
    IOPS                         100
    Encryption                   ipsec
    Mount Targets                ID                          Name
                                 No mounted targets found.
    Resource group               ID                                 Name
                                 6edefe513d934fdd872e78ee6a8e73ef   defaults
    Created                      2023-08-01T17:02:01+00:00
    Encryption key               crn:v1:bluemix:public:kms:eu-de:a/a1234567:key:f602ae93-b915-49bc-a0e1-af29c73e7788
    Latest job                   Job status   Job status reasons
                                 -            -
    Replication cron spec        00 11 * * 0
    Replication role             replica
    Replication status           none
    Replication status reasons   Status code   Status message
                                 -             -
    Snapshot count               0
    Snapshot size                0
    Source snapshot              -
    Allowed Access Protocols     nfs4
    Availability Mode            zonal
    Bandwidth(Mbps)              1
    Storage Generation           1
    

有效的檔案共用名稱可以包含小寫英文字母、數字(a-z、0-9)以及連字號(-)的組合,長度最多為 63 個字元。 檔案共用名稱必須以小寫字母開頭。

如需指令選項的相關資訊,請參閱 ibmcloud is share-update

從 CLI 重新命名檔案共用的裝載目標

  1. 使用 ibmcloud is shares 指令列出地區中的檔案共用。 記下具有您要重新命名之裝載目標的檔案共用名稱及 ID。

  2. 使用共用的名稱或 ID,以使用 ibmcloud is share-mount-targets 指令來尋找其裝載目標。

    ibmcloud is share-mount-targets r006-a8d6af48-0c97-4c6b-bab1-fbefdc1e1e03
    
    Listing share mount target of r006-a8d6af48-0c97-4c6b-bab1-fbefdc1e1e03 in all resource groups and region us-south under account Test Account as user test.user@ibm.com...
    ID                                          Name                     VPC      Lifecycle state   Transit Encryption
    r006-fdbffc45-618c-49f1-bb08-ec530d7be378   my-source-mount-target   my-vpc   stable            none
    
  3. 若要重新命名裝載目標,請使用檔案共用名稱或 ID 及裝載目標名稱來執行 share-mount-target-update 指令。 使用 --name 選項指定新的裝載目標名稱。

    ibmcloud is share-mount-target-update r006-a8d6af48-0c97-4c6b-bab1-fbefdc1e1e03 r006-fdbffc45-618c-49f1-bb08-ec530d7be378 --name my-renamed-mount-target
    

有效的掛載目標名稱可以包含小寫字母、數字(a-z、0-9)以及連字號(-)的組合,長度最多為 63 個字元。 裝載目標名稱必須以小寫字母開頭。

如需指令選項的相關資訊,請參閱 ibmcloud is share-mount-target-update

在 CLI 中更新檔案共用設定檔

這些指示適用於 beta 版區域檔案共用中使用的上一代檔案共用設定檔(一般用途、5-iops、10-iops 或自訂)。 截至 2026 年 5 月 6 日,這些股份概況已停用。 若要存取目前的功能,您必須將共用的 IOPS 設定檔變更為 dp2。 無法變更使用 dp2rfs 設定檔建立的檔案共用的設定檔。

  1. 使用 ibmcloud is shares 指令列出地區中的檔案共用,以找出您要更新的檔案共用。

    ibmcloud is shares
    
    Listing shares in all resource groups and region us-south under account Test Account as user test.user@ibm.com...
    ID                                          Name                    Lifecycle state   Zone         Profile    Size(GB)   Resource group   Replication role   Accessor binding role   Snapshot count   Snapshot size
    r006-a8d6af48-0c97-4c6b-bab1-fbefdc1e1e03   my-file-share           stable            us-south-2   dp2        10         defaults         none               none                    0                0
    r006-aaf4bfe9-358c-4faa-a4ec-0b955090b940   my-file-share-2         stable            us-south-2   dp2        10         defaults         none               none                    0                0
    r006-a60bfa90-a893-40ad-be34-28ab51a963f9   replica-dal-2           stable            us-south-2   dp2        10         defaults         replica            none                    0                0
    r006-3f21e3c3-e12d-425f-ab77-810cabfde8df   source-dal-1            stable            us-south-1   dp2        10         defaults         source             none                    0                0
    r006-455b601c-8fc1-4476-8771-4708c49c8ef7   my-replica-share-dal-1  stable            us-south-1   dp2        10         defaults         replica            none                    0                0
    r006-4dadac27-cd17-42df-a5fe-1388705d33e0   my-source-share-dal-2   stable            us-south-2   dp2        10         defaults         source             none                    0                0
    r006-cc7ab6a0-bb71-4e03-8ef7-dcffca43717f   my-old-file-share       stable            us-south-1   tier-3iops 40         defaults         none               -                       -                -
    
  2. share-update 指令與 --profile 參數一起使用,以依名稱指出新的檔案共用設定檔。

    ibmcloud is share-update my-old-file-share --profile dp2 --size 1000 --iops 3000
    
    Updating file share my-file-share-8 under account Test Account as user test.user@ibm.com...
    ID                           r006-cc7ab6a0-bb71-4e03-8ef7-dcffca43717f
    Name                         my-old-file-share
    CRN                          crn:v1:bluemix:public:is:us-south-1:a/a1234567::share:r006-cc7ab6a0-bb71-4e03-8ef7-dcffca43717f
    Lifecycle state              updating
    Access control mode          vpc
    Zone                         us-south-1
    Profile                      dp2
    Size(GB)                     1000
    IOPS                         3000
    User Tags                    env:dev,env:prod
    Encryption                   provider_managed
    Mount Targets                ID                                          Name
                                 r006-c9d82a15-7ead-4388-abc8-88e81c12ed28   my-target121
    Resource group               ID                                 Name
                                 6edefe513d934fdd872e78ee6a8e73ef   defaults
    Created                      2023-03-27T20:43:36+00:00
    Replication role             none
    Replication status           none
    Replication status reasons   Status code   Status message
                                 -             -
    Snapshot count               0
    Snapshot size                0
    Source snapshot              -
    Allowed Access Protocols     nfs4
    Availability Mode            zonal
    Bandwidth(Mbps)              1
    Storage Generation           1
    

如需指令選項的相關資訊,請參閱 ibmcloud is share-update

從 CLI 更新允許的傳輸加密模式

共用的擁有者可以使用下列值更新允許的傳輸加密模式。

  • 對於區域檔案共用,允許的值為 ipsec,none,ipsec,或 none
  • 對於區域檔案共用,允許的值為 stunnel,none, stunnel,或 none

但是,在變更此屬性之前,必須刪除所有綁定和掛載目標。 刪除連結會提供原始檔案共用與存取器共用之間的網路路徑,並將連接至存取器共用的裝載目標置於失敗狀態。 如需詳細資訊,請參閱 移除其他帳戶對檔案共用的存取權

ibmcloud is share-update my-origin-share --allowed-transit-encryption-modes ipsec
Updating file share my-file-share under account Test Account as user test.user@ibm.com...
ID                               r006-b696742a-92ee-4f6a-bfd7-921d6ddf8fa6
Name                             my-origin-share
CRN                              crn:v1:bluemix:public:is:us-south-2:a/1234567::share:r006-b696742a-92ee-4f6a-bfd7-921d6ddf8fa6
Lifecycle state                  stable
Access control mode              security_group
Accessor binding role            origin
Allowed transit encryption modes ipsec
Origin share CRN                                                                                             Name            Remote account  Remote region
                                 crn:v1:bluemix:public:is:us-south-2:a/7654321::share:r006-d73v40a6-e08f-4d07-99e1-d28cbf2188ed  my-origin-share a7654321        -
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
                                 db8e8d865a83e0aae03f25a492c5b39e   Default
Created                          2024-06-25T22:15:15+00:00
Replication role                 none
Replication status               none
Replication status reasons       Status code   Status message
                                 -             -
 Allowed Access Protocols        nfs4
 Availability Mode               zonal
 Bandwidth(Mbps)                 1
 Storage Generation              1

使用 API 管理檔案共用、存取元共用連結及裝載目標

透過使用 API,您可以:

若要查看 File Storage for VPC API 方法的相關資訊,請參閱 API 參考資料 中的下列小節。

只有以安全群組作為存取控制模式的共用才支援快照。 除非刪除共享的所有快照,否則您無法將存取控制模式變更為 VPC。

使用 API 重新命名檔案共用

發出 PATCH /shares/$share_id 呼叫,以重新命名特定的檔案共用。 請參閱下列範例。

curl -X PATCH \
"$vpc_api_endpoint/v1/shares/$share_id?version=2023-08-08&generation=2"\
  -H "Authorization: Bearer ${API_TOKEN}"\
  -d '{"name": "share-renamed1"}'

成功的回應如下例所示。

{
  "access_control_mode": "vpc",
  "created_at": "2023-07-17T23:31:59Z",
  "crn": "crn:[...]",
  "encryption": "provider_managed",
  "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0995b8c6-c323-4e59-9ea9-fa14dd66bba8",
  "id": "0995b8c6-c323-4e59-9ea9-fa14dd66bba8",
  "iops": 3000,
  "lifecycle_state": "stable",
  "name": "share-renamed1",
  "profile": {
    "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-10iops",
    "name": "tier-10iops",
    "resource_type": "share_profile"
  },
  "resource_group": {
    "crn": "crn:[...]",
    "href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/bfb4a7c7-00d8-400b-98ba-5a67e5851970",
    "id": "bfb4a7c7-00d8-400b-98ba-5a67e5851970",
    "name": "Default"
  },
  "resource_type": "share",
  "size": 100,
  "mount_targets": [],
  "zone": {
    "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1",
    "name": "us-south-1"
  }
}

有效的檔案共用名稱可以包含小寫英文字母、數字(a-z、0-9)以及連字號(-)的組合,長度最多為 63 個字元。 檔案共用名稱必須以小寫字母開頭。

使用 API 重新命名檔案共用的裝載目標

發出 PATCH /shares/$share_id/mount_targets/$target_id 呼叫,以重新命名檔案共用的裝載目標。 請參閱下列範例。

curl -X PATCH \
"$vpc_api_endpoint/v1/shares/$share_id/mount_targets/$target_id?version=2023-08-08&generation=2"\
  -H "Authorization: Bearer ${API_TOKEN}" \
  -d '{"name": "target-renamed1"}

成功的回應如下例所示。

{
  "access_control_mode": "vpc",
  "created_at": "2023-07-18T23:31:59Z",
  "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0995b8c6-c323-4e59-9ea9-fa14dd66bba8/mount_targets/9fdf4438-f5b4-4b6f-8bca-602494fd6c31",
  "id": "9fdf4438-f5b4-4b6f-8bca-602494fd6c31",
  "lifecycle_state": "stable",
  "mount_path": "domain.com:/vol_xyz_2891fd0a_64ea_4deb_9ed5_1159e37cb5aa",
  "name": "target-renamed1",
  "resource_type": "share_target",
  "transit_encryption": "none",
  "vpc": {
    "crn": "crn:[...]",
    "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs8c95b3c1-fe3c-45c-97a6-e43d14088287",
    "id": "82a7b841-9586-43b4-85dc-c0ab5e8b1c7a",
    "name": "vpc-name1",
    "resource_type": "vpc"
  }
}

有效的掛載目標名稱可以包含小寫字母、數字(a-z、0-9)以及連字號(-)的組合,長度最多為 63 個字元。 裝載目標名稱必須以小寫字母開頭。

使用 API 更新檔案共用設定檔

這些指示適用於 beta 版區域檔案共用中使用的上一代檔案共用設定檔(一般用途、5-iops、10-iops 或自訂)。 截至 2026 年 5 月 6 日,這些股份概況已停用。 若要存取目前的功能,您必須將共用的 IOPS 設定檔變更為 dp2。 無法變更使用 dp2rfs 設定檔建立的檔案共用的設定檔。

發出 PATCH /shares/{share_ID} 呼叫,並在 profile 內容中指定設定檔名稱。 下列範例會將設定檔變更為 dp2 設定檔。

curl -X PATCH "$vpc_api_endpoint/v1/shares/432f1a4d-4aac-4ba1-922c-76fdbcbeb1e3?version=2023-08-08&generation=2"\
-H "Authorization: Bearer $iam_token"\
-d '{"profile": {"name": "dp2"}}'

使用 API 更新容許的傳輸加密模式

共用的擁有者可以使用下列值更新允許的傳輸加密模式。

  • 對於區域檔案共用,允許的值為 ipsec,none,ipsec,或 none
  • 對於區域檔案共用,允許的值為 stunnel,none, stunnel,或 none

但是,在變更此屬性之前,必須先刪除所有綁定和掛載目標。 刪除連結會提供原始檔案共用與存取器共用之間的網路路徑,並將連接至存取器共用的裝載目標置於失敗狀態。 如需相關資訊,請參閱 從其他帳戶移除檔案共用的存取權

curl -X PATCH \
"$vpc_api_endpoint/v1/shares/$share_id?version=2023-08-08&generation=2"\
  -H "Authorization: Bearer ${API_TOKEN}"
  -d '{"allowed_transit_encryption_modes": "ipsec"}'

使用 Terraform 管理檔案共用、存取元共用連結及裝載目標

使用 Terraform,您可以:

使用 Terraform 更新檔案共用的屬性

更新 ibm_is_share 資源,以變更檔案共用的任何屬性,例如名稱、大小、人員資訊、標籤。 套用時,下列範例會將共用名稱更新為 new_name

resource "ibm_is_share" "example" {
  name    = "new_name"
  size    = 300
  iops    = 5000
  profile = "dp2"
  zone    = "us-south-2"
}

檔案共用及掛載目標的有效名稱可包含小寫英文字母、數字(a-z、0-9)及連字號(-)的組合,長度最多為 63 個字元。 檔案共用名稱必須以小寫字母開頭。

某些屬性 (例如設定檔、允許的傳輸加密模式和靜態加密) 對存取者共用而言不可編輯。

共用的擁有者可以使用下列值更新允許的傳輸加密模式。

  • 對於區域檔案共用,允許的值為 ipsec,none,ipsec,或 none
  • 對於區域檔案共用,允許的值為 stunnel,none, stunnel,或 none

但是,在變更此屬性之前,必須刪除所有綁定和掛載目標。 刪除連結會提供原始檔案共用與存取器共用之間的網路路徑,並將連接至存取器共用的裝載目標置於失敗狀態。 如需詳細資訊,請參閱 移除其他帳戶對檔案共用的存取權

如需引數及屬性的相關資訊,請參閱 ibm_is_share

使用 Terraform 更新裝載目標的屬性

更新 ibm_is_share_mount_target 資源,以變更裝載目標的名稱。 套用時,下列資源會將裝載目標的名稱變更為 my-new-share-target

resource "ibm_is_share_mount_target" "is_share_target" {
  access_protocol    = "nfs4"
  name               = "my-new-share-target"
  share              = is_share.is_share.id
  subnet             = ibm_is_subnet.example.id
}`

如需引數及屬性的相關資訊,請參閱 ibm_is_share_target

將使用者標籤新增至檔案共用

您可以將使用者標籤新增至新的或現有的檔案共用,透過使用者介面、CLI、API 及 Terraform 修改及刪除檔案共用的標籤。 您可以依資源清單中的標籤來過濾,以檢視整個帳戶中的標籤。 您也可以將使用者標籤新增至抄本檔案共用。

在相同作業中最多可以連接或分離 100 個標籤。 當您編輯標籤時,新標籤會改寫現有的標籤。 若要保持標籤可管理,請只建立所需數量的使用者標籤,以有效處理資源。

您可以使用 廣域標記 API 來管理 IBM Cloud 中的標籤。 使用此 API,您可以建立、刪除、搜尋、附加或分離標籤。 如需管理帳戶標籤的相關資訊,請參閱 使用標籤

在主控台中為檔案共用新增使用者標籤

您可以在主控台中為檔案共用新增使用者標籤。

  1. 移至檔案共用清單。 在 IBM Cloud 主控台中,按一下「導航功能表 圖示 > Infrastructure VPC 圖示 > 儲存 > 檔案儲存共用
  2. 選取檔案共用以檢視其詳細資料。
  3. 在檔案共用詳細資料頁面上,使用者標籤會出現在檔案共用名稱旁邊。 按一下 編輯圖示 「編輯」圖示,以編輯標籤。
  4. 在「編輯標籤」視窗中,於「使用者標籤」文字框中鍵入標籤。
  5. 按一下儲存

從 CLI 新增或修改檔案共用使用者標籤

在使用 CLI 之前,您必須先安裝「IBM Cloud」CLI 以及 VPC CLI 外掛程式。 如需相關資訊,請參閱 CLI 必要條件

您可以在使用 ibmcloud is share-create 指令佈建檔案共用時新增標籤。 --user-tags 選項指定檔案共用的標籤。 如需相關資訊,請參閱 從 CLI 建立與裝載目標的檔案共用

當您使用 ibmcloud is share-update 指令更新檔案共用時,可以新增及移除標籤。

  1. 透過使用 ibmcloud is shares 指令列出地區中的檔案共用,從 CLI 尋找您的共用。

    ibmcloud is shares
    
    Listing shares in all resource groups and region us-south under account Test Account as user test.user@ibm.com...
    ID                                          Name                    Lifecycle state   Zone         Profile   Size(GB)   Resource group   Replication role   Accessor binding role   Snapshot count   Snapshot size
    r006-a8d6af48-0c97-4c6b-bab1-fbefdc1e1e03   my-file-share           stable            us-south-2   dp2       10         defaults         none               none                    0                0
    r006-aaf4bfe9-358c-4faa-a4ec-0b955090b940   my-file-share-2         stable            us-south-2   dp2       10         defaults         none               none                    0                0
    r006-a60bfa90-a893-40ad-be34-28ab51a963f9   replica-dal-2           stable            us-south-2   dp2       10         defaults         replica            none                    0                0
    r006-3f21e3c3-e12d-425f-ab77-810cabfde8df   source-dal-1            stable            us-south-1   dp2       10         defaults         source             none                    0                0
    r006-455b601c-8fc1-4476-8771-4708c49c8ef7   my-replica-share-dal-1  stable            us-south-1   dp2       10         defaults         replica            none                    0                0
    r006-4dadac27-cd17-42df-a5fe-1388705d33e0   my-source-share-dal-2   stable            us-south-2   dp2       10         defaults         source             none                    0                0
    
  2. 使用 ibmcloud is share 指令擷取檔案共用的詳細資料。

    ibmcloud is share my-file-share
    
    Getting file share my-file-share under account Test Account as user test.user@ibm.com...
    ID                           r006-a8d6af48-0c97-4c6b-bab1-fbefdc1e1e03
    Name                         my-file-share
    CRN                          crn:v1:bluemix:public:is:us-south-2:a/a1234567::share:r006-a8d6af48-0c97-4c6b-bab1-fbefdc1e1e03
    Lifecycle state              stable
    Access control mode          security_group
    Accessor binding role        none
    Zone                         us-south-2
    Profile                      dp2
    Size(GB)                     1000
    IOPS                         1000
    Encryption                   provider_managed
    Mount Targets                ID                                          Name
                                 r006-dd497561-c7c9-4dfb-af0a-c84eeee78b61   my-cli-share-mount-target
    Resource group               ID                                 Name
                                 db8e8d865a83e0aae03f25a492c5b39e   Default
    Created                      2023-10-18T22:15:15+00:00
    Replication role             none
    Replication status           none
    Replication status reasons   Status code   Status message
                                 -             -
    Snapshot count               0
    Snapshot size                0
    Source snapshot              -
    Allowed Access Protocols     nfs4
    Availability Mode            zonal
    Bandwidth(Mbps)              1
    Storage Generation           1
    

    以下範例顯示 ibmcloud is share 指令在擷取地區檔案共用資訊時所傳回的資訊。

    ibmcloud is share my-regional-file-share
    
    Getting file share my-file-share under account Test Account as user test.user@ibm.com...
    ID                                 r006-9ae55188-610e-4cf9-9350-d0b675026ff8
    Name                               my-regional-file-share
    CRN                                crn:v1:bluemix:public:is:us-south-2:a/a1234567::share:r006-9ae55188-610e-4cf9-9350-d0b675026ff8
    Lifecycle state                    stable
    Access control mode                security_group
    Accessor binding role              none
    Allowed transit encryption modes   stunnel,none
    Zone                               -
    Profile                            rfs
    Size(GB)                           1000
    IOPS                               35000
    Encryption                         provider_managed
    Mount Targets                      ID                          Name
                                       No mounted targets foun
    Resource group                     ID                                 Name
                                       db8e8d865a83e0aae03f25a492c5b39e   Default
    Created                            2025-07-22T22:15:15+00:00
    Replication role                   none
    Replication status                 none
    Replication status reasons         Status code   Status message
                                       -             -
    Snapshot count                     0
    Snapshot size                      0
    Source snapshot                    -
    Allowed Access Protocols           nsf4
    Availability Mode                  regional
    Bandwidth(Mbps)                    125
    Storage Generation                 2
    
  3. 搭配使用 ibmcloud is share-update 指令與 --user-tags 選項,以將標籤新增至檔案共用。 如果檔案共用先前有標籤,則指令中指定的標籤會改寫它們。

以下範例將兩個使用者標籤新增至檔案共用。

ibmcloud is share-update my-file-share --user-tags daily-backup-plan,docs:test
Updating file share my-file-share under account Test Account as user test.user@ibm.com...
ID                           r006-b696742a-92ee-4f6a-bfd7-921d6ddf8fa6
Name                         my-file-share
CRN                          crn:v1:bluemix:public:is:us-south-2:a/a1234567::share:r006-b696742a-92ee-4f6a-bfd7-921d6ddf8fa6
Lifecycle state              stable
Access control mode          security_group
Accessor binding role        none
Zone                         us-south-2
Profile                      dp2
Size(GB)                     1500
IOPS                         2000
User Tags                    daily-backup-plan,docs:test
Encryption                   provider_managed
Mount Targets                ID                                          Name
                             r006-dd497561-c7c9-4dfb-af0a-c84eeee78b61   my-cli-share-mount-target-1
Resource group               ID                                 Name
                             db8e8d865a83e0aae03f25a492c5b39e   Default
Created                      2023-10-18T22:15:15+00:00
Replication role             none
Replication status           none
Replication status reasons   Status code   Status message
                             -             -
Snapshot count               0
Snapshot size                0
Source snapshot              -
Allowed Access Protocols     nfs4
Availability Mode            zonal
Bandwidth(Mbps)              1
Storage Generation           1

使用 API 新增或修改檔案共用使用者標籤

當您使用 API 時,必須提供 generation 參數並指定 generation=2。 如需更多資訊,請參閱《 虛擬私有雲 API 參考手冊 》中的「生成」章節。

建立檔案共用時新增使用者標籤

提出 POST /shares 要求,並指定 user_tags 內容。 此範例會建立具有三個使用者標籤 ( env:test1env:test2env:prod) 的共用。

curl -X POST \
"$vpc_api_endpoint/v1/shares?version=2023-08-08&generation=2"\
    -H "Authorization: Bearer $iam_token"\
    -H 'Content-Type: application/json'\
    -d '{
        "name": "share-name1",
        "size": 2300,
        "iops": 6000,
        "profile": {"name": "dp2"},
        "user_tags": [
           "env:test1",
           "env:test2",
           "env:prod"
        ],
        "zone": {"name": "us-south-1"}
      }'

修改現有檔案共用的使用者標籤

透過提出 PATCH /shares 要求,將新的使用者標籤新增至現有檔案共用,並在 user_tags 內容中指定使用者標籤。 如果檔案共用沒有任何標籤,則會新增要求中的新標籤。 如果檔案共用先前有標籤,新標籤會改寫先前的標籤。

以下範例修改以 ID 識別的檔案共用。 重新命名共用並新增使用者標籤。

curl -X PATCH\
"$vpc_api_endpoint/v1/shares/432f1a4d-4aac-4ba1-922c-76fdbcbeb1e3?version=2023-08-08&generation=2"\
-H "Authorization: Bearer $iam_token" \
-d '{
    "name": "myshare-patch-1",
    "user_tags": [
      "ut8",
      "ut9"
    ],
  }'

成功的回應看起來就像這個範例:

{
    "access_control_mode": "vpc",
    "created_at": "2023-01-28T22:31:50Z",
    "crn": "crn:[...]",
    "encryption": "provider_managed",
    "href": "https://us-south-1.cloud.ibm.com/v1/shares/432f1a4d-4aac-4ba1-922c-76fdbcbeb1e3",
    "id": "432f1a4d-4aac-4ba1-922c-76fdbcbeb1e3",
    "initial_owner": {
      "gid": 0,
      "uid": 0
    },
    "iops": 3000,
    "lifecycle_state": "stable",
    "name": "myshare-patch-1",
    "profile": {
      "href": "https://us-south-1.cloud.ibm.com/v1/share/profiles/tier-3iops",
      "name": "tier-3iops",
      "resource_type": "share_profile"
    },
    "replication_role": "none",
    "replication_status": "none",
    "replication_status_reasons": [],
    "resource_group": {
      "crn": "crn": "crn:[...]",
      "href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/86ccf0a1315646d4bc719fe34ff4d1e3",
      "id": "86ccf0a1315646d4bc719fe34ff4d1e3",
      "name": "Default"
    },
    "resource_type": "share",
    "size": 100,
    "mount_targets": [],
    "user_tags": [
      "ut8",
      "ut9"
    ],
    "zone": {
      "href": "https://us-south-1.cloud.ibm.com/v1/regions/us-south/zones/us-south-1",
      "name": "us-south-1"
    }
  }

使用 ETag 驗證修改檔案共用使用者標籤

若要確保檔案共用的更新項目有效,您可以取得 ETag 雜湊字串值,並在 PATCH /shares/{share_id} 呼叫的 If-Match 標頭中指定它。 這會確認在前次觀察到的狀態與 PATCH 呼叫時的狀態之間,共用物件未發生任何變更。

若要修改新增至檔案共用的現有使用者標籤,請先進行 GET /shares/{share_id} 呼叫,並從回應標頭中的 ETag 內容複製雜湊值。 然後,在 PATCH /shares/{share_id} 要求中使用 If-Match 標頭來傳送 ETag 值。 如果 If-Match 值不符合檔案共用的現行 Etag,則指定 Etag 值可確保檔案共用的任何更新或刪除都會失敗。 請遵循下列步驟:

  1. 進行 GET /shares/{share_id} 請求,並將 ETag 屬性中的雜湊字串複製到回應標頭中。 當您在 PATCH /shares/{share_id} 請求中指定 If-Match 時,請使用雜湊字串值,以便在步驟 2 中修改共用的使用者標籤。
curl -sSL -D GET\ "https://us-south.cloud.ibm.com/v1/shares/{share_id}?version=2023-08-08&generation=2"\
-H "Authorization: Bearer $TOKEN" -o /dev/null

回應標頭的格式類似以下範例:

HTTP/2 200
date: Mon, 09 January 2023 17:48:03 GMT
content-type: application/json; charset=utf-8
content-length: 1049
cf-ray: 69903d250c4966ef-DFW
cache-control: max-age=0, no-cache, no-store, must-revalidate
expires: -1
strict-transport-security: max-age=31536000; includeSubDomains
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="[uri...]"
pragma: no-cache
x-content-type-options: nosniff
x-request-id: 1fbe2384-6828-4503-ae7d-050426d1b11b
x-xss-protection: 1; mode=block
server: cloudflare
etag: W/xxxyyyzzz123
  1. 提出 PATCH /shares/{share_id} 要求。 在標頭中指定 If-Match 內容的 ETag 雜湊字串。 在 user_tags 內容中指定使用者標籤。

此範例會將檔案共用使用者標籤更新為 env:testenv:prod。 您從 ETag 內容 (W/xxxyyyzzz123) 取得的雜湊字串值指定在呼叫的 If-Match 標頭中。

curl -X PATCH\
"$vpc_api_endpoint/v1/shares/50fda9c3-eecd-4152-b473-a98018ccfb10?version=2023-08-08&generation=2"\
   -H "Authorization: Bearer $iam_token"\
   -H "If-Match: W/xxxyyyzzz123"\
   -d `{
      "user_tags": [
         "env:test2",
         "env:prod2"
      ]
   }'

使用 Terraform 新增或修改檔案共用使用者標籤

若要將使用者標籤套用到檔案共用,請使用 ibm_is_share 資源在 main.tf 檔案中建立參數。 以下範例指定共用 my-new-share 和要附加到該共享的標籤 dev:test。 應用後,標籤將添加到共享中。

resource "ibm_is_share" "example" {
  name    = "my-new-share"
  size    = 200
  iops    = 5000
  profile = "dp2"
  zone    = "us-south-2"
  tags    = ["dev:test"]
}

將存取管理標籤新增至檔案共用

存取管理標籤是您可以新增至檔案共用的 meta 資料,以協助組織存取控制資源關係。 您可以先建立標籤,然後將它新增至現有檔案共用,或在建立檔案共用時將它新增至現有檔案共用。 您可以將相同的存取管理標籤套用至多個檔案共用。 您可以在 Cloud Identity and Access Management (IAM) 中指派對標籤的存取權。 您可以選擇性地建立 IAM 存取群組並管理使用者。

步驟 1 - 在控制台中的 IAM 中建立存取管理標籤

在主控台中:

  1. 請前往 「管理」>「帳戶」,然後選擇「標籤」。
  2. 按一下 存取管理標籤 標籤。 在欄位中新增標籤名稱。 存取管理標籤需要 key:value 格式。
  3. 按一下 建立標籤

步驟 1 - 從 CLI 建立 IAM 存取管理標籤

從命令列輸入 ibmcloud resource tag-create 命令以在您的帳戶中建立存取管理標籤。 以下範例建立一個名為 project:myproject 的標籤:

ibmcloud resource tag-create --tag-names project:myproject

有關詳細信息,請參閱 ibmcloud resource 命令參考

步驟 1 - 使用 API 建立 IAM 存取管理標籤

使用 全域搜尋和標記 API,發出 POST/ tags 請求以 建立存取管理標記。 在 tag_names 屬性中指定標籤。 有關範例,請參閱 使用 API 建立存取管理標籤

步驟 1 - 使用 Terraform 建立 IAM 存取管理標籤

main.tf 檔案中建立一個參數。 以下範例建立存取管理標記 ibm_tag,該標記將新增至資源 ID ibm_is_share.example.crnibm

resource "ibm_resource" "ibm" {
resource_id = ibm_is_share.example.crn
tags        = [ "ibm_tag" ]
}

步驟 2-將存取管理標籤新增至檔案共用

將存取管理標籤新增至現有檔案共用,或在您 建立檔案共用 時新增存取管理標籤。 針對現有的檔案共用:

  1. IBM Cloud 主控台中,移至「資源」清單,然後選取 儲存體 資源下的檔案共用。
  2. 存取管理標籤 欄位中,鍵入您先前建立的存取管理標籤名稱。 當您輸入時,標籤即會出現。
  3. 儲存變更。

步驟 3-建立存取群組並指派存取權給使用者

建立存取權管理標籤並將其套用至檔案共用之後,請完成下列步驟來指派存取權並新增使用者:

  1. 建立存取群組。 存取群組會被指派至政策,這些政策會向該群組的成員授予角色與權限。 您可以將存取權指派給檔案服務的特定存取權管理標籤。 如需存取群組的相關資訊,請參閱 設定存取群組
  2. 將存取原則指派給群組
  3. 將使用者新增至存取群組

當您查看 VPC 基礎架構的特定資源並指定 File Storage for VPC 作為資源類型時,您可以看到檔案服務的存取管理標籤。

從其他帳戶移除檔案共用的存取權

撤銷檔案共用的存取權是 2 個步驟的處理程序。

  1. 移除帳戶之間的 IAM 授權。 移除 IAM 授權會阻止其他帳戶或服務建立存取器共用及裝載目標。
  1. 刪除連接原始共用與存取元共用的共用連結。 此動作會導致另一個帳戶的裝載目標進入 failed 狀態。

在虛擬伺服器實例上裝載及卸載檔案共用

掛載是伺服器作業系統使儲存裝置上的檔案和目錄可供使用者透過伺服器檔案系統存取的過程。 若要將檔案共用裝載至虛擬伺服器實例,請 尋找裝載路徑資訊。 當您建立檔案共用的裝載目標時,會建立裝載路徑。 如需在少數 Linux 作業系統上裝載的相關資訊,請參閱下列資訊。 其他 Linux 發行套件遵循類似程序。

監控文件共享

您可以使用控制台、CLI 或 API 檢查檔案共用的狀態和運作狀況。 您可以在 IBM Cloud 主控台監控共享的總頻寬,總 IOPS,掛載目標數量,以及隨時間變化的容量使用情況。 您可以使用IBM Cloud® Activity Tracker Event Routing來設定如何路由檔案共用的審核事件。 您也可以設定IBM Cloud Logs Routing來處理日誌。 有關詳細信息,請參閱 監控文件共享運行狀況、生命週期狀態和事件

檔案共用可以與IBM Cloud® Monitoring集成,以取得共享效能和運行狀況的操作可見性。 在 Sysdig Web UI 中,您可以檢視更詳細的頻寬、IOPS 和容量指標,自訂您的儀表板,並設定警示。 有關更多信息,請參閱 監控File Storage for VPC的指標

刪除檔案共用、存取器共用綁定和掛載目標

刪除檔案共用之前,請確定已從所有虛擬伺服器實體 解除掛載,且屬於檔案共用的所有掛載目標都已刪除。 如果您的檔案共用與另一個帳戶共用,請先刪除存取元連結,然後再刪除共用。 此外,如果檔案共用具有抄本檔案共用,則必須移除抄寫關係。 有關更多信息,請參閱 在控制台中移除複製關係從 CLI 移除複製關係使用 API 移除複製關係使用 Terraform 移除複製關係

在刪除檔案共用前,請先對資料進行清除處理

當您刪除檔案共用時,IBM 會確保您的資料在實體磁碟上無法存取,並最終被徹底清除。 若您有額外的合規要求(例如 NIST 800-88《媒體清除指南》),則必須在刪除檔案共享之前執行資料清除程序。 如需更多資訊,請參閱 NIST 800-88《媒體清理指南》

在刪除檔案共享之前進行資料清除,可確保即使儲存媒體落入 IBM 控制範圍之外,物理磁碟上的殘留資料也無法被發現或重建。

在主控台中刪除檔案共用、存取器共用綁定和掛載目標

以下指示可協助您在嘗試刪除不再需要的檔案共用之前,確保已刪除共用綁定和掛載目標。

如果檔案共用有快照,這些快照將會與檔案共用一起刪除。

在主控台中刪除檔案共用的共用綁定

  1. 檔案共用清單 中選取檔案共用。
  2. 在「檔案共用詳細資料」頁面上,捲動至存取元共用連結區段,以尋找您要刪除的連結。
  3. 在連結的列結尾,按一下 動作 圖示 「動作」圖示,然後選取 刪除

在主控台中刪除檔案共用的掛載目標

  1. 檔案共用清單 中選取檔案共用。
  2. 在「檔案共用詳細資料」頁面上,選取您要刪除的裝載目標。
  3. 按一下「動作」圖示 「動作」圖示,然後選取 刪除

在主控台中刪除檔案共用

檔案共用必須處於 stable 狀態或 failed 狀態。

  1. 檔案共用清單 中選取檔案共用。
  2. 按一下列尾端的 動作 圖示 「動作」圖示,然後選取 刪除

從 CLI 刪除檔案共用、存取元共用連結及裝載目標

以下指示可協助您在嘗試刪除不再需要的檔案共用之前,確保已刪除共用綁定和掛載目標。

  1. 使用 ibmcloud is shares 指令列出所有檔案共用,以找出您要刪除的檔案共用。
ibmcloud is shares
Listing shares in all resource groups and region us-south under account Test Account as user test.user@ibm.com...
ID                                          Name                    Lifecycle state   Zone         Profile    Size(GB)   Resource group   Replication role   Accessor binding role   Snapshot count   Snapshot size
r006-a8d6af48-0c97-4c6b-bab1-fbefdc1e1e03   my-file-share           stable            us-south-2   dp2        10         defaults         none               none                    0                0
r006-aaf4bfe9-358c-4faa-a4ec-0b955090b940   my-file-share-2         stable            us-south-2   dp2        10         defaults         none               none                    0                0
r006-a60bfa90-a893-40ad-be34-28ab51a963f9   replica-dal-2           stable            us-south-2   dp2        10         defaults         replica            none                    0                0
r006-3f21e3c3-e12d-425f-ab77-810cabfde8df   source-dal-1            stable            us-south-1   dp2        10         defaults         source             none                    0                0
r006-455b601c-8fc1-4476-8771-4708c49c8ef7   my-replica-share-dal-1  stable            us-south-1   dp2        10         defaults         replica            none                    0                0
r006-4dadac27-cd17-42df-a5fe-1388705d33e0   my-source-share-dal-2   stable            us-south-2   dp2        10         defaults         source             none                    0                0
r006-cc7ab6a0-bb71-4e03-8ef7-dcffca43717f   my-old-file-share       stable            us-south-1   dp2        40         defaults         none               -                       -                -
  1. 擷取檔案共用詳細資料,以使用 ibmcloud is share 指令來查看連接的裝載目標及抄寫資訊。
ibmcloud is share my-file-share-2
Getting file share my-file-share-2 under account Test Account as user test.user@ibm.com...
ID                           r006-aaf4bfe9-358c-4faa-a4ec-0b955090b940
Name                         my-file-share-2
CRN                          crn:v1:bluemix:public:is:us-south-1:a/a1234567::share:r006-aaf4bfe9-358c-4faa-a4ec-0b955090b940
Lifecycle state              stable
Access control mode          vpc
Zone                         us-south-1
Profile                      dp2
Size(GB)                     40
IOPS                         2000
User Tags                    env:dev,env:prod
Encryption                   provider_managed
Mount Targets                ID                                          Name
                             r006-36d67ada-ca83-44be-adad-dc58e7c38dc5   my-new-mount-target
Resource group               ID                                 Name
                             db8e8d865a83e0aae03f25a492c5b39e   Default
Created                      2023-10-18T23:52:45+00:00
Replication role             none
Replication status           none
Replication status reasons   Status code   Status message
                             -             -
Snapshot count               0
Snapshot size                0
Source snapshot              -

從 CLI 刪除檔案共用的共用連結

執行 share-binding-delete 指令,並依其名稱或 ID 指定原始檔案共用及連結。 當系統提示您時,請鍵入 y。 如果有多個連結附加至檔案共用,請重複此步驟,直到刪除所有連結為止。 請參閱下列範例。

ibmcloud is share-bindings-delete my-origin-share r-006-c2e53b1b-3b15-4792-8d96-c9c035fd65c3
This will delete accessor binding r-006-c2e53b1b-3b15-4792-8d96-c9c035fd65c3 for share ID my-origin-share and cannot be undone. Continue [y/N] ?> y
Deleting binding r-006-c2e53b1b-3b15-4792-8d96-c9c035fd65c3 for share ID my-origin-share under account Test Account as user test.user@ibm.com...
OK
Binding r-006-c2e53b1b-3b15-4792-8d96-c9c035fd65c3 is deleted.

從 CLI 刪除檔案共用的裝載目標

執行 share-mount-target-delete 指令,並依其名稱或 ID 指定檔案共用及裝載目標。 當系統提示您時,請鍵入 y。 如果有多個裝載目標連接至檔案共用,請重複此步驟,直到刪除所有裝載目標為止。

ibmcloud is share-mount-target-delete my-file-share-2 my-new-mount-target
This will delete mounted target my-new-mount-target for share ID my-file-share-2 and cannot be undone. Continue [y/N] ?> y
Deleting mounted target my-new-mount-target for share ID my-file-share-2 under account Test Account as user test.user@ibm.com...
OK
Share mount target my-new-mount-target is deleted.

如需指令選項的相關資訊,請參閱 ibmcloud is share-mount-target-delete

從 CLI 刪除檔案共用

檔案共用必須處於 stablefailed 狀態。 若要刪除檔案共用,請執行 share_delete 指令,並依其名稱或 ID 指定檔案共用。

ibmcloud is share-delete my-file-share-2
This will delete file share my-file-share-2 and cannot be undone. Continue [y/N] ?> y
Deleting file share my-file-share-2 under account Test Account as user test.user@ibm.com...
OK
File share my-file-share-2 is deleted.

如需指令選項的相關資訊,請參閱 ibmcloud is share-delete

如果檔案共用有快照,這些快照將會與檔案共用一起刪除。

使用 API 刪除檔案共用、存取元共用連結及裝載目標

以下指示可協助您在嘗試刪除不再需要的檔案共用之前,確保已刪除共用綁定和掛載目標。

使用 API 刪除檔案共用的共用連結

您可以透過在 VPC API 中呼叫 /shares 方法,以程式化方式刪除共用連結,如下列範例要求中所示。

curl -X DELETE "$vpc_api_endpoint/v1/shares/v1/shares/$share_id/bindings/$binding_id?version=2024-06-21&generation=2"

刪除與 API 共用之檔案的裝載目標

發出 DELETE /shares/{share_ID}/mount_targets/{target_id} 呼叫以刪除檔案共用的裝載目標。 檔案共用必須處於 stable 狀態。 如果現有裝載目標與檔案共用相關聯,或抄本作業正在進行中,則無法刪除檔案共用。

請參閱下列範例。

curl -X DELETE \
"$vpc_api_endpoint/v1/shares/$share_id/mount_targets/$target_id?version=2023-08-08&generation=2"\
  -H "Authorization: Bearer ${API_TOKEN}"

成功回應具有接受刪除的確認,以及包含目標資訊的回應。

以下範例顯示了一個安裝目標,其中 access_control_modesecurity_group。 回應會顯示安全群組及子網路。 您可以在 primary_ip 部分中查看用於掛載目標虛擬網路介面的保留 IP 位址的詳細資訊。 依預設,當刪除裝載目標時,虛擬網路介面會與裝載目標一起刪除。 刪除正在進行時,掛載目標的狀態顯示正在刪除

{
  "access_control_mode": "security_group",
  "created_at": "2022-08-08T01:59:46.000Z",
  "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0995b8c6-c323-4e59-9ea9-fa14dd66bba8/mount_targets/9fdf4438-f5b4-4b6f-8bca-602494fd6c31",
  "id": "9fdf4438-f5b4-4b6f-8bca-602494fd6c31",
  "lifecycle_reasons": [],
  "lifecycle_state": "deleting",
  "mount_path": "domain.com:/vol_xyz_2891fd0a_63aa_4deb_9ed5_1159e37cb5aa",
  "name": "target-name1",
  "primary_ip": {
    "address": "10.10.12.64",
    "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/2302-ea5fe79f-52c3-4f05-86ae-9540a10489f5/reserved_ips/0716-6fd4925d-7774-4e87-829e-7e5765d454ad",
    "id": "0716-6fd4925d-7774-4e87-829e-7e5765d454ad",
    "name": "my-reserved-ip",
    "resource_type": "subnet_reserved_ip"
  },
  "resource_type": "share_mount_target",
  "security_groups": [
    {
      "crn": "crn:[...]",
      "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-1dfeccef-3ad6-4760-8653-a202bc795db4",
      "id": "r006-1dfeccef-3ad6-4760-8653-a202bc795db4",
      "name": "my-security-group",
      "resource_type": "security_group"
    }
  ],
  "subnet": {
    "crn": "crn:[...]",
    "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/2302-ea5fe79f-52c3-4f05-86ae-9540a10489f5",
    "id": "2302-ea5fe79f-52c3-4f05-86ae-9540a10489f5",
    "name": "my-subnet",
    "resource_type": "subnet"
  },
  "transit_encryption": "none",
  "virtual_network_interface": {
    "crn": "crn:[...]",
    "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/4727d842-f94f-4a2d-824a-9bc9b02c523b",
    "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b",
    "name": "my-virtual-network-interface",
    "resource_type": "virtual_network_interface"
  },
  "vpc": {
  "crn": "crn:[...]",
  "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8c95b3c1-fe3c-45c-97a6-e43d14088287",
  "id": "82a7b841-9586-43b4-85dc-c0ab5e8b1c7a",
  "name": "vpc-name1",
  "resource_type": "vpc"
  }
}

在背景中刪除裝載目標。 請嘗試檢視裝載目標資訊來確認刪除。 如果您收到 404 Not Found 錯誤,則會順利刪除裝載目標。

在 API 中刪除檔案共用

檔案共用必須處於 stablefailed 狀態。

發出 DELETE /shares/$share_id 呼叫以刪除檔案共用。 檔案共用必須處於 stable 狀態或 failed 狀態 (亦即,佈建失敗時)。 如果現有裝載目標與檔案共用相關聯,或抄本作業正在進行中,則無法刪除檔案共用。

請參閱下列範例。

curl -X DELETE \
"$vpc_api_endpoint/v1/shares/$share_id?version=2023-08-08&generation=2"\
  -H "Authorization: Bearer ${API_TOKEN}"

成功回應會確認接受刪除,並顯示檔案共用資訊。 檔案共用的狀態會更新為 pending_deletion。 請參閱下列範例:

{
  "access_control_mode": "vpc",
  "created_at": "2022-08-08T23:31:59Z",
  "crn": "crn:[...]",
  "encryption": "provider_managed",
  "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0995b8c6-c323-4e59-9ea9-fa14dd66bba8",
  "id": "0995b8c6-c323-4e59-9ea9-fa14dd66bba8",
  "iops": 3000,
  "lifecycle_state": "pending_deletion",
  "name": "share-name1",
  "profile": {
    "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-10iops",
    "name": "tier-10iops",
    "resource_type": "share_profile"
  },
  "resource_group": {
    "crn": "crn:[...]",
    "href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/bfb4a7c7-00d8-400b-98ba-5a67e5851970",
    "id": "bfb4a7c7-00d8-400b-98ba-5a67e5851970",
    "name": "Default"
  },
  "resource_type": "share",
  "size": 100,
  "snapshot_count": 10,
  "snapshot_size": 10,
  "user_tags": [],
  "mount_targets": [],
  "zone": {
    "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1",
    "name": "us-south-1"
  }
}

檔案共用會在背景中刪除。 請嘗試檢視裝載目標資訊來確認刪除。 如果您收到 404 Not Found 錯誤,則會順利刪除裝載目標。 如果檔案共用有快照,這些快照將會與檔案共用一起刪除。

DELETE /shares/$share_id 呼叫可以選擇性地包括指定 ETag 雜湊字串的 If-Match 標頭。 進行 GET /shares/{share_id} 呼叫,並從回應標頭複製 ETag 雜湊字串。 如需相關資訊,請參閱 檔案共用的使用者標籤

使用 Terraform 刪除檔案共用或掛載目標

使用 terraform destroy 指令可方便地刪除遠端物件,例如檔案共用。 下列範例顯示刪除共用的語法。 將中共用的實際 ID 替換為 ibm_is_share.example.id。 若要刪除掛載目標,請以相同的指令使用它們的 ID。

terraform destroy --target ibm_is_share.example.id

如果檔案共用有快照,這些快照將會與檔案共用一起刪除。

如需相關資訊,請參閱 terraform destroy

如果要使用 Terraform 移除存取器共用綁定,可以使用 ibm_is_share_delete_accessor_binding 資源。

resource "ibm_is_share_delete_accessor_binding" "example" {
    share = ibm_is_share.example.id
    accessor_binding = data.ibm_is_share_accessor_bindings.example.accessor_bindings.0.id
}

有關參數和屬性的詳細資訊,請參閱 ibm _ is_share_delete_accessor_binding。