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?

[VIOS] alt_root_vg によるディスク・バックアップと切り戻し検証 ~予備ディスク活用のすすめ~

Last updated at Posted at 2025-11-22

はじめに

IBM Power の VIOS(Virtual I/O Server) のバックアップ手段は種々存在しますが、alt_root_vg コマンドを使用した方法を確認しました。


  • 参考 Technote

How to clone a PowerVM VIOS rootvg?

Scenario 3 - Cloning VIOS rootvg to an alternate disk ***

You can use the alt_root_vg command to clone your VIOS to another disk on the same VIOS partition. Cloning the running rootvg allows for the creation of a backup copy of the root volume group. This disk copy can be used as a backup to boot from in case the original rootvg fails.

To create the clone to new_hdisk, run:
$ alt_root_vg -target
Where is a spare disk, not in use.

To boot from the new cloned disk, change the bootlist to point to that disk by running:
$ bootlist -mode normal

To display new bootlist, run:
$ bootlist -mode normal -ls

To clean up an old_rootvg, run:
$ oem_setup_env
"# alt_rootvg_op -X old_rootvg


環境

VIOSはバージョン 3.1.4.10 です。

$ ioslevel
3.1.4.10
$
  • hdisk の確認

hdisk0 が 50GB rootvg です。

$ lsmpio -ql hdisk0
Device:  hdisk0
          Vendor Id:  IBM
         Product Id:  2145
           Revision:  0000
           Capacity:  50.00GiB
       Machine Type:  2072
       Model Number:  2N4
         Host Group:  VIOS2
        Volume Name:  VIOS2_rootvg
      Volume Serial:  6005xxxxxxxxxxxxxxxxxxx0x000000001  (Page 83 NAA)
$

バックアップ先予定のディスクも同じく 50GB です。

$ lsmpio -ql hdisk21
Device:  hdisk21
          Vendor Id:  IBM
         Product Id:  2145
           Revision:  0000
           Capacity:  50.00GiB
       Machine Type:  2072
       Model Number:  2N4
         Host Group:  VIOS2
        Volume Name:  VIOS2_rootvg_altdisktest
      Volume Serial:  60050xxxxxxxxxx07D8000000000005A0  (Page 83 NAA)
$
  • hdisk21 は新規ディスクです。
  • lspv の実行ができていませんでしたが、hdisk21 は PVID が付与されていない状態で実施しています。
$ lsvg rootvg
VOLUME GROUP:       rootvg                   VG IDENTIFIER:  00c5ca2100004b0000000197ef0477cd
VG STATE:           active                   PP SIZE:        64 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      799 (51136 megabytes)
MAX LVs:            256                      FREE PPs:       73 (4672 megabytes)
LVs:                13                       USED PPs:       726 (46464 megabytes)
OPEN LVs:           12                       QUORUM:         2 (Enabled)
TOTAL PVs:          1                        VG DESCRIPTORS: 2
STALE PVs:          0                        STALE PPs:      0
ACTIVE PVs:         1                        AUTO ON:        yes
MAX PPs per VG:     32512
MAX PPs per PV:     1016                     MAX PVs:        32
LTG size (Dynamic): 512 kilobyte(s)          AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable
PV RESTRICTION:     none                     INFINITE RETRY: no
DISK BLOCK SIZE:    512                      CRITICAL VG:    no
FS SYNC OPTION:     no                       CRITICAL PVs:   no
ENCRYPTION:         no

FREE PPs は 5GB 弱です。

$ df -m
Filesystem    MB blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4         256.00    193.39   25%     3733     8% /
/dev/hd2        4416.00    638.29   86%    59954    29% /usr
/dev/hd9var      768.00    328.68   58%     5679     7% /var
/dev/hd3        4864.00   4860.27    1%       42     1% /tmp
/dev/VMLibrary  20480.00  20396.56    1%        4     1% /var/vio/VMLibrary
/dev/hd1       10240.00   9986.68    3%     1592     1% /home
/dev/hd11admin    128.00    127.64    1%        5     1% /admin
/proc                 -         -    -        -      - /proc
/dev/hd10opt     832.00    424.94   49%     5694     6% /opt
/dev/livedump    256.00    255.64    1%        4     1% /var/adm/ras/livedump
/ahafs                -         -    -       43     1% /aha
$

仮想メディアライブラリの確認

どこかに明記された内容は見つけていませんが、仮装メデイア・ライブラリがロードしている状態だとエラーが発生しやすいかと思い、仮想デバイスに メディアがロードされていないかを確認します。

