[小ネタ]FSx for NetApp ONTAP volume show コマンドの結果をボリュームごとに一行で出力し Excel で成形してみる

2023.12.14

コーヒーが好きな emi です。

FSx for NetApp ONTAP ボリュームの詳細情報は volume show コマンドで取得することができます。
前回 [小ネタ]FSx for NetApp ONTAP で複数あるボリュームの詳細情報一覧を取得する | DevelopersIO で似たようなことをブログにかきましたが、volume show コマンドの結果をボリュームごとに一行で出力し Excel で成形してみたので方法を共有します。

FSx for NetApp ONTAP のバージョン

FSx for NetApp ONTAP のバージョンはシンプルに version コマンドで確認できます。

▼実行結果

FsxId0f1aac816b9a0f0de::> version
NetApp Release 9.13.1P5: Thu Nov 02 20:37:09 UTC 2023

FsxId0f1aac816b9a0f0de::>

2023/12/14 時点でのバージョンは 9.13.1 であることが分かります。

ボリュームの詳細を一行で出力する -fields

-fields パラメーターを使うことで、表示したいパラメーターをボリュームごとに一行で表示できます。

コマンド構文

volume show -vserver <SVM 名> -fields <表示したいパラメーター1>, <表示したいパラメーター2>, <表示したいパラメーター3>, …

実行コマンド例

volume show -vserver svm1-abcdefghijklmnopqrstuxwxyz -fields total, used, available, percent-used

▼実行結果

FsxId0f1aac816b9a0f0de::> volume show -vserver svm1-abcdefghijklmnopqrstuxwxyz -fields total, used, available, percent-used
vserver                         volume                               available total   used  percent-used
------------------------------- ------------------------------------ --------- ------- ----- ------------
svm1-abcdefghijklmnopqrstuxwxyz svm1_abcdefghijklmnopqrstuxwxyz_root 972.4MB   972.8MB 424KB 0%
svm1-abcdefghijklmnopqrstuxwxyz svm1_vol1_abcdefghijklmnopqrstuxwxyz 9.50GB    9.50GB  384KB 0%
2 entries were displayed.

FsxId0f1aac816b9a0f0de::>

このように、SVM 名やボリューム名が長くても、一行で表示されています。

表示できるパラメーター一覧

表示できるパラメーターは volume show -fields ? で確認できます。ドキュメントにも記載されています。
上記「ボリュームの詳細を一行で出力する -fields」では、以下ハイライトした total, used, available, percent-used を表示しているわけです。

