1.\" 2.\" CDDL HEADER START 3.\" 4.\" The contents of this file are subject to the terms of the 5.\" Common Development and Distribution License (the "License"). 6.\" You may not use this file except in compliance with the License. 7.\" 8.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9.\" or http://www.opensolaris.org/os/licensing. 10.\" See the License for the specific language governing permissions 11.\" and limitations under the License. 12.\" 13.\" When distributing Covered Code, include this CDDL HEADER in each 14.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15.\" If applicable, add the following below this CDDL HEADER, with the 16.\" fields enclosed by brackets "[]" replaced with your own identifying 17.\" information: Portions Copyright [yyyy] [name of copyright owner] 18.\" 19.\" CDDL HEADER END 20.\" 21.\" 22.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved. 23.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org> 24.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved. 25.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. 26.\" Copyright (c) 2014, Joyent, Inc. All rights reserved. 27.\" Copyright (c) 2014 by Adam Stevko. All rights reserved. 28.\" Copyright (c) 2014 Integros [integros.com] 29.\" Copyright 2019 Richard Laager. All rights reserved. 30.\" Copyright 2018 Nexenta Systems, Inc. 31.\" Copyright 2019 Joyent, Inc. 32.\" 33.Dd June 30, 2019 34.Dt ZFS-CREATE 8 35.Os 36.Sh NAME 37.Nm zfs Ns Pf - Cm create 38.Nd Creates a new ZFS file system. 39.Sh SYNOPSIS 40.Nm zfs 41.Cm create 42.Op Fl Pnpv 43.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... 44.Ar filesystem 45.Nm 46.Cm create 47.Op Fl ps 48.Op Fl b Ar blocksize 49.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... 50.Fl V Ar size Ar volume 51.Sh DESCRIPTION 52.Bl -tag -width "" 53.It Xo 54.Nm 55.Cm create 56.Op Fl Pnpv 57.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... 58.Ar filesystem 59.Xc 60Creates a new ZFS file system. 61The file system is automatically mounted according to the 62.Sy mountpoint 63property inherited from the parent. 64.Bl -tag -width "-o" 65.It Fl o Ar property Ns = Ns Ar value 66Sets the specified property as if the command 67.Nm zfs Cm set Ar property Ns = Ns Ar value 68was invoked at the same time the dataset was created. 69Any editable ZFS property can also be set at creation time. 70Multiple 71.Fl o 72options can be specified. 73An error results if the same property is specified in multiple 74.Fl o 75options. 76.It Fl p 77Creates all the non-existing parent datasets. 78Datasets created in this manner are automatically mounted according to the 79.Sy mountpoint 80property inherited from their parent. 81Any property specified on the command line using the 82.Fl o 83option is ignored. 84If the target filesystem already exists, the operation completes successfully. 85.It Fl n 86Do a dry-run 87.Pq Qq No-op 88creation. 89No datasets will be created. 90This is useful in conjunction with the 91.Fl v 92or 93.Fl P 94flags to validate properties that are passed via 95.Fl o 96options and those implied by other options. 97The actual dataset creation can still fail due to insufficient privileges or 98available capacity. 99.It Fl P 100Print machine-parsable verbose information about the created dataset. 101Each line of output contains a key and one or two values, all separated by tabs. 102The 103.Sy create_ancestors 104and 105.Sy create 106keys have 107.Em filesystem 108as their only value. 109The 110.Sy create_ancestors 111key only appears if the 112.Fl p 113option is used. 114The 115.Sy property 116key has two values, a property name that property's value. 117The 118.Sy property 119key may appear zero or more times, once for each property that will be set local 120to 121.Em filesystem 122due to the use of the 123.Fl o 124option. 125.It Fl v 126Print verbose information about the created dataset. 127.El 128.It Xo 129.Nm 130.Cm create 131.Op Fl ps 132.Op Fl b Ar blocksize 133.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... 134.Fl V Ar size Ar volume 135.Xc 136Creates a volume of the given size. 137The volume is exported as a block device in 138.Pa /dev/zvol/path , 139where 140.Em path 141is the name of the volume in the ZFS namespace. 142The size represents the logical size as exported by the device. 143By default, a reservation of equal size is created. 144.Pp 145.Ar size 146is automatically rounded up to the nearest multiple of the 147.Sy blocksize . 148.Bl -tag -width "-b" 149.It Fl b Ar blocksize 150Equivalent to 151.Fl o Sy volblocksize Ns = Ns Ar blocksize . 152If this option is specified in conjunction with 153.Fl o Sy volblocksize , 154the resulting behavior is undefined. 155.It Fl o Ar property Ns = Ns Ar value 156Sets the specified property as if the 157.Nm zfs Cm set Ar property Ns = Ns Ar value 158command was invoked at the same time the dataset was created. 159Any editable ZFS property can also be set at creation time. 160Multiple 161.Fl o 162options can be specified. 163An error results if the same property is specified in multiple 164.Fl o 165options. 166.It Fl p 167Creates all the non-existing parent datasets. 168Datasets created in this manner are automatically mounted according to the 169.Sy mountpoint 170property inherited from their parent. 171Any property specified on the command line using the 172.Fl o 173option is ignored. 174If the target filesystem already exists, the operation completes successfully. 175.It Fl s 176Creates a sparse volume with no reservation. 177See 178.Sy volsize 179in the 180.Em Native Properties 181section of 182.Xr zfsprops 8 183for more information about sparse volumes. 184.It Fl n 185Do a dry-run 186.Pq Qq No-op 187creation. 188No datasets will be created. 189This is useful in conjunction with the 190.Fl v 191or 192.Fl P 193flags to validate properties that are passed via 194.Fl o 195options and those implied by other options. 196The actual dataset creation can still fail due to insufficient privileges or 197available capacity. 198.It Fl P 199Print machine-parsable verbose information about the created dataset. 200Each line of output contains a key and one or two values, all separated by tabs. 201The 202.Sy create_ancestors 203and 204.Sy create 205keys have 206.Em volume 207as their only value. 208The 209.Sy create_ancestors 210key only appears if the 211.Fl p 212option is used. 213The 214.Sy property 215key has two values, a property name that property's value. 216The 217.Sy property 218key may appear zero or more times, once for each property that will be set local 219to 220.Em volume 221due to the use of the 222.Fl b 223or 224.Fl o 225options, as well as 226.Sy refreservation 227if the volume is not sparse. 228.It Fl v 229Print verbose information about the created dataset. 230.El 231.El 232.Ss ZFS Volumes as Swap 233ZFS volumes may be used as swap devices. After creating the volume with the 234.Nm zfs Cm create Fl V 235command set up and enable the swap area using the 236.Xr mkswap 8 237and 238.Xr swapon 8 239commands. Do not swap to a file on a ZFS file system. A ZFS swap file 240configuration is not supported. 241.Sh SEE ALSO 242.Xr zfs-destroy 8 , 243.Xr zfs-list 8 , 244.Xr zpool-create 8 245