-
Notifications
You must be signed in to change notification settings - Fork 22
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
get_Partition_Count may not be all that useful on Solaris and Derivatives using ZFS #10
Comments
I knew someone would ask about ZFS eventually 😄 The issue that was being solved when this code was added was related to erasing a drive that was still mounted. I do not know if this same kind of error will show up with ZFS partitions or not. I tested a few other partition types but only really saw the original error on ext4. I do not recall if I tested zfs at this point. I think it would be valuable to check for ZFS, at least for detection on whether a drive has a file system and whether it is the boot device. These are currently only used by SeaTools and some limited checks around erase operations in SeaChest, so it should not prevent the tools from running, but there could be a similar error erasing a zfs disk. |
I guess one of the assumptions being made is that the drive being operated on is not in use. :) I am not sure that there will be any issues like you described, though I suppose we cannot be absolutely sure. Thanks for all the context, this helps. More generally, detecting if a drive has a filesystem, or a part of a filesystem like ZFS would be valuable, I think. |
I was thinking a bit more about this, and maybe it is worthwhile making a tiny tweak to what is output by the programs, so that instead of |
Some operations should not be run while a partition is mounted, and others it is ok. It depends a lot on what is being done. I like the idea of something like "active" or maybe "detected". I will think about the wording a bit to see if there is a better way to describe it to make sure it informs without misleading anyone. |
Yeah, terminology here is key. Right now, I think language is quite misleading and not really helpful. Thanks for giving this a thought. |
…cture Adding an anonymous union to begin the namechange for an old variable to make the name more clear. Using "hasActiveFileSystem" to be more helpful in noting that it is something that is currently mounted. This is far from perfect, but will cover most of the file systems out there. [#10] Signed-off-by: Tyler Erickson <[email protected]>
I have been continuing to think about this issue to figure out a solution. For ZFS, I did some reading on how it works, config files, and the various zfs and zpool commands to get an idea of what we can do. |
@vonericsen , it is possible to parse the file yeah, but it is not guaranteed to exist. It is optional, though exists by default. What might be sensible to do is to figure out whether a given drive has a ZFS label, which would look something like this:
Then from this information, maybe it is a matter of asking whether the given pool is imported. Or, maybe not even that far, and just stopping at having a label. If the label is present, I think it is safe to say that this drive is a member of a pool, maybe active, maybe offline. At which point it is a matter of checking whether this pool is imported, and that can be done by inspecting |
I will look into the label as well to see how that detection could be added! |
Problem
This function pays attention to the
/etc/mnttab
file, looking for information about mounted partitions, but quite commonly, on systems where ZFS is the dominant filesystem, which is likely to be majority of Solaris, illumos and derivatives, there won't be anything referring to individual drives or partitions inmnttab
, instead there will be ZFS mountpoints. Indeed a given drive may be in a pool and in use, but won't be seen inmnttab
.Expected behavior
I think, if this functionality is to exist on Solaris and friends, it might be necessary to enhance it with checks for ZFS labels. I am not sure about the best approach here, haven't had time to think about. Just wanted to raise this in case it was not already considered.
How to reproduce
NA
Deployment information
Anything with ZFS, which at this point would include Linux, BSD, Solaris, illumos, etc.
Additional information
No response
The text was updated successfully, but these errors were encountered: