2
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?

More than 1 year has passed since last update.

RHEL ppc64le MD RAID 構成 で ディスク、ボリューム・グループ、論理ボリューム、ファイルシステムを拡張

Last updated at Posted at 2023-10-30

はじめに

RHEL ppc64le MD RAID 構成で、ディスク、ボリューム・グループ、論理ボリューム、ファイルシステム拡張を実施したログです。

ボリューム・グループ"rhel"、論理ボリューム "/dev/rhel/root"、 ファイルシステム "/ "を拡張します。


環境

RHEL 8.6 ppc64le on S1022 -> OS領域 MD RAID構成

MD RAIDの構成は以下で記載しています。

マルチパス設定は以下で確認しています。

参考:

RHEL: RAID の拡張

RHEL: parted でパーティションのサイズ変更


手順

① ボリューム拡張

PowerVC で対象 ボリュームを 50GB -> 80GB に拡張 ( boot-0, boot-1 に対して)

サーバーは再起動する。multipath コマンドでサイズ変更が認識されたことを確認

# multipath -ll
mpatha (360050763808106d7d8000000000002fd) dm-0 AIX,VDASD
size=80G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='service-time 0' prio=1 status=active
  |- 0:0:1:0 sda 8:0  active ready running
  `- 1:0:1:0 sdc 8:32 active ready running
mpathb (360050763808106d7d8000000000002fe) dm-1 AIX,VDASD
size=80G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='service-time 0' prio=1 status=active
  |- 0:0:2:0 sdb 8:16 active ready running
  `- 1:0:2:0 sdd 8:48 active ready running
② 変更前確認
# lsblk --fs
NAME              FSTYPE            LABEL     UUID                                   MOUNTPOINT
sda               mpath_member
└─mpatha
  ├─mpatha1
  ├─mpatha2       linux_raid_member rhel86:0 5dfd2d76-9a03-0e84-1fe2-e429a5348eec
  │ └─md0         xfs                         41435ad6-deae-470a-a6dd-5597e6260a7f   /boot
  └─mpatha3       linux_raid_member rhel86:1 6660f874-01c3-2e81-783d-5695ef10722f
    └─md1         LVM2_member                 g7Tf3O-RPDf-z9Sg-2mJZ-BSOh-vaHK-92PW14
      ├─rhel-root xfs                         b8956ba8-47d5-49ec-888e-d5d226d7143a   /   #<= / 領域
      └─rhel-swap swap                        c5855925-d52f-4405-8c32-e721c0312344   [SWAP]
sdb               mpath_member
└─mpathb
  ├─mpathb1
  ├─mpathb2       linux_raid_member rhel86:0 5dfd2d76-9a03-0e84-1fe2-e429a5348eec
  │ └─md0         xfs                         41435ad6-deae-470a-a6dd-5597e6260a7f   /boot
  └─mpathb3       linux_raid_member rhel86:1 6660f874-01c3-2e81-783d-5695ef10722f
    └─md1         LVM2_member                 g7Tf3O-RPDf-z9Sg-2mJZ-BSOh-vaHK-92PW14
      ├─rhel-root xfs                         b8956ba8-47d5-49ec-888e-d5d226d7143a   /    #<= / 領域
      └─rhel-swap swap                        c5855925-d52f-4405-8c32-e721c0312344   [SWAP]
sdc               mpath_member
└─mpatha
  ├─mpatha1
  ├─mpatha2       linux_raid_member rhel86:0 5dfd2d76-9a03-0e84-1fe2-e429a5348eec
  │ └─md0         xfs                         41435ad6-deae-470a-a6dd-5597e6260a7f   /boot
  └─mpatha3       linux_raid_member rhel86:1 6660f874-01c3-2e81-783d-5695ef10722f
    └─md1         LVM2_member                 g7Tf3O-RPDf-z9Sg-2mJZ-BSOh-vaHK-92PW14
      ├─rhel-root xfs                         b8956ba8-47d5-49ec-888e-d5d226d7143a   /    #<= / 領域
      └─rhel-swap swap                        c5855925-d52f-4405-8c32-e721c0312344   [SWAP]
