Featured image of post Proxmox VE 8.3 の ZFS MIROR を縮小し SSD を交換する!!

Proxmox VE 8.3 の ZFS MIROR を縮小し SSD を交換する!!

Summary

前回 ZFS MIROR が壊れたので修復したが、保守パーツとして確保していた SSD も不良ロットと同一であったため同症状が出ていて、コンシューマ製品を選択したのが間違いであった。
そのため、エンタープライズ用 SSD である Intel SSD D3-S4510 Series を入手した。

入手した Intel SSD D3-S4510 Series

そして、現行運用の SSD は 512GB で 本製品は 480GB なのでボリュームを縮小する必要がある。。「そんなことできるんかいな」と思いながら試行錯誤している記録です。

現状確認

前提を書いておきます。
Proxmox VE 8.3 を EFI モードでインストール時に ZFS MIROR を設定しました。で、 Disk の全量を root へ割当もしているため root disk は 475.9G であるw コレを縮小して 480GB の Disk にリプレイスする必要がある。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
> lsblk -o NAME,HCTL,MODEL,SERIAL
NAME     HCTL       MODEL                SERIAL
sdd      6:0:0:0    TEAM T253512GB       TPBF2410XXXXXXXXXXXX
sdf      14:0:0:0   TEAM T253512GB       TPBF2409XXXXXXXXXXXX

> fdisk -l /dev/sdd
Disk /dev/sdd: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: TEAM T253512GB  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 4CE7B4BC-BE99-4078-A9C2-D80CC44B14B7

Device       Start        End   Sectors   Size Type
/dev/sdd1       34       2047      2014  1007K BIOS boot
/dev/sdd2     2048    2099199   2097152     1G EFI System
/dev/sdd3  2099200 1000215182 998115983 475.9G Solaris /usr & Apple ZFS

> fdisk -l /dev/sdf
Disk /dev/sdf: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: TEAM T253512GB  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 20CB518E-7073-41F7-BA18-F7BEBD4B8A56

Device       Start        End   Sectors   Size Type
/dev/sdf1       34       2047      2014  1007K BIOS boot
/dev/sdf2     2048    2099199   2097152     1G EFI System
/dev/sdf3  2099200 1000215182 998115983 475.9G Solaris /usr & Apple ZFS

> zpool status
  pool: rpool
 state: ONLINE
  scan: resilvered 8.74M in 00:00:00 with 0 errors on Wed Jan 15 12:29:05 2025
config:

        NAME                                               STATE     READ WRITE CKSUM
        rpool                                              ONLINE       0     0     0
          mirror-0                                         ONLINE       0     0     0
            ata-TEAM_T253512GB_TPBF2409XXXXXXXXXXXX-part3  ONLINE       0     0     0
            ata-TEAM_T253512GB_TPBF2410XXXXXXXXXXXX-part3  ONLINE       0     0     0

errors: No known data errors

新しい Disk の準備

今回は sdh, sdi になった

1
2
3
4
5
6
> lsblk -o NAME,HCTL,MODEL,SERIAL
NAME     HCTL       MODEL                SERIAL
sdd      6:0:0:0    TEAM T253512GB       TPBF2410XXXXXXXXXXXX
sdf      14:0:0:0   TEAM T253512GB       TPBF2409XXXXXXXXXXXX
sdh      8:0:0:0    INTEL SSDSC2KB480G8  BTYF834109XXXXXXXX
sdi      16:0:0:0   INTEL SSDSC2KB480G8  BTYF83410DXXXXXXXX

パーティションを作る必要があるので一旦、現用系の sdd の設定を確認する
そうすると下記のような構造になっている

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
> fdisk -l /dev/sdd
Disk /dev/sdd: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: TEAM T253512GB  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 4CE7B4BC-BE99-4078-A9C2-D80CC44B14B7

Device       Start        End   Sectors   Size Type
/dev/sdd1       34       2047      2014  1007K BIOS boot
/dev/sdd2     2048    2099199   2097152     1G EFI System
/dev/sdd3  2099200 1000215182 998115983 475.9G Solaris /usr & Apple ZFS
NoTypeSize
1BIOS boot1007K
2EFI System1G
3Solaris /usr & Apple ZFS残り全部

上記のパーテーションを sdh, sdi に設定してパーテーションを作成する