volume show -fields ? の実行結果(クリックで展開)
FsxId0f1aac816b9a0f0de::> volume show -fields ?
  vserver                                          Vserver Name
  volume                                           Volume Name
  aggregate                                        Aggregate Name
  aggr-list                                        List of Aggregates for FlexGroup Constituents
  encryption-type                                  Encryption Type
  nodes                                            List of Nodes Hosting the Volume
  size                                             Volume Size
  dsid                                             Volume Data Set ID
  msid                                             Volume Master Data Set ID
  state                                            Volume State
  volume-style                                     Volume Style
  volume-style-extended                            Extended Volume Style
  flexcache-endpoint-type                          FlexCache Endpoint Type
  is-cluster-volume                                Is Cluster-Mode Volume
  is-constituent                                   Is Constituent Volume
  constituent-count                                Number of Constituent Volumes
  policy                                           Export Policy
  user                                             User ID
  group                                            Group ID
  security-style                                   Security Style
  unix-permissions                                 UNIX Permissions
  junction-path                                    Junction Path
  junction-path-source                             Junction Path Source
  junction-active                                  Junction Active
  junction-parent                                  Junction Parent Volume
  comment                                          Comment
  available                                        Available Size
  filesystem-size                                  Filesystem Size
  total                                            Total User-Visible Size
  used                                             Used Size
  percent-used                                     Used Percentage
  space-nearly-full-threshold-percent              Volume Nearly Full Threshold Percent
  space-full-threshold-percent                     Volume Full Threshold Percent
  max-autosize                                     Maximum Autosize
  min-autosize                                     Minimum Autosize
  autosize-grow-threshold-percent                  Autosize Grow Threshold Percentage
  autosize-shrink-threshold-percent                Autosize Shrink Threshold Percentage
  autosize-mode                                    Autosize Mode
  files                                            Total Files (for user-visible data)
  files-used                                       Files Used (for user-visible data)
  space-guarantee-enabled                          Space Guarantee in Effect
  is-space-slo-enabled                             Space SLO in Effect
  space-slo                                        Space SLO
  space-guarantee                                  Space Guarantee Style
  fractional-reserve                               Fractional Reserve
  type                                             Volume Type
  snapdir-access                                   Snapshot Directory Access Enabled
  percent-snapshot-space                           Space Reserved for Snapshot Copies
  snapshot-space-used                              Snapshot Reserve Used
  snapshot-policy                                  Snapshot Policy
  create-time                                      Creation Time
  language                                         Language
  clone-volume                                     Clone Volume
  node                                             Node name
  clone-parent-vserver                             Clone Parent Vserver Name
  clone-parent-name                                FlexClone Parent Volume
  nvfail                                           NVFAIL Option
  in-nvfailed-state                                Volume's NVFAIL State
  dr-force-nvfail                                  Force NVFAIL on MetroCluster Switchover
  filesys-size-fixed                               Is File System Size Fixed
  extent-enabled                                   (DEPRECATED)-Extent Option
  overwrite-reserve                                Reserved Space for Overwrites
  space-mgmt-try-first                             Primary Space Management Strategy
  read-realloc                                     Read Reallocation Option
  sched-snap-name                                  Naming Scheme for Automatic Snapshot Copies
  is-inconsistent                                  Inconsistency in the File System
  is-quiesced-on-disk                              Is Volume Quiesced (On-Disk)
  is-quiesced-in-memory                            Is Volume Quiesced (In-Memory)
  is-sis-volume                                    Volume Contains Shared or Compressed Data
  sis-space-saved                                  Space Saved by Storage Efficiency
  sis-space-saved-percent                          Percentage Saved by Storage Efficiency
  dedupe-space-saved                               Space Saved by Deduplication Along With VBN ZERO Savings
  dedupe-space-saved-percent                       Percentage Saved by Deduplication
  dedupe-space-shared                              Unique Data Which Got Shared by Deduplication
  compression-space-saved                          Space Saved by Compression
  compression-space-saved-percent                  Percentage Space Saved by Compression
  size-used-by-snapshots                           Volume Size Used by Snapshot Copies
  block-type                                       Block Type
  is-moving                                        Is Volume Moving
  hybrid-cache-eligibility                         Flash Pool Caching Eligibility
  hybrid-cache-write-caching-ineligibility-reason  Flash Pool Write Caching Ineligibility Reason
  constituent-role                                 Constituent Volume Role
  qos-policy-group                                 QoS Policy Group Name
  qos-adaptive-policy-group                        QoS Adaptive Policy Group Name
  caching-policy                                   Caching Policy Name
  is-volume-in-cutover                             Is Volume Move in Cutover Phase
  snapshot-count                                   Number of Snapshot Copies in the Volume
  vbn-bad-present                                  VBN_BAD may be present in the active filesystem
  is-vol-on-hybrid-aggr                            Is Volume on a hybrid aggregate
  physical-used                                    Total Physical Used Size
  physical-used-percent                            Physical Used Percentage
  flexgroup-name                                   FlexGroup Name
  is-flexgroup                                     Is Volume a FlexGroup
  snaplock-type                                    SnapLock Type
  vserver-dr-protection                            Vserver DR Protection
  encrypt                                          Enable or Disable Encryption
  is-encrypted                                     Is Volume Encrypted
  encryption-state                                 Encryption State
  key-id                                           Encryption Key ID
  key-creation-time                                Encryption Key Creation Time
  application                                      Application
  is-protocol-access-fenced                        Is Fenced for Protocol Access
  protocol-access-fenced-by                        Protocol Access Fence Owner
  single-instance-data-logging                     Is SIDL enabled
  over-provisioned                                 Over Provisioned Size
  snapshot-reserve-available                       Available Snapshot Reserve Size
  logical-used                                     Logical Used Size
  logical-used-percent                             Logical Used Percentage
  logical-available                                Logical Available Size
  logical-used-by-afs                              Logical Size Used by Active Filesystem
  logical-used-by-snapshots                        Logical Size Used by All Snapshots
  is-space-reporting-logical                       Logical Space Reporting
  is-space-enforcement-logical                     Logical Space Enforcement
  tiering-policy                                   Volume Tiering Policy
  performance-tier-inactive-user-data              Performance Tier Inactive User Data
  performance-tier-inactive-user-data-percent      Performance Tier Inactive User Data Percent
  tiering-object-tags                              Tags to be Associated with Objects Stored on a FabricPool
  needs-object-retagging                           Does the Object Tagging Scanner Need to Run on This Volume
  is-analytics-supported                           Is File System Analytics Supported
  analytics-unsupported-reason                     Reason File System Analytics is not Supported
  analytics-state                                  File System Analytics State
  analytics-scan-progress                          File System Analytics Scan Progress
  activity-tracking-state                          Activity Tracking State
  is-activity-tracking-supported                   Is Activity Tracking Supported
  activity-tracking-unsupported-reason             Reason Activity Tracking Is Not Supported
  is-smbc-master                                   Is SMBC Master
  is-smbc-failover-capable                         Is SMBC Failover Capable
  smbc-consensus                                   SMBC Consensus
  anti-ransomware-state                            Anti-ransomware State
  granular-data                                    Granular data
  snapshot-locking-enabled                         Enable Snapshot Copy Locking
  expiry-time                                      Expiry Time
  compliance-clock-time                            ComplianceClock Time
  is-large-size-enabled                            Are Large Size Volumes and Files Enabled

