Hi folks -- What''s the best way to get the id associated with a zpool name(without importing it if it is already not done so) -- that is - given the disk device name - I would to love get the ID of the zpool of which this disk is a part of. Thanks! --Balu This message posted from opensolaris.org
You can use ''zdb -l <dev>'' where ''dev'' is a device in the pool, and then look for the ''pool_guid'' line (note that this is "not an interface" and could theoretically change). An upcoming putback will add the guid as a first-class pool property, so that it can be used in ''zpool list'' or ''zpool get''. - Eric On Wed, Aug 29, 2007 at 09:02:50AM -0700, Manyam wrote:> Hi folks -- > What''s the best way to get the id associated with a zpool name(without importing it if it is already not done so) -- that is - given the disk device name - I would to love get the ID of the zpool of which this disk is a part of. > > Thanks! > > --Balu > > > This message posted from opensolaris.org > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss-- Eric Schrock, Solaris Kernel Development http://blogs.sun.com/eschrock
Eric Schrock wrote:> You can use ''zdb -l <dev>'' where ''dev'' is a device in the pool, and then > look for the ''pool_guid'' line (note that this is "not an interface" and > could theoretically change). An upcoming putback will add the guid as a > first-class pool property, so that it can be used in ''zpool list'' or > ''zpool get''.Will ''zpool get -o guid/name'' work even on an exported pool which is I believe the original question.> On Wed, Aug 29, 2007 at 09:02:50AM -0700, Manyam wrote: >> Hi folks -- >> What''s the best way to get the id associated with a zpool name(without importing it if it is already not done so) -- that is - given the disk device name - I would to love get the ID of the zpool of which this disk is a part of.-- Darren J Moffat
On Wed, Aug 29, 2007 at 05:39:19PM +0100, Darren J Moffat wrote:> Eric Schrock wrote: > > You can use ''zdb -l <dev>'' where ''dev'' is a device in the pool, and then > > look for the ''pool_guid'' line (note that this is "not an interface" and > > could theoretically change). An upcoming putback will add the guid as a > > first-class pool property, so that it can be used in ''zpool list'' or > > ''zpool get''. > > Will ''zpool get -o guid/name'' work even on an exported pool which is I > believe the original question.No, the only way to do that is with ''zdb -l''. I was just mentioning it as an orthogonal FYI, since it won''t help with device -> pool translations. Note that ''fstyp -v'' does the same thing as ''zdb -l'', and is marginally more stable. The output it still technically subject to change, but it''s highly unlikely (given the pain such a change would cause). - Eric -- Eric Schrock, Solaris Kernel Development http://blogs.sun.com/eschrock
On Wed, Aug 29, 2007 at 10:29:50PM +0530, Balu manyam wrote:> Thanks!,Eric and Darren -- ''zdb -l <devicename>'' was indeed what I was > looking for .. > > Also, Is there an easy way to change this ID manually - This would be > extremely useful in a SAN environment.No, there is no way to change it. - Eric -- Eric Schrock, Solaris Kernel Development http://blogs.sun.com/eschrock
On Wed, 2007-08-29 at 09:41 -0700, Eric Schrock wrote:> Note that ''fstyp -v'' does the same thing as ''zdb -l'', and > is marginally more stable. The output it still technically subject to > change, but it''s highly unlikely (given the pain such a change would > cause).If other programs depend on aspects of the output of fstyp -v or fstyp -a output on a ZFS vdev, we should probably boost the stability level of specific fields in the output and clarify what will remain subject to change. For instance we could say that the pool_guid, hostname, and hostid won''t go away or change meaning, but that other fields may appear or disappear, and that fields may be reordered at any time. - Bill
On Wed, Aug 29, 2007 at 11:40:34PM +0530, Balu manyam wrote:> Thanks ,Eric - I am looking for a way to import a zpool which is a bit by > bit copy of the zpool(hence also the meta data) which is already imported on > the same host ..that is two pools one imported and one not are presented to > the same host > > Do you have any suggestions for this?There is currently no way to do this. It has come up before, but its tricky. By definition, a GUID is supposed to be a globally unique identifier for a pool. It would be pretty simple to write a utility that given a device, changed its guid to another random value. See zpool_read_label() for how the label is read in userland. It would not be hard to write out an updated packed nvlist. - Eric -- Eric Schrock, Solaris Kernel Development http://blogs.sun.com/eschrock