LoginSignup
0
0

More than 1 year has passed since last update.

RHEL8.4 ppc64le (multipath構成) にディスクを追加する

Last updated at Posted at 2022-03-07
はじめに

RHEL 8.4 に外部ディスクをPowerVCから追加して、PV、VG、LV、FSを作成したメモです。

  • RHEL のマニュアル見ていると、Ansible playbook での設定例で表示されていますね..

環境

OS: RHEL 8.4 (ppc64le on IBM Power S824) => 検証ではtest0307 というホスト名
ディスク接続:
 ・ NPIV (N Port ID Virtualization)
 ・ multipath 構成

Storage: V7000

PowerVC 2.0.1


PowerVC からディスク作成、接続

"test0307" というサーバーにディスクを追加します。

図1.png

Volumes タブで "Attach" を押します。

スクリーンショット 2022-03-07 11.03.07.png

New Volumes タブで追加するディスク情報を入力し "Attache volumes" を押します。

スクリーンショット 2022-03-07 11.03.29.png

作成後、少し待ちます。
スクリーンショット 2022-03-07 11.13.06.png

test0307-2 (5GB)が追加されています。


RHEL 上でのディスク認識

ディスク・スキャンの参考

サーバーにログインしマルチパスを確認

[root@test0307 ~]# cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.4 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.4 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.4:GA"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.4
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.4"
[root@test0307 ~]#
[root@test0307 ~]# multipath -ll
mpathb (xxxxxxxxx083dfxxxxxx000000axxxxxx) dm-0 IBM,2145
size=50G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=10 status=enabled
| |- 1:0:0:0 sda 8:0   active ready running
| |- 2:0:1:0 sdd 8:48  active ready running
| |- 3:0:1:0 sdf 8:80  active ready running
| `- 4:0:0:0 sdg 8:96  active ready running
`-+- policy='service-time 0' prio=50 status=active
  |- 1:0:1:0 sdb 8:16  active ready running
  |- 2:0:0:0 sdc 8:32  active ready running
  |- 3:0:0:0 sde 8:64  active ready running
  `- 4:0:1:0 sdh 8:112 active ready running
{{{

mpathb が1つあります。
mpathb はOS領域のディスクです。

[[root@test0307 ~]# lsblk /dev/mapper/mpathb --fs
NAME          FSTYPE      LABEL UUID                                   MOUNTPOINT
mpathb
├─mpathb1
├─mpathb2     xfs               cbxxxx6-c205-xxx-b8f0-dxxx489xxxxx   /boot
└─mpathb3     LVM2_member       Ovxxx-FQ6s-xxx-U1wd-xxx-4TW9-Axxxv
  ├─rhel-root xfs               9xxxxx95-357b-xxxx-9488-4xxxxxx66ed2c   /
  └─rhel-swap swap              d7xxxxxx-6b5c-42f2-xxxx-76exxxxxaxxef   [SWAP]

追加したディスクがまだ認識されていないので追加します。
hostのscan を行います。

[root@test0307 ~]# ls -l /sys/class/scsi_host/
total 0
lrwxrwxrwx. 1 root root 0 Mar  6 19:38 host0 -> ../../devices/vio/30000002/host0/scsi_host/host0
lrwxrwxrwx. 1 root root 0 Mar  6 19:38 host1 -> ../../devices/vio/30000003/host1/scsi_host/host1
lrwxrwxrwx. 1 root root 0 Mar  6 19:38 host2 -> ../../devices/vio/30000004/host2/scsi_host/host2
lrwxrwxrwx. 1 root root 0 Mar  6 19:38 host3 -> ../../devices/vio/30000005/host3/scsi_host/host3
lrwxrwxrwx. 1 root root 0 Mar  6 19:38 host4 -> ../../devices/vio/30000006/host4/scsi_host/host4

[root@test0307 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@test0307 ~]# echo $?
0
[root@test0307 ~]# echo "- - -" > /sys/class/scsi_host/host1/scan
[root@test0307 ~]# echo $?
0
[root@test0307 ~]# echo "- - -" > /sys/class/scsi_host/host2/scan
[root@test0307 ~]# echo $?
0
[root@test0307 ~]# echo "- - -" > /sys/class/scsi_host/host3/scan
[root@test0307 ~]# echo $?
0
[root@test0307 ~]# echo "- - -" > /sys/class/scsi_host/host4/scan
[root@test0307 ~]# echo $?
0

確認

[root@test0307 ~]# multipath -ll
mpathc (xxxxxx7680xxxxx00000000xxxxx00xxx) dm-6 IBM,2145
size=5.0G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 1:0:0:1 sdi 8:128 active ready running
| |- 2:0:1:1 sdl 8:176 active ready running
| |- 3:0:1:1 sdn 8:208 active ready running
| `- 4:0:0:1 sdo 8:224 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 1:0:1:1 sdj 8:144 active ready running
  |- 2:0:0:1 sdk 8:160 active ready running
  |- 3:0:0:1 sdm 8:192 active ready running
  `- 4:0:1:1 sdp 8:240 active ready running
mpathb (xxxxxxxxx083dfxxxxxx000000axxxxxx) dm-0 IBM,2145
size=50G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=10 status=enabled
| |- 1:0:0:0 sda 8:0   active ready running
| |- 2:0:1:0 sdd 8:48  active ready running
| |- 3:0:1:0 sdf 8:80  active ready running
| `- 4:0:0:0 sdg 8:96  active ready running
`-+- policy='service-time 0' prio=50 status=active
  |- 1:0:1:0 sdb 8:16  active ready running
  |- 2:0:0:0 sdc 8:32  active ready running
  |- 3:0:0:0 sde 8:64  active ready running
  `- 4:0:1:0 sdh 8:112 active ready running