$ lsrep
Size(mb) Free(mb) Parent Pool         Parent Size      Parent Free
   20396    20396 rootvg                    51136             4672

$ lsvopt
VTD             Media                                                 Size(mb)
aixtestu        No Media                                                   n/a
$

No Media で、特にロードされていない状態であることがわかりました。


ブートリストの確認

現在のブートリストを確認します。
hdisk0 で設定されています。

$ bootlist -mode normal -ls
hdisk0 blv=hd5 pathid=0
hdisk0 blv=hd5 pathid=1
hdisk0 blv=hd5 pathid=2
hdisk0 blv=hd5 pathid=3
$

また、hdisk0 で稼働しています。

$ lspv | grep hdisk0
hdisk0           00c5ca21923baab6                     rootvg           active
$

alt_root_vg コマンドの確認

バックアップで使用する alt_root_vg コマンド・ヘルプを確認します。

$ alt_root_vg --help
Command requires one of the following options: -target -remove

Usage: alt_root_vg -target <targetDisks> [-bundle <bundleName>] [-location <locDir>]
           [-phase <phaseValue>] [-exclude <excludeListFile>] [-script <customScript>] [-g]
       alt_root_vg -remove [volumeGrp]
$

-target オプションでバックアップ先ディスクを指定します。

・参考:VIOS alt_root_vg コマンド


alt_root_vg コマンドによるバックアップの実行

hdisk0 がコピー元、hdisk21 がコピー先です。

$ time alt_root_vg -target hdisk21
Calling mkszfile to create new /image.data file.
Checking disk sizes.
Creating cloned rootvg volume group and associated logical volumes.
Creating logical volume alt_hd5.
Creating logical volume alt_hd6.
Creating logical volume alt_hd8.
Creating logical volume alt_hd4.
Creating logical volume alt_hd2.
Creating logical volume alt_hd9var.
Creating logical volume alt_hd3.
Creating logical volume alt_hd1.
Creating logical volume alt_hd10opt.
Creating logical volume alt_hd11admin.
Creating logical volume alt_lg_dumplv.
Creating logical volume alt_livedump.
Creating logical volume alt_VMLibrary.
Creating /alt_inst/ file system.
Creating /alt_inst/admin file system.
Creating /alt_inst/home file system.
Creating /alt_inst/opt file system.
Creating /alt_inst/tmp file system.
Creating /alt_inst/usr file system.
Creating /alt_inst/var file system.
Creating /alt_inst/var/adm/ras/livedump file system.
Creating /alt_inst/var/vio/VMLibrary file system.
Generating a list of files
for backup and restore into the alternate file system...
Backing-up the rootvg files and restoring them to the alternate file system...
Modifying ODM on cloned disk.
Building boot image on cloned disk.
forced unmount of /alt_inst/var/vio/VMLibrary
forced unmount of /alt_inst/var/vio/VMLibrary
forced unmount of /alt_inst/var/adm/ras/livedump
forced unmount of /alt_inst/var/adm/ras/livedump
forced unmount of /alt_inst/var
forced unmount of /alt_inst/var
forced unmount of /alt_inst/usr
forced unmount of /alt_inst/usr
forced unmount of /alt_inst/tmp
forced unmount of /alt_inst/tmp
forced unmount of /alt_inst/opt
forced unmount of /alt_inst/opt
forced unmount of /alt_inst/home
forced unmount of /alt_inst/home
forced unmount of /alt_inst/admin
forced unmount of /alt_inst/admin
forced unmount of /alt_inst
forced unmount of /alt_inst
Changing logical volume names in volume group descriptor area.
Fixing LV control blocks...
Fixing file system superblocks...
Bootlist is set to the boot disk: hdisk21 blv=hd5

real    2m3.75s
user    0m9.95s
sys     0m14.37s
$ echo $?
0
$

2分強で完了しています。早い!!


実行後確認

  • bootlist は hdisk21 に切り替わっています。
$ bootlist -mode normal -ls
hdisk21 blv=hd5 pathid=0
hdisk21 blv=hd5 pathid=1
hdisk21 blv=hd5 pathid=2
hdisk21 blv=hd5 pathid=3
$

rootvg は現時点では hdisk0 です。
hdisk21は altinst_rootvg という表記です。