1: BIOS boot
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
> fdisk /dev/sdh

Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS (MBR) disklabel with disk identifier 0x0860348c.

Command (m for help): g

Created a new GPT disklabel (GUID: 5227879A-B14D-B743-91C0-DB7170E5B463).

Command (m for help): n
Partition number (1-128, default 1): 
First sector (2048-937703054, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-937703054, default 937701375): +1M

Created a new partition 1 of type 'Linux filesystem' and of size 1 MiB.

Command (m for help): t
Selected partition 1
Partition type or alias (type L to list all): BIOS boot
Changed type of partition 'Linux filesystem' to 'BIOS boot'.
2: EFI System
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
Command (m for help): n
Partition number (2-128, default 2): 
First sector (4096-937703054, default 4096): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (4096-937703054, default 937701375): +1G

Created a new partition 2 of type 'Linux filesystem' and of size 1 GiB.

Command (m for help): t
Partition number (1,2, default 2): 2
Partition type or alias (type L to list all): EFI System

Changed type of partition 'Linux filesystem' to 'EFI System'.
3: Solaris /usr & Apple ZFS
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
Command (m for help): n
Partition number (3-128, default 3): 
First sector (2101248-937703054, default 2101248): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2101248-937703054, default 937701375): 

Created a new partition 3 of type 'Linux filesystem' and of size 446.1 GiB.

Command (m for help): t
Partition number (1-3, default 3): 3
Partition type or alias (type L to list all): Solaris /usr & Apple ZFS

Changed type of partition 'Linux filesystem' to 'Solaris /usr & Apple ZFS'.

最後にパーテーション情報を書き込む

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
Command (m for help): p
Disk /dev/sdh: 447.13 GiB, 480103981056 bytes, 937703088 sectors
Disk model: INTEL SSDSC2KB48
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5227879A-B14D-B743-91C0-DB7170E5B463

Device       Start       End   Sectors   Size Type
/dev/sdh1     2048      4095      2048     1M BIOS boot
/dev/sdh2     4096   2101247   2097152     1G EFI System
/dev/sdh3  2101248 937701375 935600128 446.1G Solaris /usr & Apple ZFS

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Note
同様に 新しい Disk の 2本目も実施しておく

入れ替え 1本目

1
2
3
4
5
6
> zpool list rpool -v -P
NAME                                                                SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
rpool                                                               472G   131G   341G        -         -     9%    27%  1.00x    ONLINE  -
  mirror-0                                                          472G   131G   341G        -         -     9%  27.8%      -    ONLINE
    /dev/disk/by-id/ata-TEAM_T253512GB_TPBF2409XXXXXXXXXXXX-part3   476G      -      -        -         -      -      -      -    ONLINE
    /dev/disk/by-id/ata-TEAM_T253512GB_TPBF2410XXXXXXXXXXXX-part3   476G      -      -        -         -      -      -      -    ONLINE

miror-0 の 1本を Offline にし、detach する

1
2
3
4
5
6
7
> zpool offline rpool /dev/disk/by-id/ata-TEAM_T253512GB_TPBF2410XXXXXXXXXXXX-part3
> zpool detach rpool /dev/disk/by-id/ata-TEAM_T253512GB_TPBF2410XXXXXXXXXXXX-part3

> zpool list rpool -v -P
NAME                                                              SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
rpool                                                             472G   131G   341G        -         -     9%    27%  1.00x    ONLINE  -
  /dev/disk/by-id/ata-TEAM_T253512GB_TPBF2409XXXXXXXXXXXX-part3   476G   131G   341G        -         -     9%  27.8%      -    ONLINE

1本目 の Intel SSD (ata-INTEL_SSDSC2KB480G8_BTYF834109XXXXXXXX-part3) を追加する
この時 zpool attach rpool <既存 Disk> <追加 Disk> の順番で追加する

Important
ここで zpool add rpool ... をしてしまった場合、 miror が崩れるので必ず、 zpool attach rpool ... を利用する
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
> ls -lah /dev/disk/by-id/
total 0
drwxr-xr-x 2 root root 900 Jan 18 17:31 .
drwxr-xr-x 9 root root 180 Jan 12 11:34 ..
lrwxrwxrwx 1 root root  10 Jan 18 17:06 ata-INTEL_SSDSC2KB480G8_BTYF834109XXXXXXXX-part3 -> ../../sdh3
lrwxrwxrwx 1 root root  10 Jan 18 17:31 ata-INTEL_SSDSC2KB480G8_BTYF83410DXXXXXXXX-part3 -> ../../sdi3
lrwxrwxrwx 1 root root  10 Jan 18 18:24 ata-TEAM_T253512GB_TPBF2409XXXXXXXXXXXX-part3 -> ../../sdf3

