On 10/11/2010 11:18, sridhar surampudi wrote:
I was wondering how zpool split works or implemented.

If a pool pool1 is on a mirror having two devices dev1 and dev2 then using 
zpool split I can split with the new pool name say pool-mirror on dev2.

How split can change metadata on dev2 and rename/replace and associate with new 
name i.e. pool-mirror ??

Exactly what isn't clear from the description in the man page ?

     zpool split [-R altroot] [-n] [-o mntopts] [-o
     property=value] pool newpool [device ...]

         Splits off one disk from each mirrored top-level vdev in
         a  pool and creates a new pool from the split-off disks.
         The original pool must be made up of one or more mirrors
         and must not be in the process of resilvering. The split
         subcommand chooses the last device in each  mirror  vdev
         unless  overridden by a device specification on the com-
         mand line.

         When using a device argument, split includes the  speci-
         fied  device(s)  in  a  new pool and, should any devices
         remain unspecified, assigns the last device in each mir-
         ror  vdev  to that pool, as it does normally. If you are
         uncertain about the outcome of a split command, use  the
         -n  ("dry-run")  option to ensure your command will have
         the effect you intend.

Or are you really asking about the implementation details ? If you want to know how it is implemented then you need to read the source code.

Here would be a good starting point:

http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libzfs/common/libzfs_pool.c#zpool_vdev_split

Which ends up in kernel here:

http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/zfs/zfs_ioctl.c#zfs_ioc_vdev_split


--
Darren J Moffat
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to