LPAR を "Diag Boot" する方法

IBM PowerでLPARを使っていて、極々たま〜にDiag Bootしたい時がありますよね。  
Diagが必要なことなんて滅多にないからね・・・やり方がわからない・・・思い出せない・・・  

それに  

最近はNVMeを使うことも増えて、OSを導入する前にNVMeの Name Spaceを構成したいこともあるので覚書しておきます。    

# NIMサーバーでDiag Boot用の設定

  

#smitty nim 
&nbsp; → `Perform NIM Administration Tasks` 
&nbsp; &nbsp; → `Manage Machines` 
&nbsp; &nbsp; &nbsp; → `Perform Operations on Machines`
で該当LPARを選択  
ちなみに、#smitty nim_mac_opで直接このメニューにこれますけどね。
```
                                Manage Machines

Move cursor to desired item and press Enter.

  +--------------------------------------------------------------------------+
  |                               Target Name                                |
  |                                                                          |
  | Move cursor to desired item and press Enter.                             |
  |                                                                          |
  |   master         machines       master                                   |
  |   gate2vios1     machines       standalone                               |
  |   aixgate2       machines       standalone                               |
  |   s914110        machines       standalone                               |
  |   s914104        machines       standalone                               |
  |   e1080001       machines       standalone                               |
  |   s1024101       machines       standalone                               |
  |   s1022101       machines       standalone                               |
  |   s1022198       machines       standalone                               |
  |   s914101        machines       standalone                               |
  |   s1022111       machines       standalone                               |
  |                                                                          |
  | F1=Help                 F2=Refresh              F3=Cancel                |
  | F8=Image                F10=Exit                Enter=Do                 |
F1| /=Find                  n=Find Next                                      |
F9+--------------------------------------------------------------------------+
```
`diag`を選択

```
                                Manage Machines

Mo+--------------------------------------------------------------------------+
  |                           Operation to Perform                           |
  |                                                                          |
  | Move cursor to desired item and press Enter. Use arrow keys to scroll.   |
  |                                                                          |
  | [TOP]                                                                    |
  |      diag             = enable a machine to boot a diagnostic image      |
  |      cust             = perform software customization                   |
  |      bos_inst         = perform a BOS installation                       |
  |      maint            = perform software maintenance                     |
  |      reset            = reset an object's NIM state                      |
  |      fix_query        = perform queries on installed fixes               |
  |      check            = check the status of a NIM object                 |
  |      reboot           = reboot specified machines                        |
  |      maint_boot       = enable a machine to boot in maintenance mode     |
  |      showlog          = display a log in the NIM environment             |
  |      lppchk           = verify installed filesets                        |
  | [MORE...6]                                                               |
  |                                                                          |
  | F1=Help                 F2=Refresh              F3=Cancel                |
  | F8=Image                F10=Exit                Enter=Do                 |
F1| /=Find                  n=Find Next                                      |
F9+--------------------------------------------------------------------------+
```

使用予定OSのspotを選択して実行 (自分の使いたいSPOTは事前に作成しておく必要があります。本文と趣旨が違うのでここでは触れませんけど。)
```
                            Enable Diagnositic Boot

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

                                                        [Entry Fields]
  Target Name                                         s1022111
* SPOT                                               [spot7300-01-01]        +














F1=Help             F2=Refresh          F3=Cancel           F4=List
F5=Reset            F6=Command          F7=Edit             F8=Image
F9=Shell            F10=Exit            Enter=Do
```

```
                                 COMMAND STATUS

Command: OK            stdout: no            stderr: no

Before command completion, additional instructions may appear below.

















F1=Help             F2=Refresh          F3=Cancel           F6=Command
F8=Image            F9=Shell            F10=Exit            /=Find
n=Find Next
```

# HMCからLPARを起動してネットワーク経由でDiag Boot
HMCからLPARを起動
  - 区画を選択して活動化
  - 起動の詳細設定にある、ブート・モードを"システム管理サービス"に変更して、完了ボタン

