1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PowerVSのCLIコマンドでsnapshot取得&リストア

Last updated at Posted at 2025-07-14

はじめに

PowerVSではCLIでsnapshotを取得することができます。
https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-snapshots-cloning&locale=en

このsnapshotコマンドに関して、これまで時期により3種類が存在し、少々分かりづらいので、はじめに整理します。

(1)
CLI 0.7系の ibmcloud pi snapshot-create
2024年3月まで主流だったCLI体系。(下記docsページ全体が0.7系のCLI referenceです)
https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-power-iaas-cli-reference#ibmcloud-pi-snapshot-create
現在新規でpower-iaasプラグインを導入すると1.x系になっているので、0.7系を新規で使うことは無いと思います。資料によっては(1)の解説になっていることがあり、1.x系では使えませんので注意が必要です。

(2)
CLI 1.x系の ibmcloud pi snapshot
2024年3月にリリースされた新しいCLI体系。ただし、(3)に書く通り、このibmcloud pi snapshotは2024年9月にdeprecatedとなっています。新規で使うのは避けたほうが良いでしょう。
https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-power-iaas-cli-reference-v1&locale=en#ibmcloud-pi-snapshot

(3)
CLI 1.x系の ibmcloud pi instance snapshot
(2)の後継として2024年9月に提供されたsnapshotコマンド。 当記事ではこのコマンドについて記載します。
https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-power-iaas-cli-reference-v1#ibmcloud-pi-instance-snapshot

2024年9月のリリースノート
https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-cli-release-notes#sep-2024

ibmcloud pi snapshot command and subcommands have been deprecated. Please use ibmcloud pi instance snapshot command family instead.

snapshot取得

上記(3)のsnapshotコマンドを使ってsnapshotを取得します。

LPARに2つ目のボリュームをattachし、AIXのhdisk1として認識させます。AIX上で、hdisk1に/dataを配置したdatavgを作成します。今回は、このhdisk1をsnapshot対象とします。
image.png

# lspv
hdisk0          00c781b1058d6951                    rootvg          active      
hdisk1          00c781b105ac632f                    datavg          active      
#

なお、複数ボリュームのsnapshotやcloneを取得する場合、それらのボリュームが同じストレージプールに存在する必要があります。
異なるストレージプールに作成しようとすると、下記のメッセージが出ます。
image.png

インスタンスID確認

$ ic pi ins ls
Listing instances under account xxxxxxx as user xxxxxxx...
ID                                     Name       Path
1f93089e-c768-41c6-b667-c929d6fac339   tmgw-aix   /pcloud/v1/cloud-instances/91763b06712f4b1e9b5b0023ca784c70/pvm-instances/1f93089e-c768-41c6-b667-c929d6fac339
$ 

ボリュームID確認
(今回のsnapshot対象は1行目のtmgw-vol01です)

$ ic pi vol ls
Listing volumes under account xxxxxxx as user xxxxxxx...
ID                                     Name                                Address
f84c21a1-6d71-4e3f-bfa3-0e26a650be9d   tmgw-vol01                          /pcloud/v1/cloud-instances/7e43b216-4f76-4de6-9baf-339b1fd2304c/volumes/f84c21a1-6d71-4e3f-bfa3-0e26a650be9d
20fd6d56-d1d5-4f93-92be-6b727c027268   tmgw-aix-1f93089e-00062b85-boot-0   /pcloud/v1/cloud-instances/7e43b216-4f76-4de6-9baf-339b1fd2304c/volumes/20fd6d56-d1d5-4f93-92be-6b727c027268
b6c40888-915d-4f87-a32c-e911af7815f9   vol01                               /pcloud/v1/cloud-instances/7e43b216-4f76-4de6-9baf-339b1fd2304c/volumes/b6c40888-915d-4f87-a32c-e911af7815f9
$ 

OS上でファイル作成

# cat /data/test_datavg.txt 
bbbbb
#

ファイルシステムをアンマウント
(アンマウントしていなくてもsnapshotコマンドは実行できますが、静止点を確保する意味で、アンマウントしたほうが良いでしょう)

# umount /data

snapshot取得
上記で確認したインスタンスIDやボリュームIDを指定します。

