Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Jan 2012 21:18:06 -0800
From:      Freddie Cash <fjwcash@gmail.com>
To:        Michael DeMan <freebsd@deman.com>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: zfs detach/replace
Message-ID:  <CAOjFWZ4HDx5eQ7haanQvMmCPo=QkjKNRwo--FOhGPd8ed=kq-w@mail.gmail.com>
In-Reply-To: <D9234680-D147-42B9-9DAC-42D0802A418D@deman.com>
References:  <8EA721E0-977D-483C-AC06-1040B87E0AA7@deman.com> <CAHcKe7kXGFcuMJTL3UxMgfeBZ1vsVJOq8sBc0H76BLP_fUmQkQ@mail.gmail.com> <C7D4513B-ABF5-4854-8B6C-7AA47E1B72CF@deman.com> <20120101195411.GA73487@icarus.home.lan> <D9234680-D147-42B9-9DAC-42D0802A418D@deman.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jan 1, 2012 at 9:09 PM, Michael DeMan <freebsd@deman.com> wrote:
> Sounds realistic to me that the 'replace' command works after a 'detach' =
is properly done.
>
> In my case, I forgot to do the 'detach' - just did the 'replace' after ch=
anging the drive (and after a reboot). =C2=A0From there, ZFS gets in the st=
ate below - where it automagically created label/ada5LABEL/old and appears =
to be wanting to do the rebuild onto label/ada5LABEL as if it is part of a =
mirrored pair?

"zpool detach" and "zpool replace" are two very different, and totally
unconnected, things.

"zpool detach" is used to remove drives from mirror vdevs.  The vdev
then has one less drive in it.  The beauty of the way mirror vdevs
work in ZFS is that you can "zpool attach" a drive to an existing
2-way mirror vdev, thus turning it into a 3-way mirror.  Then "zpool
detach" the extra drive.  Makes upgrading drive capacity a cinch, as
you never lose any redundancy in the vdev.

"zpool replace" is used to do an in-place replacement of a drive in a
vdev, and can be used with mirror, raidz1, raidz2, and raidz3 vdevs.

I think the part you may be getting confused with is the "zpool
offline" step that should be done before doing a "zpool replace".
That way, if anything goes wrong, you can always put back the old
drive, do a "zpool online" to it, and then do a "zpool remove" or
"zpool detach" to the "new" drive.  That's saved my bacon a couple of
times.  :)  Learnt the hard way about that, losing a 20 TB pool (only
a couple TB of data in it) due to "insufficient replicas" and "missing
drives" and whatnot.

> I know for a fact, back with FreeBSD 7.x, that this same scenario could o=
ccur. =C2=A0Basically on below - my old notes show there is no way to fix t=
he situation with ada5LABEL and ada5LABEL/old without destroying and rebuil=
ding the pool. =C2=A0Any attempts to 'detach', 'offline' or anything else o=
n either of those two logical entries fails with a 'no valid replicas'.

If you have the original drive (the /old one), put it back in the
system, "zpool online" it, then you should be able to "zpool remove"
or "zpool detach" the other drive.

--=20
Freddie Cash
fjwcash@gmail.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOjFWZ4HDx5eQ7haanQvMmCPo=QkjKNRwo--FOhGPd8ed=kq-w>