Skip to content

Commit

Permalink
Option to disable automatic EFI partitioning.
Browse files Browse the repository at this point in the history
Sometimes it is desired to not have 'zpool' setup partitioning on
devices it uses for the pool. So allow '-o whole_disk={on,off}'
option to 'add', 'attach', 'create', 'replace' and 'split' to
disable or enable, respectivly, the automatic partitioning.

Signed-off-by: Turbo Fredriksson [email protected]
Closes #94
Closes #719
Closes #1162
Closes #3452
  • Loading branch information
FransUrbo committed May 30, 2015
1 parent 2a34db1 commit bb82544
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 5 deletions.
6 changes: 4 additions & 2 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,8 @@ zpool_do_add(int argc, char **argv)
*propval = '\0';
propval++;

if ((strcmp(optarg, ZPOOL_CONFIG_ASHIFT) != 0) ||
if (((strcmp(optarg, ZPOOL_CONFIG_ASHIFT) != 0) &&
(strcmp(optarg, ZPOOL_CONFIG_WHOLE_DISK) != 0)) ||
(add_prop_list(optarg, propval, &props, B_TRUE)))
usage(B_FALSE);
break;
Expand Down Expand Up @@ -3334,7 +3335,8 @@ zpool_do_attach_or_replace(int argc, char **argv, int replacing)
*propval = '\0';
propval++;

if ((strcmp(optarg, ZPOOL_CONFIG_ASHIFT) != 0) ||
if (((strcmp(optarg, ZPOOL_CONFIG_ASHIFT) != 0) &&
(strcmp(optarg, ZPOOL_CONFIG_WHOLE_DISK) != 0)) ||
(add_prop_list(optarg, propval, &props, B_TRUE)))
usage(B_FALSE);
break;
Expand Down
3 changes: 1 addition & 2 deletions cmd/zpool/zpool_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ uint_t num_logs(nvlist_t *nv);
*/

nvlist_t *make_root_vdev(zpool_handle_t *zhp, nvlist_t *props, int force,
int check_rep, boolean_t replacing, boolean_t dryrun, int argc,
char **argv);
int check_rep, boolean_t replacing, boolean_t dryrun, int argc, char **argv);
nvlist_t *split_mirror_vdev(zpool_handle_t *zhp, char *newname,
nvlist_t *props, splitflags_t flags, int argc, char **argv);

Expand Down
21 changes: 20 additions & 1 deletion cmd/zpool/zpool_vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,26 @@ make_leaf_vdev(nvlist_t *props, const char *arg, uint64_t is_log)
return (NULL);
}

wholedisk = is_whole_disk(path);
if (props != NULL) {
char *value = NULL;
if (nvlist_lookup_string(props,
zpool_prop_to_name(ZPOOL_PROP_WHOLE_DISK), &value)
== 0) {
if (strcmp(value, "on") == 0)
/*
* This is somewhat counter-intuitive.
* We've asked for whole disk, but we're
* setting it to false. This because
* when it's false, later checks won't
* partition the device, which is what
* we ACTUALLY wanted.
*/
wholedisk = B_FALSE;
else
wholedisk = is_whole_disk(path);
}
} else
wholedisk = is_whole_disk(path);
if (!wholedisk && (stat64(path, &statbuf) != 0)) {
(void) fprintf(stderr,
gettext("cannot open '%s': %s\n"),
Expand Down
1 change: 1 addition & 0 deletions include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ typedef enum {
ZPOOL_PROP_LEAKED,
ZPOOL_PROP_MAXBLOCKSIZE,
ZPOOL_PROP_TNAME,
ZPOOL_PROP_WHOLE_DISK,
ZPOOL_NUM_PROPS
} zpool_prop_t;

Expand Down
13 changes: 13 additions & 0 deletions man/man8/zpool.8
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,19 @@ Information about unsupported features that are enabled on the pool. See
Amount of storage space used within the pool.
.RE

.sp
.ne 2
.mk
.na
\fB\fBwhole_disk\fR\fR
.ad
.RS 20n
.rt
Do not partition the device(s) used to create the pool with. Normally, \fBzpool create\fR uses a GPT partition table on the device(s) and creates two partitions. One for the data and one small, about 9MB, which is used as a 'buffer' in case the device needs to be replaced and it's replaced with a smaller one.
.sp
Can only be set at pool creation time.
.RE

.sp
.LP
The space usage properties report actual physical space available to the storage pool. The physical space can be different from the total amount of space that any contained datasets can actually use. The amount of space used in a \fBraidz\fR configuration depends on the characteristics of the data being written. In addition, \fBZFS\fR reserves some space for internal accounting that the \fBzfs\fR(8) command takes into account, but the \fBzpool\fR command does not. For non-full pools of a reasonable size, these effects should be invisible. For small pools, or pools that are close to being completely full, these discrepancies may become more noticeable.
Expand Down
3 changes: 3 additions & 0 deletions module/zcommon/zpool_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ zpool_prop_init(void)
PROP_DEFAULT, ZFS_TYPE_POOL, "on | off", "EXPAND", boolean_table);
zprop_register_index(ZPOOL_PROP_READONLY, "readonly", 0,
PROP_DEFAULT, ZFS_TYPE_POOL, "on | off", "RDONLY", boolean_table);
zprop_register_index(ZPOOL_PROP_WHOLE_DISK, "whole_disk", 1,
PROP_DEFAULT, ZFS_TYPE_POOL, "on | off", "WHOLEDISK",
boolean_table);

/* default index properties */
zprop_register_index(ZPOOL_PROP_FAILUREMODE, "failmode",
Expand Down

0 comments on commit bb82544

Please sign in to comment.