Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing UNAVAIL devices #544

Closed
rlaager opened this issue Jan 28, 2012 · 4 comments
Closed

Replacing UNAVAIL devices #544

rlaager opened this issue Jan 28, 2012 · 4 comments
Milestone

Comments

@rlaager
Copy link
Member

rlaager commented Jan 28, 2012

As discussed here:
http://groups.google.com/a/zfsonlinux.org/group/zfs-discuss/browse_thread/thread/c515f1d9e244b31a

It should be possible to replace a missing device without hacks such as creating fake device files.

@behlendorf
Copy link
Contributor

Agreed. This sounds like probably a pretty easy thing to fix once someone digs in to it.

@ghost
Copy link

ghost commented Mar 28, 2012

Instead of creating symlinks to /dev/null or such, one can simply use the guid of the missing drive from the output of 'zdb'.

@FransUrbo
Copy link
Contributor

In rc9, I did not have to fiddle with links or empty files to replace a UNAVAIL device. I did, however, have to specify the full path (/dev/disk/by-id/XXXX) to both the old (not longer availible disk) and the new. So it partly works as expected.

behlendorf added a commit to behlendorf/zfs that referenced this issue Oct 18, 2012
The 'zpool replace' command would fail when given a short name
because unlike on other platforms the short name cannot be
deterministically expanded to a single path.  Multiple path
prefixes must be checked and in addition the partition suffix
for whole disks is determined by the prefix.

To handle this complexity a zfs_strcmp_pathname() function was
added which takes either a short or fully qualified device name.
Short names will be expanded using the prefixes in the default
import search path, or the ZPOOL_IMPORT_PATH environment variable
if it's defined.  All posible expansions are then compared against
the comparison path.  Care is taken to strip redundant slashes to
ensure legitimate matches are not missed.

In the context of this work the existing zfs_resolve_shortname()
function was extended to consider the ZPOOL_IMPORT_PATH when set.
The zfs_append_partition() interface was also simplified to take
only a single buffer.

The vast majority of these changes rework existing Linux specific
code which was originally written to accomidate udev.  However,
there is some minimal cleanup which removes Illumos specific code.
This was done to improve readability but the basic flow and intent
of the upstream code was maintained.

These changes are the logical conclusion of the previos work to
adjust the 'zpool import' search behavior, see commit 44867b6a.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue openzfs#544
Issue openzfs#976
@behlendorf
Copy link
Contributor

For those people interested in this issue could you please test #1056. I'd appreciate the feedback, it resolves the issue in my testing but I'd like for the patch to get a little more real world abuse.

unya pushed a commit to unya/zfs that referenced this issue Dec 13, 2013
The 'zpool replace' command would fail when given a short name
because unlike on other platforms the short name cannot be
deterministically expanded to a single path.  Multiple path
prefixes must be checked and in addition the partition suffix
for whole disks is determined by the prefix.

To handle this complexity a zfs_strcmp_pathname() function was
added which takes either a short or fully qualified device name.
Short names will be expanded using the prefixes in the default
import search path, or the ZPOOL_IMPORT_PATH environment variable
if it's defined.  All posible expansions are then compared against
the comparison path.  Care is taken to strip redundant slashes to
ensure legitimate matches are not missed.

In the context of this work the existing zfs_resolve_shortname()
function was extended to consider the ZPOOL_IMPORT_PATH when set.
The zfs_append_partition() interface was also simplified to take
only a single buffer.

The vast majority of these changes rework existing Linux specific
code which was originally written to accomidate udev.  However,
there is some minimal cleanup which removes Illumos specific code.
This was done to improve readability but the basic flow and intent
of the upstream code was maintained.

These changes are the logical conclusion of the previos work to
adjust the 'zpool import' search behavior, see commit 44867b6a.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#544
Closes openzfs#976
pcd1193182 pushed a commit to pcd1193182/zfs that referenced this issue Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants