Replacing disk in single disk stripe

FJep

Dabbler
Joined
Mar 7, 2019
Messages
38
Hi,

I am planning to replace a disk in a single disk stripe
Code:
# zpool status
  pool: VolA1
 state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
        still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
        the pool may no longer be accessible by software that does not support
        the features. See zpool-features(7) for details.
  scan: scrub repaired 0 in 0 days 03:01:50 with 0 errors on Sun Jun 21 03:01:58 2020
config:

        NAME                                          STATE     READ WRITE CKSUM
        VolA1                                         ONLINE       0     0     0
          gptid/9ad8b20d-c0ea-11e7-b63e-7085c2464c1b  ONLINE       0     0     0

errors: No known data errors

There are two folders on that Vol (music, pictures, log), a rsync job copying these folders and a smb share.

I know I could remove the Vol and switch disks and create everything from scratch, but is there an easier way?

Greetings
Frank
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
You can create a mirror pair, then remove the old disk after the vdev resilvered. See zpool attach, zpool detach.

If you need more details, just ask ;)
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Alternatively, attach a spare disk to the pool.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
@Samuel Tai That's what I meant. Attach a new/spare disk to the same vdev to build a mirror, then remove the old one. if you add another disk to the pool you end up with two single disk vdevs and cannot remove either one.
 

FJep

Dabbler
Joined
Mar 7, 2019
Messages
38
Thanks for your help.
But since I got no spare SATA connectors I copied all data away and export/disconnected the pool, swapped disks and added the new disk as new pool of same name.
With the other disk I did the same. There were only the SMBs and two rsyncs to reconfigure, which was easier then expected.
 

zierbeek

Explorer
Joined
Apr 4, 2021
Messages
54
@Samuel Tai That's what I meant. Attach a new/spare disk to the same vdev to build a mirror, then remove the old one. if you add another disk to the pool you end up with two single disk vdevs and cannot remove either one.

Hi patrick, now I will try to get an answer from you with this! ;)

i had an old 1tb harddrive from a friend's ps4 which I used for some media.This one is failing, as expected and I am replacing it with a 2tb new one. Can I just replace them or how does this need to go?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Code:
gpart backup <olddrive> | gpart restore <newdrive>
gpart list <newdrive>
# look for "rawuuid" of the ZFS partition on new drive
zpool status
# look for gptid of old drive
zpool attach <yourpool> gptid/<id-of-old-drive> gptid/<id-of-new-drive>
 

zierbeek

Explorer
Joined
Apr 4, 2021
Messages
54
Code:
gpart backup <olddrive> | gpart restore <newdrive>
gpart list <newdrive>
# look for "rawuuid" of the ZFS partition on new drive
zpool status
# look for gptid of old drive
zpool attach <yourpool> gptid/<id-of-old-drive> gptid/<id-of-new-drive>

the new drive isn't showing up in cli but in truenas it is. should I gpart create ..
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
What do you mean?
Code:
camcontrol devlist
dmesg

don't show your new device?

You should not use gpart create but copy the partition table of your existing disk with gpart backup <old disk>| gpart restore <new disk>. For this operation you need the device nodes (adaX), not the GPT IDs.
 
Top