PCのターミナルからHMCにログインして、vtmenuコマンドを実行
```
% ssh -l hscroot xxx.xxx.xxx.xxx
(hscroot@xxx.xxx.xxx.xxx) Password:
Last login: Tue Jun  6 23:46:23 2023 from xxx.xxx.xxx.xxx
hscroot@xxxxx:~>vtmenu
```
該当マシンを選択して、Enter
```


 ----------------------------------------------------------
  Managed Systems:
 ----------------------------------------------------------
   1) Server-9009-22G-SN1111111
   2) Server-9009-22G-SN2222222
   3) Server-9009-41A-SN3333333
   4) Server-9009-42A-SN4444444
   5) Server-9009-42A-SN5555555
   6) Server-9080-HEX-SN6666666
   7) Server-9105-22A-SN7777777
   8) Server-9105-41B-SN8888888

 Enter Number of Managed System.   (q to quit):
```
該当LPAR(今回は7)を選択してEnterすると、SMSに入る。
```


 ----------------------------------------------------------
  Partitions On Managed System:  Server-9105-22A-SN7777777
  OS/400 Partitions not listed
 ----------------------------------------------------------
   1)    BOJSANboot                           Not Activated
   2)    s1022101                             Not Activated
   3)    s1022102                             Not Activated
   4)    s1022104                             Not Activated
   5)    s1022105_Bastion                     Not Activated
   6)    s1022106_Master1                     Not Activated
   7)    s1022107_Master2                     Not Activated
   8)    s1022108_Master3                     Not Activated
   9)    s1022109_Bootstrap                   Not Activated
   10)   s1022111                             Open Firmware
   11)   s1022198                             Running


 Enter Number of Running Partition (q to quit):


```
SMS画面が表示される。  


```
SMS (c) Copyright IBM Corp. 2000,2022 All rights reserved.
-------------------------------------------------------------------------------
 Main Menu
 1.   Select Language
 2.   Setup Remote IPL (Initial Program Load)
 3.   I/O Device Information
 4.   Select Console
 5.   Select Boot Options









 -------------------------------------------------------------------------------
 Navigation Keys:

                                             X = eXit System Management Services
 -------------------------------------------------------------------------------
 Type menu item number and press Enter or select Navigation key:
 Open Completed.

```
&nbsp; Setup Remote IPL 
&nbsp; &nbsp; → Networkブート用のポートを選択
&nbsp; &nbsp; &nbsp; →IPV4を選択→BOOTPを選択
&nbsp; &nbsp; &nbsp; &nbsp; →IP Parametersを選択
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; →この画面でIPアドレスなどを設定
 - Client：該当LPARのIPアドレス
 - Server：NIMサーバーのIPアドレス
 - Gateway: GWのIPアドレス
 - Subnet : Subnet Mask
```
 PowerPC Firmware
 Version FW1020.10 (ML1020_085)
 SMS (c) Copyright IBM Corp. 2000,2022 All rights reserved.
-------------------------------------------------------------------------------
 IP Parameters
Interpartition Logical LAN: U9105.22A.SN7777777-V11-C2-T0
 1.   Client IP Address                    [192.168.xx.xxx]
 2.   Server IP Address                    [192.168.xx.xxx]
 3.   Gateway IP Address                   [192.168.x.x]
 4.   Subnet Mask                          [255.255.xxx.xxx]









 -------------------------------------------------------------------------------
 Navigation keys:
 M = return to Main Menu
 ESC key = return to previous screen         X = eXit System Management Services
 -------------------------------------------------------------------------------
 Type menu item number and press Enter or select Navigation key:
 ```