sdd               mpath_member
└─mpathb
  ├─mpathb1
  ├─mpathb2       linux_raid_member rhel86:0 5dfd2d76-9a03-0e84-1fe2-e429a5348eec
  │ └─md0         xfs                         41435ad6-deae-470a-a6dd-5597e6260a7f   /boot
  └─mpathb3       linux_raid_member rhel86:1 6660f874-01c3-2e81-783d-5695ef10722f  
    └─md1         LVM2_member                 g7Tf3O-RPDf-z9Sg-2mJZ-BSOh-vaHK-92PW14
      ├─rhel-root xfs                         b8956ba8-47d5-49ec-888e-d5d226d7143a   /     #<= / 領域
      └─rhel-swap swap                        c5855925-d52f-4405-8c32-e721c0312344   [SWAP]
sr0               iso9660           config-2  2023-10-25-03-03-30-00

=> mpatha3、mpathb3 が / に相当する。
=> md1 のメンバー
 

・/dev/md1 を確認する

# mdadm -D /dev/md1
/dev/md1:
           Version : 1.0
     Creation Time : Tue Jul 25 00:22:36 2023
        Raid Level : raid1
        Array Size : 51374976 (48.99 GiB 52.61 GB)
     Used Dev Size : 51374976 (48.99 GiB 52.61 GB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

       Update Time : Wed Oct 25 04:08:31 2023
             State : clean
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : resync

              Name : rhel86:1
              UUID : 6660f874:01c32e81:783d5695:ef10722f
            Events : 91

    Number   Major   Minor   RaidDevice State
       2     253        4        0      active sync   /dev/dm-4
       1     253        7        1      active sync   /dev/dm-7

=> /dev/dm-4, /dev/dm-7 で構成されている

③ /dev/mapper/mpatha3 を /dev/md1 から外す
# mdadm /dev/md1 --fail /dev/mapper/mpatha3 --remove /dev/mapper/mpatha3
mdadm: set /dev/mapper/mpatha3 faulty in /dev/md1
mdadm: hot removed /dev/mapper/mpatha3 from /dev/md1

・確認

# mdadm -D /dev/md1
/dev/md1:
           Version : 1.0
     Creation Time : Tue Jul 25 00:22:36 2023
        Raid Level : raid1
        Array Size : 51374976 (48.99 GiB 52.61 GB)
     Used Dev Size : 51374976 (48.99 GiB 52.61 GB)
      Raid Devices : 2
     Total Devices : 1
       Persistence : Superblock is persistent

       Update Time : Wed Oct 25 04:12:08 2023
             State : active, degraded
    Active Devices : 1
   Working Devices : 1
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : resync

              Name : rhel86:1
              UUID : 6660f874:01c32e81:783d5695:ef10722f
            Events : 97

    Number   Major   Minor   RaidDevice State
       -       0        0        0      removed
       1     253        7        1      active sync   /dev/dm-7
④ mpatha のパーティション・リサイズ
# parted /dev/mapper/mpatha
GNU Parted 3.2
Using /dev/mapper/mpatha
Welcome to GNU Parted! Type 'help' to view a list of commands.

・ print で確認

(parted) print
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpatha: 85.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  5243kB  4194kB  primary               boot, prep
 2      5243kB  1079MB  1074MB  primary  xfs          raid
 3      1079MB  53.7GB  52.6GB  primary               raid

・ resizepart コマンドでサイズ変更を実行 (70GiB を割り当て)

(parted) resizepart 3 70GiB

(参考) 残り全てを割り当てる場合

(parted) resizepart 3 100%

・ 確認

(parted) print
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpatha: 85.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  5243kB  4194kB  primary               boot, prep
 2      5243kB  1079MB  1074MB  primary  xfs          raid
 3      1079MB  75.2GB  74.1GB  primary               raid

### -> partition 3 の サイズが 74.1GB になっている。

・確認

 cat /proc/partitions
major minor  #blocks  name

   8        0   83886080 sda
   8       16   83886080 sdb
   8       32   83886080 sdc
   8       48   83886080 sdd
  11        0        506 sr0
 253        0   83886080 dm-0
 253        1   83886080 dm-1
 253        2       4096 dm-2
 253        3    1048576 dm-3
 253        4   72346624 dm-4    #<= サイズが変更されている。
   9        1   51374976 md1
   9        0    1048512 md0
 253        5       4096 dm-5
 253        6    1048576 dm-6
 253        7   51375104 dm-7
 253        8   47132672 dm-8
 253        9    4239360 dm-9
⑤ 拡張した /dev/mapper/mpatha3 を /dev/md1 に戻す
 # mdadm -a /dev/md1 /dev/mapper/mpatha3
mdadm: added /dev/mapper/mpatha3

・確認

# watch mdadm -D /dev/md1
/dev/md1:
           Version : 1.0
     Creation Time : Tue Jul 25 00:22:36 2023
        Raid Level : raid1
        Array Size : 51374976 (48.99 GiB 52.61 GB)
     Used Dev Size : 51374976 (48.99 GiB 52.61 GB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

       Update Time : Wed Oct 25 04:15:47 2023
             State : clean, degraded, recovering
    Active Devices : 1
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 1

Consistency Policy : resync

    Rebuild Status : 5% complete   #<=  Rebuild 中

              Name : rhel86:1
              UUID : 6660f874:01c32e81:783d5695:ef10722f
            Events : 148

    Number   Major   Minor   RaidDevice State
       2     253        4        0      spare rebuilding   /dev/dm-4  #<=  Rebuild 中
       1     253        7        1      active sync   /dev/dm-7 

=> 4分くらい待つと /dev/dm-4 も active sync となった。


⑥ /dev/mapper/mpathb3 側も同じ作業を実施

・/dev/mapper/mpathb3 を /dev/md1 から外す

#  mdadm /dev/md1 --fail /dev/mapper/mpathb3 --remove /dev/mapper/mpathb3
mdadm: set /dev/mapper/mpathb3 faulty in /dev/md1
mdadm: hot removed /dev/mapper/mpathb3 from /dev/md1

・/dev/mapper/mpathb3 のリサイズ

# parted /dev/mapper/mpathb
GNU Parted 3.2
Using /dev/mapper/mpathb
Welcome to GNU Parted! Type 'help' to view a list of commands.

### print で確認

(parted) print
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpathb: 85.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  5243kB  4194kB  primary               boot, prep
 2      5243kB  1079MB  1074MB  primary  xfs          raid
 3      1079MB  53.7GB  52.6GB  primary               raid


### resizepart コマンドで サイズ変更を実行 (70GiB を割り当て)

(parted) resizepart 3 70GiB
(parted) print
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpathb: 85.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  5243kB  4194kB  primary               boot, prep
 2      5243kB  1079MB  1074MB  primary  xfs          raid
 3      1079MB  75.2GB  74.1GB  primary               raid  #<= 74.1GBになった
(parted)

・確認

# cat /proc/partitions
major minor  #blocks  name

   8        0   83886080 sda
   8       16   83886080 sdb
   8       32   83886080 sdc
   8       48   83886080 sdd
  11        0        506 sr0
 253        0   83886080 dm-0
 253        1   83886080 dm-1
 253        2       4096 dm-2
 253        3    1048576 dm-3
 253        4   72346624 dm-4
   9        1   51374976 md1
   9        0    1048512 md0
 253        5       4096 dm-5
 253        6    1048576 dm-6
 253        7   72346624 dm-7      #<= サイズが増えている
 253        8   47132672 dm-8
 253        9    4239360 dm-9

・/dev/mapper/mpathb3 を /dev/md1 に戻す

# mdadm -a /dev/md1 /dev/mapper/mpathb3
mdadm: added /dev/mapper/mpathb3

・ ~ 4分くらいで追加デバイスは "active sync" 状態になる

# mdadm -D /dev/md1 | grep dm-7
       3     253        7        1      active sync   /dev/dm-7
⑦ /dev/md1 でサイズ拡張認識
# mdadm --grow --size=max /dev/md1
mdadm: component size of /dev/md1 has been set to 72346548K

mdadm -D /dev/md1 で確認
この後 2 分くらい sync が走っていました。

⑧ PVサイズ変更認識

・確認

# pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/md1   rhel lvm2 a--  48.99g    0

# pvdisplay
  --- Physical volume ---
  PV Name               /dev/md1
  VG Name               rhel
  PV Size               48.99 GiB / not usable <2.88 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              12542
  Free PE               0
  Allocated PE          12542
  PV UUID               g7Tf3O-RPDf-z9Sg-2mJZ-BSOh-vaHK-92PW14

・vgの容量も確認

# vgs
  VG   #PV #LV #SN Attr   VSize  VFree
  rhel   1   2   0 wz--n- 48.99g    0

・pvresize コマンドを実行

# pvresize /dev/md1
  Physical volume "/dev/md1" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

・確認

# pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/md1   rhel lvm2 a--  68.99g    0

-> 68.99G になりました。

割り当て容量の70GBでないのは、メタデータが使用している領域があると思われます。


⑨ VGサイズ変更認識

pv リサイズで vg も変更が認識されていました。

# vgs
  VG   #PV #LV #SN Attr   VSize  VFree
  rhel   1   2   0 wz--n- 68.99g 20.00g

➓ LV (/dev/rhel/root) サイズ変更認識

・確認

# lvs
  LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root rhel -wi-ao---- <44.95g
  swap rhel -wi-ao----   4.04g

・フリーサイズを全て /dev/rhel/root に割り当てる

# lvresize -l  +100%FREE /dev/rhel/root
  Size of logical volume rhel/root changed from <44.95 GiB (11507 extents) to <64.95 GiB (16627 extents).
  Logical volume rhel/root successfully resized.

-> LV は 64.95GiB で認識されました。LVMのメタデータによる領域が少し使用されていると考えられます。

・確認

# lvs
  LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root rhel -wi-ao---- <64.95g
  swap rhel -wi-ao----   4.04g
# lvdisplay
  --- Logical volume ---
  LV Path                /dev/rhel/swap
  LV Name                swap
  VG Name                rhel
  LV UUID                agrI3K-KYNv-TTXk-kTcS-ipT2-fjsd-nzhx4x
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2023-05-02 20:39:20 -0400
  LV Status              available
  # open                 2
  LV Size                4.04 GiB
  Current LE             1035
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:9

  --- Logical volume ---
  LV Path                /dev/rhel/root
  LV Name                root
  VG Name                rhel
  LV UUID                SQt0XI-0lW9-wOez-URb9-qx58-Q1q4-jqU9ch
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2023-05-02 20:39:20 -0400
  LV Status              available
  # open                 1
  LV Size                <64.95 GiB
  Current LE             16627
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:8

11. / ファイルシステム・サイズ変更認識

・確認

# df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               1.7G     0  1.7G   0% /dev
tmpfs                  1.8G     0  1.8G   0% /dev/shm
tmpfs                  1.8G   18M  1.8G   1% /run
tmpfs                  1.8G     0  1.8G   0% /sys/fs/cgroup
/dev/mapper/rhel-root   45G  5.5G   40G  13% /
/dev/md0              1018M  589M  430M  58% /boot
tmpfs                  352M     0  352M   0% /run/user/0

拡張実行 xfs のため、xfs_growfs コマンドを使用しています。

# xfs_growfs  /
meta-data=/dev/mapper/rhel-root  isize=512    agcount=4, agsize=2945792 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1    bigtime=0 inobtcount=0
data     =                       bsize=4096   blocks=11783168, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=5753, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 11783168 to 17026048

・確認

# df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               1.7G     0  1.7G   0% /dev
tmpfs                  1.8G     0  1.8G   0% /dev/shm
tmpfs                  1.8G   18M  1.8G   1% /run
tmpfs                  1.8G     0  1.8G   0% /sys/fs/cgroup
/dev/mapper/rhel-root   65G  5.7G   60G   9% /
/dev/md0              1018M  589M  430M  58% /boot
tmpfs                  352M     0  352M   0% /run/user/0

/dev/mapper/rhel-root (/) は 65G に拡張されています。


おわりに

リブート後も問題なく拡張状態となっていることを確認しました。
拡張する対象箇所によっては他の方法が必要となる可能性があります。

ご参考まで。

2
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
2
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?