On Tue, October 25, 2011 09:42, adele....@oracle.com wrote:
> Hi all,
>
> I have a customer who wants to know what is the max characters allowed
> in creating name for zpool,
>
> Are there any restrictions in using special characters?

255 characters. Try doing a 'man zpool':

  Creates a new storage pool containing the virtual devices specified
  on  the  command  line. The pool name must begin with a letter, and
  can only contain alphanumeric  characters  as  well   as  underscore
  ("_"),  dash  ("-"),  and  period  (".").  The pool names "mirror",
  "raidz", "spare" and "log" are reserved,  as  are  names  beginning
  with  the  pattern "c[0-9]". The vdev specification is described in
  the "Virtual Devices" section.

Or, use the source Luke:

Going to http://src.opensolaris.org, and searching for "zpool" turns up:

    
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/zpool/zpool_main.c

Inside of it we have a zpool_do_create() function, which defines a 'char
*poolname' variable. From there we call a zpool_create() in
libzfs/common/libzfs_pool.c to zpool_name_valid() to pool_namecheck(),
where we end up with the following code snippet:

        /*
         * Make sure the name is not too long.
         *
         * ZPOOL_MAXNAMELEN is the maximum pool length used in the userland
         * which is the same as MAXNAMELEN used in the kernel.
         * If ZPOOL_MAXNAMELEN value is changed, make sure to cleanup all
         * places using MAXNAMELEN.
         */
        if (strlen(pool) >= MAXNAMELEN) {
                if (why)
                        *why = NAME_ERR_TOOLONG;
                return (-1);
        }

Check the function for further restrictions:

    
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/common/zfs/zfs_namecheck.c#288


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

Reply via email to