FsxId0f1aac816b9a0f0de::>

Excel で成形

コマンド実行結果をコピーします。

コピーした実行結果を Excel に貼り付けます。
右クリックして「貼り付け先の書式に合わせる」を選択して貼り付けます。

貼り付けたら、貼り付けたセルが選択された状態になっているので、「データ」タブを選択し、「区切り位置」をクリックします。

区切り位置指定ウィザードが開きます。
「スペースによって右または左に揃えられた固定長フィールドのデータ」を選択して「次へ」をクリックします。

フィールドの幅を確認できます。
このままで良さそうだったので、何もせず「次へ」をクリックします。

区切った後のデータ形式を指定できますが、何もせず「完了」をクリックします。

セルごとに値が分けられました。

お好みですが、列幅を調整しておきます。
Excel の列上部にアイコンを移動させ、列幅を広げるアイコンに変わった状態でダブルクリックすると、セル内の文字列がすべて表示される列幅まで広がります。

枠線や色を付けると良い感じに見えます。

背景

重複排除や圧縮によってどれくらいデータが縮小されたか確認するために表形式でボリュームの詳細を表示したかったのですが、SVM 名やボリューム名が長いと以下のように改行が入ってしまいます。

FsxId0f1aac816b9a0f0de::> volume show -vserver svm1-abcdefghijklmnopqrstuxwxyz
Vserver   Volume       Aggregate    State      Type       Size  Available Used%
--------- ------------ ------------ ---------- ---- ---------- ---------- -----
svm1-abcdefghijklmnopqrstuxwxyz
          svm1_abcdefghijklmnopqrstuxwxyz_root
                       aggr1        online     RW          1GB    972.4MB    0%
svm1-abcdefghijklmnopqrstuxwxyz
          svm1_vol1_abcdefghijklmnopqrstuxwxyz
                       aggr1        online     RW         10GB     9.50GB    0%
2 entries were displayed.

FsxId0f1aac816b9a0f0de::>

-fields パラメーターを使うことで、表示したいパラメーターをボリュームごとに一行で表示できました。

参考