$ ic pi ins snapshot create 1f93089e-c768-41c6-b667-c929d6fac339 -n snap01 -v f84c21a1-6d71-4e3f-bfa3-0e26a650be9d
Creating snapshot for instance 1f93089e-c768-41c6-b667-c929d6fac339 under account xxxxxxx as user xxxxxxx...
OK
Snapshot snap01 with ID of b94290c1-73eb-41b0-85eb-7a39ddda5255 has started.
$

snapshotが作成された事を確認
一番右のpercent表示が100になっていれば取得完了しています。
snapshotは多くの場合、数秒〜1分程度で取得完了します。

$ ic pi ins snap ls
Listing snapshots under account xxxxxxx as user xxxxxxx...
ID                                     Name     Instance ID                            Status      Action     Creation Date              Percent Completed
b94290c1-73eb-41b0-85eb-7a39ddda5255   snap01   1f93089e-c768-41c6-b667-c929d6fac339   available   snapshot   2025-07-13T22:12:05.000Z   100
$

snapshot作成中は、一番右のpercent表示が、途中になっています。

$ ic pi ins snap ls
Listing snapshots under account xxxxxxx as user xxxxxxx...
ID                                     Name     Instance ID                            Status              Action     Creation Date              Completed
b94290c1-73eb-41b0-85eb-7a39ddda5255   snap01   1f93089e-c768-41c6-b667-c929d6fac339   creating_snapshot   snapshot   2025-07-13T22:12:05.000Z   40
$

OS上でファイル更新(この後リストアし、更新前の状態に戻る事を確認するため。)

# cat /data/test_datavg.txt 
bbbbb
bbbbb
#

snapshotリストア

管理ポータルからLPARをシャットダウン

image.png

snapshotリストア

$ ic pi ins snap restore 1f93089e-c768-41c6-b667-c929d6fac339 --snapshot b94290c1-73eb-41b0-85eb-7a39ddda5255
Restoring snapshot for instance 1f93089e-c768-41c6-b667-c929d6fac339 under account xxxxxxx as user xxxxxxx...
OK
Restoring snapshot b94290c1-73eb-41b0-85eb-7a39ddda5255 has started.
$

リストア時はインスタンス(LPAR)が停止している必要があります。停止していないと下記のエラーになります。

$ ic pi ins snap restore 1f93089e-c768-41c6-b667-c929d6fac339 --snapshot b94290c1-73eb-41b0-85eb-7a39ddda5255
Restoring snapshot for instance 1f93089e-c768-41c6-b667-c929d6fac339 under account xxxxxxx as user xxxxxxx...
FAILED
Failed to restore instance from snapshot.

FAILED
Error: [POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore][400] pcloudPvminstancesSnapshotsRestorePostBadRequest {"description":"Bad Request: snapshot volume tmgw-vol01 is attached to pvm-instance tmgw-aix and the instance is not in the Shutoff state","error":"Bad Request"}
$

--forceオプションを付けることで、LPAR稼働中でもrestoreコマンドを実行できますが、対象ボリュームにI/Oが無い状態をユーザー側で確保する必要があります。

$ ic pi ins snap restore 1f93089e-c768-41c6-b667-c929d6fac339 --snapshot b94290c1-73eb-41b0-85eb-7a39ddda5255 --force
Restoring snapshot for instance 1f93089e-c768-41c6-b667-c929d6fac339 under account xxxxxxx as user xxxxxxx...
OK
Restoring snapshot b94290c1-73eb-41b0-85eb-7a39ddda5255 has started.
$ 

リストアが完了した事を確認。

$ ic pi ins snap ls
Listing snapshots under account xxxxxxx as user xxxxxxx...
ID                                     Name     Instance ID                            Status      Action     Creation Date              Percent 
b94290c1-73eb-41b0-85eb-7a39ddda5255   snap01   1f93089e-c768-41c6-b667-c929d6fac339   available   restore    2025-07-13T22:12:05.000Z   100
$ 

リストア中は、一番右のpercent表示が途中になっています。

$ ic pi ins snap ls
Listing snapshots under account xxxxxxx as user xxxxxxx...
ID                                     Name     Instance ID                            Status      Action     Creation Date              Percent Completed
b94290c1-73eb-41b0-85eb-7a39ddda5255   snap01   1f93089e-c768-41c6-b667-c929d6fac339   restoring   restore    2025-07-13T22:12:05.000Z   30
$ 

LPARを起動し、OS上でファイルが変更前の状態に戻っている事を確認

# cat /data/test_datavg.txt 
bbbbb
#

以上

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?