mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 19:19:32 +03:00
Illumos #2583
2583 Add -p (parsable) option to zfs list References: https://www.illumos.org/issues/2583 illumos/illumos-gate@43d68d68c1 Ported-by: Gregor Kopka <gregor@kopka.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes: #937
This commit is contained in:
parent
e3dc14b861
commit
54d5378fae
@ -18,9 +18,11 @@
|
|||||||
*
|
*
|
||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||||
|
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
@ -108,7 +110,8 @@ zfs_callback(zfs_handle_t *zhp, void *data)
|
|||||||
cb->cb_props_table);
|
cb->cb_props_table);
|
||||||
|
|
||||||
if (zfs_expand_proplist(zhp, cb->cb_proplist,
|
if (zfs_expand_proplist(zhp, cb->cb_proplist,
|
||||||
(cb->cb_flags & ZFS_ITER_RECVD_PROPS))
|
(cb->cb_flags & ZFS_ITER_RECVD_PROPS),
|
||||||
|
(cb->cb_flags & ZFS_ITER_LITERAL_PROPS))
|
||||||
!= 0) {
|
!= 0) {
|
||||||
free(node);
|
free(node);
|
||||||
return (-1);
|
return (-1);
|
||||||
|
@ -18,9 +18,11 @@
|
|||||||
*
|
*
|
||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
* Use is subject to license terms.
|
* Use is subject to license terms.
|
||||||
|
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ZFS_ITER_H
|
#ifndef ZFS_ITER_H
|
||||||
@ -43,7 +45,8 @@ typedef struct zfs_sort_column {
|
|||||||
#define ZFS_ITER_PROP_LISTSNAPS (1 << 2)
|
#define ZFS_ITER_PROP_LISTSNAPS (1 << 2)
|
||||||
#define ZFS_ITER_DEPTH_LIMIT (1 << 3)
|
#define ZFS_ITER_DEPTH_LIMIT (1 << 3)
|
||||||
#define ZFS_ITER_RECVD_PROPS (1 << 4)
|
#define ZFS_ITER_RECVD_PROPS (1 << 4)
|
||||||
#define ZFS_ITER_SIMPLE (1 << 5)
|
#define ZFS_ITER_LITERAL_PROPS (1 << 5)
|
||||||
|
#define ZFS_ITER_SIMPLE (1 << 6)
|
||||||
|
|
||||||
int zfs_for_each(int, char **, int options, zfs_type_t,
|
int zfs_for_each(int, char **, int options, zfs_type_t,
|
||||||
zfs_sort_column_t *, zprop_list_t **, int, zfs_iter_f, void *);
|
zfs_sort_column_t *, zprop_list_t **, int, zfs_iter_f, void *);
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
|
|
||||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||||
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
||||||
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
||||||
|
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -234,9 +234,8 @@ get_usage(zfs_help_t idx)
|
|||||||
return (gettext("\tupgrade [-v]\n"
|
return (gettext("\tupgrade [-v]\n"
|
||||||
"\tupgrade [-r] [-V version] <-a | filesystem ...>\n"));
|
"\tupgrade [-r] [-V version] <-a | filesystem ...>\n"));
|
||||||
case HELP_LIST:
|
case HELP_LIST:
|
||||||
return (gettext("\tlist [-rH][-d max] "
|
return (gettext("\tlist [-Hp] [-r|-d max] [-o property[,...]] "
|
||||||
"[-o property[,...]] [-t type[,...]] [-s property] ...\n"
|
"[-s property]...\n\t [-S property]... [-t type[,...]] "
|
||||||
"\t [-S property] ... "
|
|
||||||
"[filesystem|volume|snapshot] ...\n"));
|
"[filesystem|volume|snapshot] ...\n"));
|
||||||
case HELP_MOUNT:
|
case HELP_MOUNT:
|
||||||
return (gettext("\tmount\n"
|
return (gettext("\tmount\n"
|
||||||
@ -293,12 +292,12 @@ get_usage(zfs_help_t idx)
|
|||||||
"<filesystem|volume>\n"));
|
"<filesystem|volume>\n"));
|
||||||
case HELP_USERSPACE:
|
case HELP_USERSPACE:
|
||||||
return (gettext("\tuserspace [-Hinp] [-o field[,...]] "
|
return (gettext("\tuserspace [-Hinp] [-o field[,...]] "
|
||||||
"[-s field] ...\n\t[-S field] ... "
|
"[-s field]...\n\t [-S field]... [-t type[,...]] "
|
||||||
"[-t type[,...]] <filesystem|snapshot>\n"));
|
"<filesystem|snapshot>\n"));
|
||||||
case HELP_GROUPSPACE:
|
case HELP_GROUPSPACE:
|
||||||
return (gettext("\tgroupspace [-Hinp] [-o field[,...]] "
|
return (gettext("\tgroupspace [-Hinp] [-o field[,...]] "
|
||||||
"[-s field] ...\n\t[-S field] ... "
|
"[-s field]...\n\t [-S field]... [-t type[,...]] "
|
||||||
"[-t type[,...]] <filesystem|snapshot>\n"));
|
"<filesystem|snapshot>\n"));
|
||||||
case HELP_HOLD:
|
case HELP_HOLD:
|
||||||
return (gettext("\thold [-r] <tag> <snapshot> ...\n"));
|
return (gettext("\thold [-r] <tag> <snapshot> ...\n"));
|
||||||
case HELP_HOLDS:
|
case HELP_HOLDS:
|
||||||
@ -2098,7 +2097,7 @@ zfs_do_upgrade(int argc, char **argv)
|
|||||||
* -i Translate SID to POSIX ID.
|
* -i Translate SID to POSIX ID.
|
||||||
* -n Print numeric ID instead of user/group name.
|
* -n Print numeric ID instead of user/group name.
|
||||||
* -o Control which fields to display.
|
* -o Control which fields to display.
|
||||||
* -p Use exact (parseable) numeric output.
|
* -p Use exact (parsable) numeric output.
|
||||||
* -s Specify sort columns, descending order.
|
* -s Specify sort columns, descending order.
|
||||||
* -S Specify sort columns, ascending order.
|
* -S Specify sort columns, ascending order.
|
||||||
* -t Control which object types to display.
|
* -t Control which object types to display.
|
||||||
@ -2788,24 +2787,25 @@ zfs_do_userspace(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* list [-r][-d max] [-H] [-o property[,property]...] [-t type[,type]...]
|
* list [-Hp][-r|-d max] [-o property[,...]] [-s property] ... [-S property]
|
||||||
* [-s property [-s property]...] [-S property [-S property]...]
|
* [-t type[,...]] [filesystem|volume|snapshot] ...
|
||||||
* <dataset> ...
|
|
||||||
*
|
*
|
||||||
|
* -H Scripted mode; elide headers and separate columns by tabs
|
||||||
|
* -p Display values in parsable (literal) format.
|
||||||
* -r Recurse over all children
|
* -r Recurse over all children
|
||||||
* -d Limit recursion by depth.
|
* -d Limit recursion by depth.
|
||||||
* -H Scripted mode; elide headers and separate columns by tabs
|
|
||||||
* -o Control which fields to display.
|
* -o Control which fields to display.
|
||||||
* -t Control which object types to display.
|
|
||||||
* -s Specify sort columns, descending order.
|
* -s Specify sort columns, descending order.
|
||||||
* -S Specify sort columns, ascending order.
|
* -S Specify sort columns, ascending order.
|
||||||
|
* -t Control which object types to display.
|
||||||
*
|
*
|
||||||
* When given no arguments, lists all filesystems in the system.
|
* When given no arguments, list all filesystems in the system.
|
||||||
* Otherwise, list the specified datasets, optionally recursing down them if
|
* Otherwise, list the specified datasets, optionally recursing down them if
|
||||||
* '-r' is specified.
|
* '-r' is specified.
|
||||||
*/
|
*/
|
||||||
typedef struct list_cbdata {
|
typedef struct list_cbdata {
|
||||||
boolean_t cb_first;
|
boolean_t cb_first;
|
||||||
|
boolean_t cb_literal;
|
||||||
boolean_t cb_scripted;
|
boolean_t cb_scripted;
|
||||||
zprop_list_t *cb_proplist;
|
zprop_list_t *cb_proplist;
|
||||||
} list_cbdata_t;
|
} list_cbdata_t;
|
||||||
@ -2814,8 +2814,9 @@ typedef struct list_cbdata {
|
|||||||
* Given a list of columns to display, output appropriate headers for each one.
|
* Given a list of columns to display, output appropriate headers for each one.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
print_header(zprop_list_t *pl)
|
print_header(list_cbdata_t *cb)
|
||||||
{
|
{
|
||||||
|
zprop_list_t *pl = cb->cb_proplist;
|
||||||
char headerbuf[ZFS_MAXPROPLEN];
|
char headerbuf[ZFS_MAXPROPLEN];
|
||||||
const char *header;
|
const char *header;
|
||||||
int i;
|
int i;
|
||||||
@ -2856,19 +2857,19 @@ print_header(zprop_list_t *pl)
|
|||||||
* to the described layout.
|
* to the described layout.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
print_dataset(zfs_handle_t *zhp, zprop_list_t *pl, boolean_t scripted)
|
print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb)
|
||||||
{
|
{
|
||||||
|
zprop_list_t *pl = cb->cb_proplist;
|
||||||
boolean_t first = B_TRUE;
|
boolean_t first = B_TRUE;
|
||||||
char property[ZFS_MAXPROPLEN];
|
char property[ZFS_MAXPROPLEN];
|
||||||
nvlist_t *userprops = zfs_get_user_props(zhp);
|
nvlist_t *userprops = zfs_get_user_props(zhp);
|
||||||
nvlist_t *propval;
|
nvlist_t *propval;
|
||||||
char *propstr;
|
char *propstr;
|
||||||
boolean_t right_justify;
|
boolean_t right_justify;
|
||||||
int width;
|
|
||||||
|
|
||||||
for (; pl != NULL; pl = pl->pl_next) {
|
for (; pl != NULL; pl = pl->pl_next) {
|
||||||
if (!first) {
|
if (!first) {
|
||||||
if (scripted)
|
if (cb->cb_scripted)
|
||||||
(void) printf("\t");
|
(void) printf("\t");
|
||||||
else
|
else
|
||||||
(void) printf(" ");
|
(void) printf(" ");
|
||||||
@ -2883,22 +2884,22 @@ print_dataset(zfs_handle_t *zhp, zprop_list_t *pl, boolean_t scripted)
|
|||||||
right_justify = zfs_prop_align_right(pl->pl_prop);
|
right_justify = zfs_prop_align_right(pl->pl_prop);
|
||||||
} else if (pl->pl_prop != ZPROP_INVAL) {
|
} else if (pl->pl_prop != ZPROP_INVAL) {
|
||||||
if (zfs_prop_get(zhp, pl->pl_prop, property,
|
if (zfs_prop_get(zhp, pl->pl_prop, property,
|
||||||
sizeof (property), NULL, NULL, 0, B_FALSE) != 0)
|
sizeof (property), NULL, NULL, 0,
|
||||||
|
cb->cb_literal) != 0)
|
||||||
propstr = "-";
|
propstr = "-";
|
||||||
else
|
else
|
||||||
propstr = property;
|
propstr = property;
|
||||||
|
|
||||||
right_justify = zfs_prop_align_right(pl->pl_prop);
|
right_justify = zfs_prop_align_right(pl->pl_prop);
|
||||||
} else if (zfs_prop_userquota(pl->pl_user_prop)) {
|
} else if (zfs_prop_userquota(pl->pl_user_prop)) {
|
||||||
if (zfs_prop_get_userquota(zhp, pl->pl_user_prop,
|
if (zfs_prop_get_userquota(zhp, pl->pl_user_prop,
|
||||||
property, sizeof (property), B_FALSE) != 0)
|
property, sizeof (property), cb->cb_literal) != 0)
|
||||||
propstr = "-";
|
propstr = "-";
|
||||||
else
|
else
|
||||||
propstr = property;
|
propstr = property;
|
||||||
right_justify = B_TRUE;
|
right_justify = B_TRUE;
|
||||||
} else if (zfs_prop_written(pl->pl_user_prop)) {
|
} else if (zfs_prop_written(pl->pl_user_prop)) {
|
||||||
if (zfs_prop_get_written(zhp, pl->pl_user_prop,
|
if (zfs_prop_get_written(zhp, pl->pl_user_prop,
|
||||||
property, sizeof (property), B_FALSE) != 0)
|
property, sizeof (property), cb->cb_literal) != 0)
|
||||||
propstr = "-";
|
propstr = "-";
|
||||||
else
|
else
|
||||||
propstr = property;
|
propstr = property;
|
||||||
@ -2913,19 +2914,17 @@ print_dataset(zfs_handle_t *zhp, zprop_list_t *pl, boolean_t scripted)
|
|||||||
right_justify = B_FALSE;
|
right_justify = B_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = pl->pl_width;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this is being called in scripted mode, or if this is the
|
* If this is being called in scripted mode, or if this is the
|
||||||
* last column and it is left-justified, don't include a width
|
* last column and it is left-justified, don't include a width
|
||||||
* format specifier.
|
* format specifier.
|
||||||
*/
|
*/
|
||||||
if (scripted || (pl->pl_next == NULL && !right_justify))
|
if (cb->cb_scripted || (pl->pl_next == NULL && !right_justify))
|
||||||
(void) printf("%s", propstr);
|
(void) printf("%s", propstr);
|
||||||
else if (right_justify)
|
else if (right_justify)
|
||||||
(void) printf("%*s", width, propstr);
|
(void) printf("%*s", (int)pl->pl_width, propstr);
|
||||||
else
|
else
|
||||||
(void) printf("%-*s", width, propstr);
|
(void) printf("%-*s", (int)pl->pl_width, propstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) printf("\n");
|
(void) printf("\n");
|
||||||
@ -2941,11 +2940,11 @@ list_callback(zfs_handle_t *zhp, void *data)
|
|||||||
|
|
||||||
if (cbp->cb_first) {
|
if (cbp->cb_first) {
|
||||||
if (!cbp->cb_scripted)
|
if (!cbp->cb_scripted)
|
||||||
print_header(cbp->cb_proplist);
|
print_header(cbp);
|
||||||
cbp->cb_first = B_FALSE;
|
cbp->cb_first = B_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_dataset(zhp, cbp->cb_proplist, cbp->cb_scripted);
|
print_dataset(zhp, cbp);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -2954,7 +2953,6 @@ static int
|
|||||||
zfs_do_list(int argc, char **argv)
|
zfs_do_list(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
boolean_t scripted = B_FALSE;
|
|
||||||
static char default_fields[] =
|
static char default_fields[] =
|
||||||
"name,used,available,referenced,mountpoint";
|
"name,used,available,referenced,mountpoint";
|
||||||
int types = ZFS_TYPE_DATASET;
|
int types = ZFS_TYPE_DATASET;
|
||||||
@ -2968,11 +2966,15 @@ zfs_do_list(int argc, char **argv)
|
|||||||
int flags = ZFS_ITER_PROP_LISTSNAPS | ZFS_ITER_ARGS_CAN_BE_PATHS;
|
int flags = ZFS_ITER_PROP_LISTSNAPS | ZFS_ITER_ARGS_CAN_BE_PATHS;
|
||||||
|
|
||||||
/* check options */
|
/* check options */
|
||||||
while ((c = getopt(argc, argv, ":d:o:rt:Hs:S:")) != -1) {
|
while ((c = getopt(argc, argv, "HS:d:o:prs:t:")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'o':
|
case 'o':
|
||||||
fields = optarg;
|
fields = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'p':
|
||||||
|
cb.cb_literal = B_TRUE;
|
||||||
|
flags |= ZFS_ITER_LITERAL_PROPS;
|
||||||
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
limit = parse_depth(optarg, &flags);
|
limit = parse_depth(optarg, &flags);
|
||||||
break;
|
break;
|
||||||
@ -2980,7 +2982,7 @@ zfs_do_list(int argc, char **argv)
|
|||||||
flags |= ZFS_ITER_RECURSE;
|
flags |= ZFS_ITER_RECURSE;
|
||||||
break;
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
scripted = B_TRUE;
|
cb.cb_scripted = B_TRUE;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
if (zfs_add_sort_column(&sortcol, optarg,
|
if (zfs_add_sort_column(&sortcol, optarg,
|
||||||
@ -3070,7 +3072,6 @@ zfs_do_list(int argc, char **argv)
|
|||||||
!= 0)
|
!= 0)
|
||||||
usage(B_FALSE);
|
usage(B_FALSE);
|
||||||
|
|
||||||
cb.cb_scripted = scripted;
|
|
||||||
cb.cb_first = B_TRUE;
|
cb.cb_first = B_TRUE;
|
||||||
|
|
||||||
ret = zfs_for_each(argc, argv, flags, types, sortcol, &cb.cb_proplist,
|
ret = zfs_for_each(argc, argv, flags, types, sortcol, &cb.cb_proplist,
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
|
||||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||||
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
||||||
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
||||||
|
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LIBZFS_H
|
#ifndef _LIBZFS_H
|
||||||
@ -478,7 +478,8 @@ typedef struct zprop_list {
|
|||||||
boolean_t pl_fixed;
|
boolean_t pl_fixed;
|
||||||
} zprop_list_t;
|
} zprop_list_t;
|
||||||
|
|
||||||
extern int zfs_expand_proplist(zfs_handle_t *, zprop_list_t **, boolean_t);
|
extern int zfs_expand_proplist(zfs_handle_t *, zprop_list_t **, boolean_t,
|
||||||
|
boolean_t);
|
||||||
extern void zfs_prune_proplist(zfs_handle_t *, uint8_t *);
|
extern void zfs_prune_proplist(zfs_handle_t *, uint8_t *);
|
||||||
|
|
||||||
#define ZFS_MOUNTPOINT_NONE "none"
|
#define ZFS_MOUNTPOINT_NONE "none"
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
* Copyright (c) 2013 by Delphix. All rights reserved.
|
* Copyright (c) 2013 by Delphix. All rights reserved.
|
||||||
* Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved.
|
* Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||||
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
|
|
||||||
* Copyright (c) 2013 Martin Matuska. All rights reserved.
|
* Copyright (c) 2013 Martin Matuska. All rights reserved.
|
||||||
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
||||||
|
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -4157,7 +4157,8 @@ zfs_get_user_props(zfs_handle_t *zhp)
|
|||||||
* of the RECEIVED column.
|
* of the RECEIVED column.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received)
|
zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received,
|
||||||
|
boolean_t literal)
|
||||||
{
|
{
|
||||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
zprop_list_t *entry;
|
zprop_list_t *entry;
|
||||||
@ -4219,18 +4220,18 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received)
|
|||||||
* Now go through and check the width of any non-fixed columns
|
* Now go through and check the width of any non-fixed columns
|
||||||
*/
|
*/
|
||||||
for (entry = *plp; entry != NULL; entry = entry->pl_next) {
|
for (entry = *plp; entry != NULL; entry = entry->pl_next) {
|
||||||
if (entry->pl_fixed)
|
if (entry->pl_fixed && !literal)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (entry->pl_prop != ZPROP_INVAL) {
|
if (entry->pl_prop != ZPROP_INVAL) {
|
||||||
if (zfs_prop_get(zhp, entry->pl_prop,
|
if (zfs_prop_get(zhp, entry->pl_prop,
|
||||||
buf, sizeof (buf), NULL, NULL, 0, B_FALSE) == 0) {
|
buf, sizeof (buf), NULL, NULL, 0, literal) == 0) {
|
||||||
if (strlen(buf) > entry->pl_width)
|
if (strlen(buf) > entry->pl_width)
|
||||||
entry->pl_width = strlen(buf);
|
entry->pl_width = strlen(buf);
|
||||||
}
|
}
|
||||||
if (received && zfs_prop_get_recvd(zhp,
|
if (received && zfs_prop_get_recvd(zhp,
|
||||||
zfs_prop_to_name(entry->pl_prop),
|
zfs_prop_to_name(entry->pl_prop),
|
||||||
buf, sizeof (buf), B_FALSE) == 0)
|
buf, sizeof (buf), literal) == 0)
|
||||||
if (strlen(buf) > entry->pl_recvd_width)
|
if (strlen(buf) > entry->pl_recvd_width)
|
||||||
entry->pl_recvd_width = strlen(buf);
|
entry->pl_recvd_width = strlen(buf);
|
||||||
} else {
|
} else {
|
||||||
@ -4243,7 +4244,7 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received)
|
|||||||
}
|
}
|
||||||
if (received && zfs_prop_get_recvd(zhp,
|
if (received && zfs_prop_get_recvd(zhp,
|
||||||
entry->pl_user_prop,
|
entry->pl_user_prop,
|
||||||
buf, sizeof (buf), B_FALSE) == 0)
|
buf, sizeof (buf), literal) == 0)
|
||||||
if (strlen(buf) > entry->pl_recvd_width)
|
if (strlen(buf) > entry->pl_recvd_width)
|
||||||
entry->pl_recvd_width = strlen(buf);
|
entry->pl_recvd_width = strlen(buf);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
.\" Copyright 2012 Nexenta Systems, Inc. All Rights Reserved.
|
.\" Copyright 2012 Nexenta Systems, Inc. All Rights Reserved.
|
||||||
.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||||
.\"
|
.\"
|
||||||
.TH zfs 8 "Jan 10, 2013" "ZFS pool 28, filesystem 5" "System Administration Commands"
|
.TH zfs 8 "Nov 19, 2013" "ZFS pool 28, filesystem 5" "System Administration Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
zfs \- configures ZFS file systems
|
zfs \- configures ZFS file systems
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -95,7 +95,7 @@ zfs \- configures ZFS file systems
|
|||||||
|
|
||||||
.LP
|
.LP
|
||||||
.nf
|
.nf
|
||||||
\fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-H\fR][\fB-o\fR \fIproperty\fR[,...]] [\fB-t\fR \fItype\fR[,...]]
|
\fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-Hp\fR][\fB-o\fR \fIproperty\fR[,\fIproperty\fR]...] [\fB-t\fR \fItype\fR[,\fItype\fR]..]
|
||||||
[\fB-s\fR \fIproperty\fR] ... [\fB-S\fR \fIproperty\fR] ... [\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR] ...
|
[\fB-s\fR \fIproperty\fR] ... [\fB-S\fR \fIproperty\fR] ... [\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR] ...
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
@ -244,7 +244,6 @@ zfs \- configures ZFS file systems
|
|||||||
\fBzfs\fR \fBdiff\fR [\fB-FHt\fR] \fIsnapshot\fR \fIsnapshot|filesystem\fR
|
\fBzfs\fR \fBdiff\fR [\fB-FHt\fR] \fIsnapshot\fR \fIsnapshot|filesystem\fR
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.sp
|
|
||||||
.LP
|
.LP
|
||||||
The \fBzfs\fR command configures \fBZFS\fR datasets within a \fBZFS\fR storage pool, as described in \fBzpool\fR(8). A dataset is identified by a unique path within the \fBZFS\fR namespace. For example:
|
The \fBzfs\fR command configures \fBZFS\fR datasets within a \fBZFS\fR storage pool, as described in \fBzpool\fR(8). A dataset is identified by a unique path within the \fBZFS\fR namespace. For example:
|
||||||
.sp
|
.sp
|
||||||
@ -295,7 +294,6 @@ A read-only version of a file system or volume at a given point in time. It is s
|
|||||||
.RE
|
.RE
|
||||||
|
|
||||||
.SS "ZFS File System Hierarchy"
|
.SS "ZFS File System Hierarchy"
|
||||||
.sp
|
|
||||||
.LP
|
.LP
|
||||||
A \fBZFS\fR storage pool is a logical collection of devices that provide space for datasets. A storage pool is also the root of the \fBZFS\fR file system hierarchy.
|
A \fBZFS\fR storage pool is a logical collection of devices that provide space for datasets. A storage pool is also the root of the \fBZFS\fR file system hierarchy.
|
||||||
.sp
|
.sp
|
||||||
@ -305,7 +303,6 @@ The root of the pool can be accessed as a file system, such as mounting and unmo
|
|||||||
.LP
|
.LP
|
||||||
See \fBzpool\fR(8) for more information on creating and administering pools.
|
See \fBzpool\fR(8) for more information on creating and administering pools.
|
||||||
.SS "Snapshots"
|
.SS "Snapshots"
|
||||||
.sp
|
|
||||||
.LP
|
.LP
|
||||||
A snapshot is a read-only copy of a file system or volume. Snapshots can be created extremely quickly, and initially consume no additional space within the pool. As data within the active dataset changes, the snapshot consumes more data than would otherwise be shared with the active dataset.
|
A snapshot is a read-only copy of a file system or volume. Snapshots can be created extremely quickly, and initially consume no additional space within the pool. As data within the active dataset changes, the snapshot consumes more data than would otherwise be shared with the active dataset.
|
||||||
.sp
|
.sp
|
||||||
@ -315,7 +312,6 @@ Snapshots can have arbitrary names. Snapshots of volumes can be cloned or rolled
|
|||||||
.LP
|
.LP
|
||||||
File system snapshots can be accessed under the \fB\&.zfs/snapshot\fR directory in the root of the file system. Snapshots are automatically mounted on demand and may be unmounted at regular intervals. The visibility of the \fB\&.zfs\fR directory can be controlled by the \fBsnapdir\fR property.
|
File system snapshots can be accessed under the \fB\&.zfs/snapshot\fR directory in the root of the file system. Snapshots are automatically mounted on demand and may be unmounted at regular intervals. The visibility of the \fB\&.zfs\fR directory can be controlled by the \fBsnapdir\fR property.
|
||||||
.SS "Clones"
|
.SS "Clones"
|
||||||
.sp
|
|
||||||
.LP
|
.LP
|
||||||
A clone is a writable volume or file system whose initial contents are the same as another dataset. As with snapshots, creating a clone is nearly instantaneous, and initially consumes no additional space.
|
A clone is a writable volume or file system whose initial contents are the same as another dataset. As with snapshots, creating a clone is nearly instantaneous, and initially consumes no additional space.
|
||||||
.sp
|
.sp
|
||||||
@ -325,7 +321,6 @@ Clones can only be created from a snapshot. When a snapshot is cloned, it create
|
|||||||
.LP
|
.LP
|
||||||
The clone parent-child dependency relationship can be reversed by using the \fBpromote\fR subcommand. This causes the "origin" file system to become a clone of the specified file system, which makes it possible to destroy the file system that the clone was created from.
|
The clone parent-child dependency relationship can be reversed by using the \fBpromote\fR subcommand. This causes the "origin" file system to become a clone of the specified file system, which makes it possible to destroy the file system that the clone was created from.
|
||||||
.SS "Mount Points"
|
.SS "Mount Points"
|
||||||
.sp
|
|
||||||
.LP
|
.LP
|
||||||
Creating a \fBZFS\fR file system is a simple operation, so the number of file systems per system is likely to be numerous. To cope with this, \fBZFS\fR automatically manages mounting and unmounting file systems without the need to edit the \fB/etc/fstab\fR file. All automatically managed file systems are mounted by \fBZFS\fR at boot time.
|
Creating a \fBZFS\fR file system is a simple operation, so the number of file systems per system is likely to be numerous. To cope with this, \fBZFS\fR automatically manages mounting and unmounting file systems without the need to edit the \fB/etc/fstab\fR file. All automatically managed file systems are mounted by \fBZFS\fR at boot time.
|
||||||
.sp
|
.sp
|
||||||
@ -341,11 +336,9 @@ A file system \fBmountpoint\fR property of \fBnone\fR prevents the file system f
|
|||||||
.LP
|
.LP
|
||||||
If needed, \fBZFS\fR file systems can also be managed with traditional tools (\fBmount\fR, \fBumount\fR, \fB/etc/fstab\fR). If a file system's mount point is set to \fBlegacy\fR, \fBZFS\fR makes no attempt to manage the file system, and the administrator is responsible for mounting and unmounting the file system.
|
If needed, \fBZFS\fR file systems can also be managed with traditional tools (\fBmount\fR, \fBumount\fR, \fB/etc/fstab\fR). If a file system's mount point is set to \fBlegacy\fR, \fBZFS\fR makes no attempt to manage the file system, and the administrator is responsible for mounting and unmounting the file system.
|
||||||
.SS "Deduplication"
|
.SS "Deduplication"
|
||||||
.sp
|
|
||||||
.LP
|
.LP
|
||||||
Deduplication is the process for removing redundant data at the block-level, reducing the total amount of data stored. If a file system has the \fBdedup\fR property enabled, duplicate data blocks are removed synchronously. The result is that only unique data is stored and common components are shared among files.
|
Deduplication is the process for removing redundant data at the block-level, reducing the total amount of data stored. If a file system has the \fBdedup\fR property enabled, duplicate data blocks are removed synchronously. The result is that only unique data is stored and common components are shared among files.
|
||||||
.SS "Native Properties"
|
.SS "Native Properties"
|
||||||
.sp
|
|
||||||
.LP
|
.LP
|
||||||
Properties are divided into two types, native properties and user-defined (or "user") properties. Native properties either export internal statistics or control \fBZFS\fR behavior. In addition, native properties are either editable or read-only. User properties have no effect on \fBZFS\fR behavior, but you can use them to annotate datasets in a way that is meaningful in your environment. For more information about user properties, see the "User Properties" section, below.
|
Properties are divided into two types, native properties and user-defined (or "user") properties. Native properties either export internal statistics or control \fBZFS\fR behavior. In addition, native properties are either editable or read-only. User properties have no effect on \fBZFS\fR behavior, but you can use them to annotate datasets in a way that is meaningful in your environment. For more information about user properties, see the "User Properties" section, below.
|
||||||
.sp
|
.sp
|
||||||
@ -1306,7 +1299,6 @@ Indicates whether the file system should reject file names that include characte
|
|||||||
.LP
|
.LP
|
||||||
The \fBcasesensitivity\fR, \fBnormalization\fR, and \fButf8only\fR properties are also new permissions that can be assigned to non-privileged users by using the \fBZFS\fR delegated administration feature.
|
The \fBcasesensitivity\fR, \fBnormalization\fR, and \fButf8only\fR properties are also new permissions that can be assigned to non-privileged users by using the \fBZFS\fR delegated administration feature.
|
||||||
.SS "Temporary Mount Point Properties"
|
.SS "Temporary Mount Point Properties"
|
||||||
.sp
|
|
||||||
.LP
|
.LP
|
||||||
When a file system is mounted, either through \fBmount\fR(8) for legacy mounts or the \fBzfs mount\fR command for normal file systems, its mount options are set according to its properties. The correlation between properties and mount options is as follows:
|
When a file system is mounted, either through \fBmount\fR(8) for legacy mounts or the \fBzfs mount\fR command for normal file systems, its mount options are set according to its properties. The correlation between properties and mount options is as follows:
|
||||||
.sp
|
.sp
|
||||||
@ -1326,7 +1318,6 @@ When a file system is mounted, either through \fBmount\fR(8) for legacy mounts o
|
|||||||
.LP
|
.LP
|
||||||
In addition, these options can be set on a per-mount basis using the \fB-o\fR option, without affecting the property that is stored on disk. The values specified on the command line override the values stored in the dataset. The \fB-nosuid\fR option is an alias for \fBnodevices,nosetuid\fR. These properties are reported as "temporary" by the \fBzfs get\fR command. If the properties are changed while the dataset is mounted, the new setting overrides any temporary settings.
|
In addition, these options can be set on a per-mount basis using the \fB-o\fR option, without affecting the property that is stored on disk. The values specified on the command line override the values stored in the dataset. The \fB-nosuid\fR option is an alias for \fBnodevices,nosetuid\fR. These properties are reported as "temporary" by the \fBzfs get\fR command. If the properties are changed while the dataset is mounted, the new setting overrides any temporary settings.
|
||||||
.SS "User Properties"
|
.SS "User Properties"
|
||||||
.sp
|
|
||||||
.LP
|
.LP
|
||||||
In addition to the standard native properties, \fBZFS\fR supports arbitrary user properties. User properties have no effect on \fBZFS\fR behavior, but applications or administrators can use them to annotate datasets (file systems, volumes, and snapshots).
|
In addition to the standard native properties, \fBZFS\fR supports arbitrary user properties. User properties have no effect on \fBZFS\fR behavior, but applications or administrators can use them to annotate datasets (file systems, volumes, and snapshots).
|
||||||
.sp
|
.sp
|
||||||
@ -1339,14 +1330,12 @@ When making programmatic use of user properties, it is strongly suggested to use
|
|||||||
.LP
|
.LP
|
||||||
The values of user properties are arbitrary strings, are always inherited, and are never validated. All of the commands that operate on properties (\fBzfs list\fR, \fBzfs get\fR, \fBzfs set\fR, and so forth) can be used to manipulate both native properties and user properties. Use the \fBzfs inherit\fR command to clear a user property . If the property is not defined in any parent dataset, it is removed entirely. Property values are limited to 1024 characters.
|
The values of user properties are arbitrary strings, are always inherited, and are never validated. All of the commands that operate on properties (\fBzfs list\fR, \fBzfs get\fR, \fBzfs set\fR, and so forth) can be used to manipulate both native properties and user properties. Use the \fBzfs inherit\fR command to clear a user property . If the property is not defined in any parent dataset, it is removed entirely. Property values are limited to 1024 characters.
|
||||||
.SS "ZFS Volumes as Swap"
|
.SS "ZFS Volumes as Swap"
|
||||||
.sp
|
|
||||||
.LP
|
.LP
|
||||||
\fBZFS\fR volumes may be used as Linux swap devices. After creating the volume
|
\fBZFS\fR volumes may be used as Linux swap devices. After creating the volume
|
||||||
with the \fBzfs create\fR command set up and enable the swap area using the
|
with the \fBzfs create\fR command set up and enable the swap area using the
|
||||||
\fBmkswap\fR(8) and \fBswapon\fR(8) commands. Do not swap to a file on a
|
\fBmkswap\fR(8) and \fBswapon\fR(8) commands. Do not swap to a file on a
|
||||||
\fBZFS\fR file system. A \fBZFS\fR swap file configuration is not supported.
|
\fBZFS\fR file system. A \fBZFS\fR swap file configuration is not supported.
|
||||||
.SH SUBCOMMANDS
|
.SH SUBCOMMANDS
|
||||||
.sp
|
|
||||||
.LP
|
.LP
|
||||||
All subcommands that modify state are logged persistently to the pool in their original form.
|
All subcommands that modify state are logged persistently to the pool in their original form.
|
||||||
.sp
|
.sp
|
||||||
@ -1806,7 +1795,7 @@ Recursively rename the snapshots of all descendent datasets. Snapshots are the o
|
|||||||
.ne 2
|
.ne 2
|
||||||
.mk
|
.mk
|
||||||
.na
|
.na
|
||||||
\fB\fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR] [\fB-H\fR] [\fB-o\fR \fIproperty\fR[,\fI\&...\fR]] [ \fB-t\fR \fItype\fR[,\fI\&...\fR]] [ \fB-s\fR \fIproperty\fR ] ... [ \fB-S\fR \fIproperty\fR ] ... [\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR] ...\fR
|
\fB\fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR] [\fB-Hp\fR] [\fB-o\fR \fIproperty\fR[,\fI\&...\fR]] [ \fB-t\fR \fItype\fR[,\fI\&...\fR]] [ \fB-s\fR \fIproperty\fR ] ... [ \fB-S\fR \fIproperty\fR ] ... [\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR] ...\fR
|
||||||
.ad
|
.ad
|
||||||
.sp .6
|
.sp .6
|
||||||
.RS 4n
|
.RS 4n
|
||||||
@ -1822,6 +1811,16 @@ Lists the property information for the given datasets in tabular form. If specif
|
|||||||
Used for scripting mode. Do not print headers and separate fields by a single tab instead of arbitrary white space.
|
Used for scripting mode. Do not print headers and separate fields by a single tab instead of arbitrary white space.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
|
.sp
|
||||||
|
.ne 2
|
||||||
|
.mk
|
||||||
|
.na
|
||||||
|
\fB\fB-p\fR\fR
|
||||||
|
.sp .6
|
||||||
|
.RS 4n
|
||||||
|
Display numbers in parsable (exact) values.
|
||||||
|
.RE
|
||||||
|
|
||||||
.sp
|
.sp
|
||||||
.ne 2
|
.ne 2
|
||||||
.mk
|
.mk
|
||||||
@ -1953,8 +1952,7 @@ Sets the property to the given value for each dataset. Only some properties can
|
|||||||
|
|
||||||
.sp
|
.sp
|
||||||
.ne 2
|
.ne 2
|
||||||
.mk
|
.mk .na
|
||||||
.na
|
|
||||||
\fB\fBzfs get\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR] [\fB-Hp\fR] [\fB-o\fR \fIfield\fR[,...] [\fB-t\fR \fItype\fR[,...]] [\fB-s\fR \fIsource\fR[,...] "\fIall\fR" | \fIproperty\fR[,...] \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR ...\fR
|
\fB\fBzfs get\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR] [\fB-Hp\fR] [\fB-o\fR \fIfield\fR[,...] [\fB-t\fR \fItype\fR[,...]] [\fB-s\fR \fIsource\fR[,...] "\fIall\fR" | \fIproperty\fR[,...] \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR ...\fR
|
||||||
.ad
|
.ad
|
||||||
.sp .6
|
.sp .6
|
||||||
@ -2038,7 +2036,7 @@ A comma-separated list of sources to display. Those properties coming from a sou
|
|||||||
.ad
|
.ad
|
||||||
.sp .6
|
.sp .6
|
||||||
.RS 4n
|
.RS 4n
|
||||||
Display numbers in parseable (exact) values.
|
Display numbers in parsable (exact) values.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.RE
|
.RE
|
||||||
@ -2978,7 +2976,7 @@ F Regular file
|
|||||||
.ad
|
.ad
|
||||||
.sp .6
|
.sp .6
|
||||||
.RS 4n
|
.RS 4n
|
||||||
Give more parseable tab-separated output, without header lines and without arrows.
|
Give more parsable tab-separated output, without header lines and without arrows.
|
||||||
.RE
|
.RE
|
||||||
.sp
|
.sp
|
||||||
.ne 2
|
.ne 2
|
||||||
@ -3491,7 +3489,6 @@ M F /tank/test/modified
|
|||||||
.sp
|
.sp
|
||||||
|
|
||||||
.SH EXIT STATUS
|
.SH EXIT STATUS
|
||||||
.sp
|
|
||||||
.LP
|
.LP
|
||||||
The following exit values are returned:
|
The following exit values are returned:
|
||||||
.sp
|
.sp
|
||||||
@ -3528,6 +3525,5 @@ Invalid command line options were specified.
|
|||||||
.RE
|
.RE
|
||||||
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.sp
|
|
||||||
.LP
|
.LP
|
||||||
\fBchmod\fR(2), \fBfsync\fR(2), \fBgzip\fR(1), \fBmount\fR(8), \fBssh\fR(1), \fBstat\fR(2), \fBwrite\fR(2), \fBzpool\fR(8)
|
\fBchmod\fR(2), \fBfsync\fR(2), \fBgzip\fR(1), \fBmount\fR(8), \fBssh\fR(1), \fBstat\fR(2), \fBwrite\fR(2), \fBzpool\fR(8)
|
||||||
|
Loading…
Reference in New Issue
Block a user