> zpool attach rpool /dev/disk/by-id/ata-TEAM_T253512GB_TPBF2409XXXXXXXXXXXX-part3 \
                     /dev/disk/by-id/ata-INTEL_SSDSC2KB480G8_BTYF834109XXXXXXXX-part3

応答完了後に、 zpool status rpool -v を確認すると複製が動作しているのがわかる

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
> zpool status rpool -v
  pool: rpool
 state: ONLINE
  scan: resilvered 9.96M in 00:00:00 with 0 errors on Sat Jan 18 17:22:31 2025
remove: Evacuation of /dev/disk/by-id/ata-TEAM_T253512GB_TPBF2409XXXXXXXXXXXX-part3 in progress since Sat Jan 18 17:45:27 2025
        51.4G copied out of 131G at 435M/s, 39.11% done, 0h3m to go
config:

        NAME                                                  STATE     READ WRITE CKSUM
        rpool                                                 ONLINE       0     0     0
          mirror-1                                            ONLINE       0     0     0
            ata-TEAM_T253512GB_TPBF2409XXXXXXXXXXXX-part3     ONLINE       0     0     0  (removing)
            ata-INTEL_SSDSC2KB480G8_BTYF834109XXXXXXXX-part3  ONLINE       0     0     0

errors: No known data errors

完了すると下記のように Disk が加入して、 TEAM と INTEL で Miror の状態になった

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
> zpool status rpool -v
  pool: rpool
 state: ONLINE
  scan: resilvered 132G in 00:06:04 with 0 errors on Sat Jan 18 20:23:31 2025
remove: Removal of vdev 2 copied 5.12M in 0h0m, completed on Sat Jan 18 19:15:43 2025
        1.45M memory used for removed device mappings
config:

        NAME                                                  STATE     READ WRITE CKSUM
        rpool                                                 ONLINE       0     0     0
          mirror-1                                            ONLINE       0     0     0
            ata-TEAM_T253512GB_TPBF2410XXXXXXXXXXXX-part3     ONLINE       0     0     0
            ata-INTEL_SSDSC2KB480G8_BTYF834109XXXXXXXX-part3  ONLINE       0     0     0

errors: No known data errors

次に bootloader を書き込みする

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
> lsblk -o NAME,HCTL,MODEL,SERIAL
NAME     HCTL       MODEL                SERIAL
sdd      6:0:0:0    TEAM T253512GB       TPBF2410XXXXXXXXXXXX
sdf      14:0:0:0   TEAM T253512GB       TPBF2409XXXXXXXXXXXX
sdh      8:0:0:0    INTEL SSDSC2KB480G8  BTYF834109XXXXXXXX
sdi      16:0:0:0   INTEL SSDSC2KB480G8  BTYF83410DXXXXXXXX

> proxmox-boot-tool format /dev/sdh2 --force
UUID="" SIZE="1073741824" FSTYPE="" PARTTYPE="c12a7328-f81f-11d2-ba4b-00a0c93ec93b" PKNAME="sdh" MOUNTPOINT=""
Formatting '/dev/sdh2' as vfat..
mkfs.fat 4.2 (2021-01-31)
Done.

