Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ZFS replace drive in deleted pool

Featured Replies

Hi, everyone! 

 

I had pool zfs_mirror from two 18TB drives. Let`s call them driveA and driveB.

I deleted pool and took one of this drive (driveB), formatted in XFS and used it for few days, writing a lot of data on this driveB

And now I would like to add this driveB back to the deleted pool.

 

I can see that data on driveA is still present and I can see the pool status:

zpool status
  pool: zfs_mirror
 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: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-4J
  scan: scrub repaired 0B in 08:53:51 with 0 errors on Tue Jan 14 00:28:23 2025
config:

	NAME                      STATE     READ WRITE CKSUM
	disk_zfs                  DEGRADED     0     0     0
	  mirror-0                DEGRADED     0     0     0
	    sde1                  ONLINE       0     0     0
	    15814078930758616689  UNAVAIL      0     0     0  was /dev/md1p1

errors: No known data errors

 

Of course driveB is not /dev/md1p1, technically it is /dev/sdx for example.

 

According to ZFS I need to run next command:

zpool replace zfs_mirror /dev/md1p1 /dev/sdx

 

But question - unraid, how to do this properly?

 

I need to mount both drives when array stopped, then run this replace command and somehow add this as zfs_mirror pool in config? And then wait until data will be rebuild on driveB, should I start array or I should wait? 

 

Solved by JorgeB

  • Community Expert

You can import the pool degraded, then add the other drive so that it gets resilvered.

  • Author
1 minute ago, JorgeB said:

You can import the pool degraded, then add the other drive so that it gets resilvered.

Thank you!

So, instruction like you mentioned here? Stop array, add pool via GUI like from the scratch, don`t touch format, start array and wait?

 

  • Community Expert

Basically, create a new pool with a single slot, assign that device, start the array, it should import the pool degraded, showing a red x for the missing device, you can then assign a device there.

  • Community Expert
18 minutes ago, JorgeB said:

Basically, create a new pool with a single slot, assign that device, start the array, it should import the pool degraded, showing a red x for the missing device, you can then assign a device there.

 

I had a major issue with something like this.

 

I had a zfs mirror of two 2-disk vdevs like this:

 

	pool
	  mirror-0
	    sda1
	    sdb1
	  mirror-1
	    sdc1
	    sdd1

 

What I wanted to do was remove disks "/sdb1" and "/sdd1" from their respective vdevs and swap them to the opposite vdev to look like this:

	pool
	  mirror-0
	    sda1
	    sdd1
	  mirror-1
	    sdc1
	    sdb1

 

I first offlined the two disks, which set the pool to degraded state using "zpool offline pool sdb1" followed by "zpool detach pool sdb1" and repeated for disk "/sdd1"

 

I then stopped and restarted the array to which unraid saw the last two remaining disks "/sda1" and "/sdc1" as a zfs stripe. It would not let me add the now detatched disks back into the mirror of two 2-disk vdevs.

 

It appeared as:

	pool
	  stripe
	    sda1
	    sdc1

 

Ill admit, im new with zfs filesystems and very well could have just been total user error but I need to know if what I did was possible or just me being reckless with zfs commands?

 

I was able to reformat the pool entirely and configure as I needed thankfully I had a backup of my data.

  • Author
56 minutes ago, JorgeB said:

assign that device

You mean this ZFS drive that shows degraded? Should I check zfs in pool settings or leave all settings as auto? Because auto I have xfs in settings.

  • Community Expert
  • Solution
1 hour ago, d3m3zs said:

You mean this ZFS drive that shows degraded?

The current working device:

image.png

1 hour ago, d3m3zs said:

Should I check zfs in pool settings or leave all settings as auto?

Leave in auto.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.