[root@test0307 ~]#

mpathc が認識されました


PV,VG,LV,FS 作成

PV(物理ボリューム)、VG(ボリューム・グループ)、LV(論理ボリューム)、FS(ファイル・システム)を作成し、マウントします。

[root@test0307 ~]# parted /dev/mapper/mpathc
GNU Parted 3.2
Using /dev/mapper/mpathc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel
New disk label type? msdos
(parted) p
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpathc: 5369MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End  Size  Type  File system  Flags

(parted) mkpart
Partition type?  primary/extended? p
File system type?  [ext2]? xfs
Start? 1
End? -0
(parted) p
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpathc: 5369MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  5369MB  5368MB  primary  xfs          lba

(parted)
(parted) set 1 lvm on
(parted) p
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpathc: 5369MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  5369MB  5368MB  primary  xfs          lvm, lba

(parted) quit
Information: You may need to update /etc/fstab.

[root@test0307 ~]# ls -l /dev/mapper
total 0
crw-------. 1 root root 10, 236 Mar  6 19:38 control
lrwxrwxrwx. 1 root root       7 Mar  6 19:38 mpathb -> ../dm-0
lrwxrwxrwx. 1 root root       7 Mar  6 19:38 mpathb1 -> ../dm-1
lrwxrwxrwx. 1 root root       7 Mar  6 19:38 mpathb2 -> ../dm-2
lrwxrwxrwx. 1 root root       7 Mar  6 19:38 mpathb3 -> ../dm-3
lrwxrwxrwx. 1 root root       7 Mar  6 19:59 mpathc -> ../dm-6
lrwxrwxrwx. 1 root root       7 Mar  6 19:59 mpathc1 -> ../dm-7
lrwxrwxrwx. 1 root root       7 Mar  6 19:38 rhel-root -> ../dm-4
lrwxrwxrwx. 1 root root       7 Mar  6 19:38 rhel-swap -> ../dm-5

mpathc1 が作成されています。

PVを作成します。

[root@test0307 ~]# pvs
  PV                  VG   Fmt  Attr PSize  PFree
  /dev/mapper/mpathb3 rhel lvm2 a--  48.99g    0