> proxmox-boot-tool init /dev/sdh2 --force
Re-executing '/usr/sbin/proxmox-boot-tool' in new private mount namespace..
UUID="0BB9-F406" SIZE="1073741824" FSTYPE="vfat" PARTTYPE="c12a7328-f81f-11d2-ba4b-00a0c93ec93b" PKNAME="sdh" MOUNTPOINT=""
Mounting '/dev/sdh2' on '/var/tmp/espmounts/0BB9-F406'.
Installing systemd-boot..
Created "/var/tmp/espmounts/0BB9-F406/EFI/systemd".
Created "/var/tmp/espmounts/0BB9-F406/EFI/BOOT".
Created "/var/tmp/espmounts/0BB9-F406/loader".
Created "/var/tmp/espmounts/0BB9-F406/loader/entries".
Created "/var/tmp/espmounts/0BB9-F406/EFI/Linux".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/var/tmp/espmounts/0BB9-F406/EFI/systemd/systemd-bootx64.efi".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/var/tmp/espmounts/0BB9-F406/EFI/BOOT/BOOTX64.EFI".
Random seed file /var/tmp/espmounts/0BB9-F406/loader/random-seed successfully written (32 bytes).
Created EFI boot entry "Linux Boot Manager".
Configuring systemd-boot..
Unmounting '/dev/sdh2'.
Adding '/dev/sdh2' to list of synced ESPs..
Refreshing kernels and initrds..
Running hook script 'proxmox-auto-removal'..
Running hook script 'zz-proxmox-boot'..
Copying and configuring kernels on /dev/disk/by-uuid/0BB9-F406
        Copying kernel and creating boot-entry for 6.8.12-4-pve
        Copying kernel and creating boot-entry for 6.8.12-5-pve
Copying and configuring kernels on /dev/disk/by-uuid/89FD-A1F3
        Copying kernel and creating boot-entry for 6.8.12-4-pve
        Copying kernel and creating boot-entry for 6.8.12-5-pve
Copying and configuring kernels on /dev/disk/by-uuid/EE7E-A82E
        Copying kernel and creating boot-entry for 6.8.12-4-pve
        Copying kernel and creating boot-entry for 6.8.12-5-pve

入れ替え 2本目

1
2
3
4
5
6
> lsblk -o NAME,HCTL,MODEL,SERIAL
NAME     HCTL       MODEL                SERIAL
sdd      6:0:0:0    TEAM T253512GB       TPBF2410XXXXXXXXXXXX
sdf      14:0:0:0   TEAM T253512GB       TPBF2409XXXXXXXXXXXX
sdh      8:0:0:0    INTEL SSDSC2KB480G8  BTYF834109XXXXXXXX
sdi      16:0:0:0   INTEL SSDSC2KB480G8  BTYF83410DXXXXXXXX

2本目は sdi を対象に実施する
1本目が完了していれば、 zpool replace をすれば変更される。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
> zpool status rpool -v
  pool: rpool
 state: ONLINE
  scan: resilvered 132G in 00:06:04 with 0 errors on Sat Jan 18 20:23:31 2025
remove: Removal of vdev 2 copied 5.12M in 0h0m, completed on Sat Jan 18 19:15:43 2025
        1.45M memory used for removed device mappings
config:

        NAME                                                  STATE     READ WRITE CKSUM
        rpool                                                 ONLINE       0     0     0
          mirror-1                                            ONLINE       0     0     0
            ata-TEAM_T253512GB_TPBF2410XXXXXXXXXXXX-part3     ONLINE       0     0     0
            ata-INTEL_SSDSC2KB480G8_BTYF834109XXXXXXXX-part3  ONLINE       0     0     0

errors: No known data errors

> ls -ahl /dev/disk/by-id
drwxr-xr-x 2 root root 900 Jan 18 20:29 .
drwxr-xr-x 9 root root 180 Jan 12 11:34 ..
lrwxrwxrwx 1 root root  10 Jan 18 20:17 ata-INTEL_SSDSC2KB480G8_BTYF834109XXXXXXXX-part3 -> ../../sdh3
lrwxrwxrwx 1 root root  10 Jan 18 18:23 ata-INTEL_SSDSC2KB480G8_BTYF83410DXXXXXXXX-part3 -> ../../sdi3
lrwxrwxrwx 1 root root  10 Jan 18 19:16 ata-TEAM_T253512GB_TPBF2409XXXXXXXXXXXX-part3 -> ../../sdf3
lrwxrwxrwx 1 root root  10 Jan 18 18:32 ata-TEAM_T253512GB_TPBF2410XXXXXXXXXXXX-part3 -> ../../sdd3

上記の確認で下記の設定で実施する

  • 元: ata-TEAM_T253512GB_TPBF2410XXXXXXXXXXXX-part3
  • 先: ata-INTEL_SSDSC2KB480G8_BTYF83410DXXXXXXXX-part3
1
2
> zpool replace -f rpool ata-TEAM_T253512GB_TPBF2409XXXXXXXXXXXX-part3 \
                         ata-TEAM_T253512GB_TPBF2409YYYYYYYYYYYY-part3