Escキーで１画面戻り、Ping Test画面へ
```
PowerPC Firmware
 Version FW1020.10 (ML1020_085)
 SMS (c) Copyright IBM Corp. 2000,2022 All rights reserved.
-------------------------------------------------------------------------------
 Ping Test
 Interpartition Logical LAN: U9105.22A.SNxxxxxxx-V11-C2-T0
 Speed, Duplex: auto,auto
 Client IP Address: 192.168.xx.xx
 Server IP Address: 192.168.xx.xxx
 Gateway IP Address: 192.168.x.x
 Subnet Mask: 255.255.xxx.x
 Protocol: Standard
 Spanning Tree Enabled: 1
 Connector Type:
 VLAN Priority: 0
 VLAN ID: 0
 VLAN Tag:
 UDP checksum validation: Enabled
 1. Execute Ping Test
 -------------------------------------------------------------------------------
 Navigation keys:
 M = return to Main Menu      N = Next page of list
 ESC key = return to previous screen         X = eXit System Management Services
 -------------------------------------------------------------------------------
 Type menu item number and press Enter or select Navigation key:
 ```
1を押して、Pingテストの実行。通信がOKであることを確認。
```









                              .-----------------.
                              |  Ping  Success. |
                              `-----------------'












```
Escキーを何度か押して、SMSのTOP画面まで戻る。
```
 PowerPC Firmware
 Version FW1020.10 (ML1020_085)
 SMS (c) Copyright IBM Corp. 2000,2022 All rights reserved.
-------------------------------------------------------------------------------
 Main Menu
 1.   Select Language
 2.   Setup Remote IPL (Initial Program Load)
 3.   I/O Device Information
 4.   Select Console
 5.   Select Boot Options









 -------------------------------------------------------------------------------
 Navigation Keys:

                                             X = eXit System Management Services
 -------------------------------------------------------------------------------
 Type menu item number and press Enter or select Navigation key:
 ```
上記画面で、
→Select Boot Options
&nbsp; →Select Install\Boot Device
&nbsp; &nbsp; →Network→BootP
&nbsp; &nbsp; &nbsp; →該当ポートを選択
&nbsp; &nbsp; &nbsp; &nbsp; →Normal Mode Boot
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; →Yes
で、Network Bookを開始するとこんな感じでPacket Countが始まる。
```
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM




TFTP BOOT ---------------------------------------------------
Server IP.....................192.168.xx.xxx
Client IP.....................192.168.xx.xx
Gateway IP....................192.168.xx.xx
Subnet Mask...................255.255.xxx.xxx
( 1  ) Filename................./tftpboot/s1022111
TFTP Retries..................5
Block Size....................512

PACKET COUNT = 8000
```
起動された画面はこちら
```

 ******* Please define the System Console. *******

Type a 1 and press Enter to use this terminal as the
  system console.
Pour definir ce terminal comme console systeme, appuyez
  sur 1 puis sur Entree.
Taste 1 und anschliessend die Eingabetaste druecken, um
  diese Datenstation als Systemkonsole zu verwenden.
Premere il tasto 1 ed Invio per usare questo terminal
  come console.
Escriba 1 y pulse Intro para utilizar esta terminal como
  consola del sistema.
Escriviu 1 1 i premeu Intro per utilitzar aquest
  terminal com a consola del sistema.
Digite um 1 e pressione Enter para utilizar este terminal
  como console do sistema.




```
1を選択すると、以下のDiag TOP画面が起動する。
```

DIAGNOSTIC OPERATING INSTRUCTIONS  VERSION 7.3.1.0


LICENSED MATERIAL and LICENSED INTERNAL CODE - PROPERTY OF IBM
(C) COPYRIGHTS BY IBM AND BY OTHERS 1982, 2022.
ALL RIGHTS RESERVED.

These programs contain diagnostics, service aids, and tasks for
the system.  These procedures should be used whenever problems
with the system occur which have not been corrected by any
software application procedures available.

In general, the procedures will run automatically.  However,
sometimes you will be required to select options, inform the
system when to continue, and do simple tasks.

Several keys are used to control the procedures:
- The Enter key continues the procedure or performs an action.
- The Backspace key allows keying errors to be corrected.
- The cursor keys are used to select an option.