[root@test0307 ~]# pvcreate /dev/mapper/mpathc1
  Physical volume "/dev/mapper/mpathc1" successfully created.

[root@test0307 ~]# pvs
  PV                  VG   Fmt  Attr PSize  PFree
  /dev/mapper/mpathb3 rhel lvm2 a--  48.99g     0
  /dev/mapper/mpathc1      lvm2 ---  <5.00g <5.00g

mpathc1 がPVとして作成されました。

VG を作成します。

[root@test0307 ~]# vgs
  VG   #PV #LV #SN Attr   VSize  VFree
  rhel   1   2   0 wz--n- 48.99g    0

[root@test0307 ~]# vgcreate testvg /dev/mapper/mpathc1
  Volume group "testvg" successfully created

[root@test0307 ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  rhel     1   2   0 wz--n- 48.99g     0
  testvg   1   0   0 wz--n- <5.00g <5.00g

LV を作成します。名前は testlv、サイズは 4.8GB です。

[root@test0307 ~]# lvs
  LV   VG   Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root rhel -wi-ao---- 44.94g
  swap rhel -wi-ao----  4.05g

[root@test0307 ~]# lvcreate -n testlv -L 4.8GiB testvg
  Rounding up size to full physical extent 4.80 GiB
  Logical volume "testlv" created.

[root@test0307 ~]# lvs
  LV     VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   rhel   -wi-ao---- 44.94g
  swap   rhel   -wi-ao----  4.05g
  testlv testvg -wi-a-----  4.80g

ファイル・システムを作成

[root@test0307 ~]# lsblk /dev/testvg/testlv
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
testvg-testlv 253:8    0  4.8G  0 lvm
[root@test0307 ~]# lsblk /dev/testvg/testlv --fs
NAME          FSTYPE LABEL UUID MOUNTPOINT
testvg-testlv


[root@test0307 ~]# mkfs.xfs /dev/testvg/testlv
mkfs.xfs: Volume reports stripe unit of 32768 bytes and stripe width of 0, ignoring.
meta-data=/dev/testvg/testlv     isize=512    agcount=4, agsize=314624 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1
data     =                       bsize=4096   blocks=1258496, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0


[root@test0307 ~]# lsblk /dev/testvg/testlv --fs
NAME          FSTYPE LABEL UUID                                 MOUNTPOINT
testvg-testlv xfs          bxxxxxea-996b-41f6-94ed-d5xxxx86xxx

マウント・ディレクトリ作成

[root@test0307 ~]# mkdir -p /work/testvg

[root@test0307 ~]# ls -ld /work/testvg
drwxr-xr-x. 2 root root 6 Mar  6 20:10 /work/testvg

ファイル・システムのマウント

[root@test0307 ~]# mount | grep testvg
[root@test0307 ~]#

[root@test0307 ~]# mount /dev/mapper/testvg-testlv /work/testvg

[root@test0307 ~]# mount | grep testvg
/dev/mapper/testvg-testlv on /work/testvg type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)

/etc/fstab を修正し、起動時にマウントされるように修正します。
"/dev/mapper/testvg-testlv /work/testvg xfs defaults 0 0" 行を追加しました。

[root@test0307 ~]# vi /etc/fstab

#
# /etc/fstab
# Created by anaconda on Mon Nov  8 23:05:09 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
/dev/mapper/rhel-root   /                       xfs     defaults        0 0
UUID=cbxxxx2e6-c205-4xxx-xxf0-dxxx489xxxx /boot                   xfs     defaults        0 0
/dev/mapper/rhel-swap   none                    swap    defaults        0 0

/dev/mapper/testvg-testlv  /work/testvg   xfs   defaults   0 0
~
~
"/etc/fstab" 16L, 643C written

これでOSで追加ディスクがファイル・システムとして使用できるようになりました。

以上です。

0
0
0

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
0
0