1本目同様に bootloader を書き終われば完了だ

1
2
> proxmox-boot-tool format /dev/sdi2 --force
> proxmox-boot-tool init /dev/sdi2 --force

最後に、 /etc/kernel/proxmox-boot-uuids を整理する。
今回は TEAM の SSD の EE7E-A82E, 89FD-A1F3 は抜去するので削除しておく

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
> lsblk -o NAME,HCTL,MODEL,SERIAL,UUID
NAME     HCTL       MODEL                SERIAL               UUID
sdd      6:0:0:0    TEAM T253512GB       TPBF2410XXXXXXXXXXXX
├─sdd1
├─sdd2                                                        EE7E-A82E
sdf      14:0:0:0   TEAM T253512GB       TPBF2409XXXXXXXXXXXX
├─sdf1
├─sdf2                                                        89FD-A1F3
sdh      8:0:0:0    INTEL SSDSC2KB480G8  BTYF834109XXXXXXXX
├─sdh1
├─sdh2                                                        093E-FDDE
sdi      16:0:0:0   INTEL SSDSC2KB480G8  BTYF83410DXXXXXXXX
├─sdi1
├─sdi2                                                        5043-6338
1
nano /etc/kernel/proxmox-boot-uuids

完了したら、念の為 proxmox-boot-tool をすると、 Copying and configuring kernels が 2回出るのが正しい。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
proxmox-boot-tool init /dev/sdi2 --force
Re-executing '/usr/sbin/proxmox-boot-tool' in new private mount namespace..
UUID="5043-6338" SIZE="1073741824" FSTYPE="vfat" PARTTYPE="c12a7328-f81f-11d2-ba4b-00a0c93ec93b" PKNAME="sdi" MOUNTPOINT=""
Mounting '/dev/sdi2' on '/var/tmp/espmounts/5043-6338'.
Installing systemd-boot..
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/var/tmp/espmounts/5043-6338/EFI/systemd/systemd-bootx64.efi".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/var/tmp/espmounts/5043-6338/EFI/BOOT/BOOTX64.EFI".
Random seed file /var/tmp/espmounts/5043-6338/loader/random-seed successfully written (32 bytes).
Created EFI boot entry "Linux Boot Manager".
Configuring systemd-boot..
Unmounting '/dev/sdi2'.
Adding '/dev/sdi2' to list of synced ESPs..
Refreshing kernels and initrds..
Running hook script 'proxmox-auto-removal'..
Running hook script 'zz-proxmox-boot'..
Copying and configuring kernels on /dev/disk/by-uuid/093E-FDDE
        Copying kernel and creating boot-entry for 6.8.12-4-pve
        Copying kernel and creating boot-entry for 6.8.12-5-pve
Copying and configuring kernels on /dev/disk/by-uuid/5043-6338
        Copying kernel and creating boot-entry for 6.8.12-4-pve
        Copying kernel and creating boot-entry for 6.8.12-5-pve

障害試験

障害試験は実施しておくべきです。

具体的には私の環境では OS 起動中に下記を実施、これをすることで Disk 障害からの復旧と Boot することが確認できる。

  • 1番差し、2番抜去

  • reboot (Boot 確認)

  • 2番戻し

  • 同期を確認

  • 1番抜去、2番差し

  • reboot (Boot 確認)

  • 1番戻し

  • 同期を確認

廃棄する場合の消去

Secure Erase を利用する方法を利用します。

Secure Erase 非対応の場合

物理破壊が確実だが、今回はメーカーに送り返す事になったので消去が必要になった。
そのため NIST 800-88 Advanced で消去するこの方法は、ディスク全体の領域を乱数で上書きした後、ゼロ(0x00)で上書きし、書込検証を行う。

  • -n 1: ランダム書き込みの回数
  • -z: 最後にゼロ(0x00)を書き込む
  • -v: 進捗状況を表示する
1
2
3
4
5
6
> lsblk -o NAME,HCTL,MODEL,SERIAL
NAME     HCTL       MODEL                SERIAL
sdd      6:0:0:0    TEAM T253512GB       TPBF2410XXXXXXXXXXXX
sdf      14:0:0:0   TEAM T253512GB       TPBF2409XXXXXXXXXXXX

> shred -v -n 1 -z /dev/sXX

参考情報

Hugo で構築されています。
テーマ StackJimmy によって設計されています。