To continue, press Enter.

```
そのままEnterを押すと、Diag メニューが表示される。そうそうこれこれ。
3のTask Selectionを選択する。
```

FUNCTION SELECTION

1 Diagnostic Routines
  This selection will test the machine hardware. Wrap plugs and
  other advanced functions will not be used.
2 Advanced Diagnostics Routines
  This selection will test the machine hardware. Wrap plugs and
  other advanced functions will be used.
3 Task Selection (Diagnostics, Advanced Diagnostics, Service Aids, etc.)
  This selection will list the tasks supported by these procedures.
  Once a task is selected, a resource menu may be presented showing
  all resources supported by the task.
4 Resource Selection
  This selection will list the resources in the system that are supported
  by these procedures. Once a resource is selected, a task menu will
  be presented showing all tasks that can be run on the resource(s).
99  Exit Diagnostics

NOTE:  The terminal is not properly initialized.  You will be prompted to
       initialize the terminal after selecting one of the above options.



       To make a selection, type the number and press Enter.  [1 ]
```

ターミナルをどうするか聞かれるので、とりあえずvt320と入力してEnter

```
DEFINE TERMINAL

The terminal is not properly initialized.
The following are some of the terminal types that are supported.

 ibm3101          tvi912          vt330
 ibm3151          tvi925          vt340
 ibm3161          tvi920          wyse30
 ibm3162          tvi950          wyse50
 ibm3163          vs100           wyse60
 ibm3164          vt100           wyse100
 ibmpc            vt320           wyse350
 lft              sun

NOTE:  If you are using a Graphics Display, such as a
       5081 or 6091 display, enter 'lft' as the
       terminal type.

       If the next screen is unreadable, press <CTRL> C.

Please enter a terminal type, or press Enter to return.

```
Task Selectionメニューが表示される

```
TASKS SELECTION LIST                                                      801004


From the list below, select a task by moving the cursor to
the task and pressing 'Enter'.
To list the resources for the task highlighted, press 'List'.

[TOP]
  Run Diagnostics
  Display or Change Diagnostic Run Time Options

  Add Resource to Resource List
  Backup and Restore Media
  Certify Media
  Delete Resource from Resource List
  Display Configuration and Resource List
  Display Firmware Device Node Information
  Display Hardware Error Report
  Display Hardware Vital Product Data
  Display Multipath I/O (MPIO) Device Configuration
[MORE...10]

Esc+1=Help          Esc+4=List          F10=Exit            Enter
F3=Previous Menu
```

カーソルキーで下の方へ下がっていくと、NVMe Managerが出てくるので、これを選択。
```

TASKS SELECTION LIST                                                      801004


From the list below, select a task by moving the cursor to
the task and pressing 'Enter'.
To list the resources for the task highlighted, press 'List'.

[MORE...10]
  Display Hardware Vital Product Data
  Display Multipath I/O (MPIO) Device Configuration
  Display Resource Attributes
  Display or Change Bootlist
  Format Media
  Hot Plug Task
  Identify and Attention Indicators
  Microcode Tasks
  NVMe Manager
  NVMe Sanitize Devices
  NVMe general health information
  RAID Array Manager
[BOTTOM]

Esc+1=Help          Esc+4=List          F10=Exit            Enter
F3=Previous Menu
```
ここで、OSの導入前に、NVMeのName Spaceを作成変更することができる。
```
                                  NVMe Manager

Move cursor to desired item and press Enter.

  List NVMe Storage Configuration
  Configure a Defined NVMe Controller
  Change / Show Characteristics of a NVMe Controller
  Namespace Management and Attachment















Esc+1=Help          Esc+2=Refresh       Esc+3=Cancel        F8=Image
F9=Shell            F10=Exit            Enter=Do
```


NVMe Managerを使ったName Spaceの作成は、こちらの後半[smitから実行]が参考になります。  

https://qiita.com/tom_m_m/items/f43627431fb5d99a3f0f