$ lspv | grep hdisk0
hdisk0           00c5ca21923baab6                     rootvg           active
$ lspv | grep hdisk21
hdisk21          00c5ca21a90fead9                     altinst_rootvg
$

ここで再起動してみます。

$ shutdown -restart
Shutting down the VIO Server could affect Client Partitions. Continue [y|n]?

y

SHUTDOWN PROGRAM
Sat Nov 22 10:04:54 JST 2025
0513-044 The sshd Subsystem was requested to stop.

Wait for 'Rebooting...' before stopping.
Error reporting has stopped.
Advanced Accounting has stopped...

~ 省略 ~


再起動後確認

再起動後は hdisk21 が rootvg 、hdisk0 が old_rootvg に切り替わりました。

$ lspv | grep hdisk0
hdisk0           00c5ca21923baab6                     old_rootvg
$ lspv | grep hdisk21
hdisk21          00c5ca21a90fead9                     rootvg           active
$

bootlist を hdisk21 から hdisk0 に切り替えて再度起動します。

参考: VIOS bootlist コマンド

  • 変更前 bootlist 確認
$ bootlist -mode normal -ls
hdisk21 blv=hd5 pathid=0
hdisk21 blv=hd5 pathid=1
hdisk21 blv=hd5 pathid=2
hdisk21 blv=hd5 pathid=3
$
  • bootlist 変更
$ bootlist -mode normal hdisk0
$ echo $?
0
  • 変更後 bootlist 確認
$  bootlist -mode normal -ls
hdisk0 blv=hd5 pathid=0
hdisk0 blv=hd5 pathid=1
hdisk0 blv=hd5 pathid=2
hdisk0 blv=hd5 pathid=3
$
  • 再起動
$ shutdown -restart
Shutting down the VIO Server could affect Client Partitions. Continue [y|n]?

y

SHUTDOWN PROGRAM
Sat Nov 22 10:15:42 JST 2025
0513-044 The sshd Subsystem was requested to stop.

Wait for 'Rebooting...' before stopping.


~ 省略 ~

  • 再起動後確認

再起動後は hdisk0 が rootvg 、hdisk21 が altinst_rootvg に切り替わりました。

$ lspv | grep hdisk0
hdisk0           00c5ca21923baab6                     rootvg           active
$ lspv | grep hdisk21
hdisk21          00c5ca21a90fead9                     altinst_rootvg
$

これで bootlist を切り替えるだけで hdisk21 をバックアップとして使用が可能となりました。


altinst_rootvg または old_rootvg の VG削除

使用していないrootvg の方は alt_root_vg -remove コマンドで削除することが可能です。

hdisk21 の altinst_rootvg を削除します。

$ lspv | grep hdisk21
hdisk21          00c5ca21a90fead9                     altinst_rootvg
$
  • altinst_rootvg 削除実行
$ time alt_root_vg -remove altinst_rootvg
Bootlist is set to the boot disk: hdisk0 blv=hd5
Volume group has been successfully deleted.


real    0m1.06s
user    0m0.04s
sys     0m0.05s
$

altinst_rootvg が消えました。

$ lspv | grep hdisk21
hdisk21          00c5ca21a90fead9                     None
$
  • pvid の削除

次に使用するときのために PVID を削除します。

$ chdev -dev hdisk21 -attr pv=clear
hdisk21 changed
$

参考:chdev コマンド

$ lspv | grep hdisk21
hdisk21          none                                 None
$

PVID が none になりました。

これで hdisk21 を他の用途でも使用できるディスクに戻すことができました。

(追記)
PVID none でもディスク先頭部分の書き込みから使用中と認識される場合があります。
その場合は dd コマンドを使用してディスク消去も合わせて行うと確実です。

コマンド例:

$ oem_setup_env
# dd if=/dev/zero of=/dev/hdisk21 bs=4k

(ディスク全領域でなく、冒頭の少し書き込みを消す場合でも効果がありました。)


おわりに

これまで alt_root_vg コマンドを使用したバックアップを取得するケースを多くはみていませんでしたが、結構便利と思いました。


VIOS の設計として、rootvg と同じ空のディスクを保持しておくと、alt_root_vg コマンドによるバックアップや、VIOSのアップグレードの標準機能である viosupgrade コマンドの際にも使用できるため、お勧めできる設計ではと思います。

(ただしストレージ・ディスクが壊れるケースを考慮しておく必要があります)

alt_root_vg コマンドを使用したバックアップとアップデートの手順は下記をご参考ください。

以上です。

1
0
4

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?