zpool replace Issues

Double Jz

Active Member
Feb 14, 2019
4
0
41
42
I kept getting a /dev/sdf is in use and contains a unknown filesystem message and I could not figure out why.

Currently
Code:
  pool: rpool
state: DEGRADED
status: One or more devices could not be used because the label is missing or
        invalid.  Sufficient replicas exist for the pool to continue
        functioning in a degraded state.
action: Replace the device using 'zpool replace'.
   see: http://zfsonlinux.org/msg/ZFS-8000-4J
  scan: scrub repaired 0B in 0 days 00:06:27 with 0 errors on Sun Feb  9 00:30:36 2020
config:

        NAME                                 STATE     READ WRITE CKSUM
        rpool                                DEGRADED     0     0     0
          mirror-0                           DEGRADED     0     0     0
            ata-ST31000340AS_5QJ0JPBW-part3  ONLINE       0     0     0
            828804861444538550               UNAVAIL      0     0     0  was /dev/disk/by-id/ata-ST31000333AS_5TE02E7P-part3

I've tried the following so far...
Code:
root@proxmox:~# zfs-format-disk /dev/sdf
Creating new GPT entries.
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Creating new GPT entries.
Setting name!
partNum is 1
The operation has completed successfully.
Installing for i386-pc platform.
Installation finished. No error reported.
root@proxmox:~#

root@proxmox:~# zpool replace rpool /dev/sdf
/dev/sdf is in use and contains a unknown filesystem.
root@proxmox:~#

root@proxmox:~# dd if=/dev/zero of=/dev/sdf bs=4096 count=35 seek=$(($(blockdev --getsz /dev/sdf)*512/4096 - 35))
35+0 records in
35+0 records out
143360 bytes (143 kB, 140 KiB) copied, 0.0011143 s, 129 MB/s
root@proxmox:~#

root@proxmox:~# zpool replace rpool /dev/sdf
/dev/sdf is in use and contains a unknown filesystem.
root@proxmox:~#

I even went to the point of copying the other working member /dev/sda to the new drive /dev/sdf... Same thing.
Code:
root@proxmox:~# sgdisk /dev/sda -R /dev/sdf
The operation has completed successfully.
root@proxmox:~# sgdisk -G /dev/sdf
The operation has completed successfully.
root@proxmox:~# gdisk /dev/sdf
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sdf: 1953525168 sectors, 931.5 GiB
Model: WDC WD1003FBYX-0
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): F866116A-E029-45BD-8346-33A11BCDCA82
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 8-sector boundaries
Total free space is 0 sectors (0 bytes)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              34            2047   1007.0 KiB  EF02
   2            2048         1050623   512.0 MiB   EF00
   3         1050624      1953525134   931.0 GiB   BF01

Command (? for help): q
root@proxmox:~#

But still got the same message in the end.
Code:
root@proxmox:~# dd if=/dev/sda1 of=/dev/sdf1
2014+0 records in
2014+0 records out
1031168 bytes (1.0 MB, 1007 KiB) copied, 0.15201 s, 6.8 MB/s
root@proxmox:~# dd if=/dev/sda3 of=/dev/sdf3
1952474511+0 records in
1952474511+0 records out
999666949632 bytes (1.0 TB, 931 GiB) copied, 11977.7 s, 83.5 MB/s
root@proxmox:~# zpool replace rpool 828804861444538550 /dev/sdf
/dev/sdf is in use and contains a unknown filesystem.
root@proxmox:~#

However, when I rebooted the server I now get the following when trying to replace it.
Code:
root@proxmox:~# zpool replace rpool /dev/sdf
invalid vdev specification
use '-f' to override the following errors:
/dev/sdf3 is part of active pool 'rpool'
root@proxmox:~# zpool replace rpool /dev/sdf -f
invalid vdev specification
the following errors must be manually repaired:
/dev/sdf3 is part of active pool 'rpool'
root@proxmox:~#

Any suggestions? As I'm about to smash this new drive I'm trying to put in....
 
Last edited:
Actually, I believe I just got this to work with using device-id rather than /dev/sdx

Code:
root@proxmox:~# zpool replace rpool /dev/disk/by-id/ata-ST31000333AS_5TE02E7P-part3 /dev/disk/by-id/ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW34501541
Make sure to wait until resilver is done before rebooting.
root@proxmox:~# zpool status rpool
  pool: rpool
state: DEGRADED
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Tue Feb 18 22:16:18 2020
        21.0G scanned at 224M/s, 4.73G issued at 50.5M/s, 21.0G total
        4.79G resilvered, 22.52% done, 0 days 00:05:30 to go
config:

        NAME                                             STATE     READ WRITE CKSUM
        rpool                                            DEGRADED     0     0     0
          mirror-0                                       DEGRADED     0     0     0
            ata-ST31000340AS_5QJ0JPBW-part3              ONLINE       0     0     0
            replacing-1                                  DEGRADED     0     0     0
              828804861444538550                         UNAVAIL      0     0     0  was /dev/disk/by-id/ata-ST31000333AS_5TE02E7P-part3
              ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW34501541  ONLINE       0     0     0  (resilvering)

errors: No known data errors
root@proxmox:~#
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!