1.\" SPDX-License-Identifier: CDDL-1.0 2.\" 3.\" CDDL HEADER START 4.\" 5.\" The contents of this file are subject to the terms of the 6.\" Common Development and Distribution License (the "License"). 7.\" You may not use this file except in compliance with the License. 8.\" 9.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10.\" or https://opensource.org/licenses/CDDL-1.0. 11.\" See the License for the specific language governing permissions 12.\" and limitations under the License. 13.\" 14.\" When distributing Covered Code, include this CDDL HEADER in each 15.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16.\" If applicable, add the following below this CDDL HEADER, with the 17.\" fields enclosed by brackets "[]" replaced with your own identifying 18.\" information: Portions Copyright [yyyy] [name of copyright owner] 19.\" 20.\" CDDL HEADER END 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) 2011, Pawel Jakub Dawidek <pjd@FreeBSD.org> 26.\" Copyright (c) 2012, Glen Barber <gjb@FreeBSD.org> 27.\" Copyright (c) 2012, Bryan Drewery <bdrewery@FreeBSD.org> 28.\" Copyright (c) 2013, Steven Hartland <smh@FreeBSD.org> 29.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. 30.\" Copyright (c) 2014, Joyent, Inc. All rights reserved. 31.\" Copyright (c) 2014 by Adam Stevko. All rights reserved. 32.\" Copyright (c) 2014 Integros [integros.com] 33.\" Copyright (c) 2014, Xin LI <delphij@FreeBSD.org> 34.\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved. 35.\" Copyright (c) 2016 Nexenta Systems, Inc. All Rights Reserved. 36.\" Copyright 2019 Richard Laager. All rights reserved. 37.\" Copyright 2018 Nexenta Systems, Inc. 38.\" Copyright 2019 Joyent, Inc. 39.\" Copyright 2021 Klara, Inc. 40.\" 41.Dd June 3, 2022 42.Dt ZFS-ZONE 8 43.Os 44. 45.Sh NAME 46.Nm zfs-zone , 47.Nm zfs-unzone 48.Nd attach and detach ZFS filesystems to user namespaces 49.Sh SYNOPSIS 50.Nm zfs Cm zone 51.Ar nsfile 52.Ar filesystem 53.Nm zfs Cm unzone 54.Ar nsfile 55.Ar filesystem 56. 57.Sh DESCRIPTION 58.Bl -tag -width "" 59.It Xo 60.Nm zfs 61.Cm zone 62.Ar nsfile 63.Ar filesystem 64.Xc 65Attach the specified 66.Ar filesystem 67to the user namespace identified by 68.Ar nsfile . 69From now on this file system tree can be managed from within a user namespace 70if the 71.Sy zoned 72property has been set. 73.Pp 74You cannot attach a zoned dataset's children to another user namespace. 75You can also not attach the root file system 76of the user namespace or any dataset 77which needs to be mounted before the zfs service 78is run inside the user namespace, 79as it would be attached unmounted until it is 80mounted from the service inside the user namespace. 81.Pp 82To allow management of the dataset from within a user namespace, the 83.Sy zoned 84property has to be set and the user namespaces needs access to the 85.Pa /dev/zfs 86device. 87The 88.Sy quota 89property cannot be changed from within a user namespace. 90.Pp 91After a dataset is attached to a user namespace and the 92.Sy zoned 93property is set, 94a zoned file system cannot be mounted outside the user namespace, 95since the user namespace administrator might have set the mount point 96to an unacceptable value. 97.It Xo 98.Nm zfs 99.Cm unzone 100.Ar nsfile 101.Ar filesystem 102.Xc 103Detach the specified 104.Ar filesystem 105from the user namespace identified by 106.Ar nsfile . 107.El 108.Sh EXAMPLES 109.Ss Example 1 : No Delegating a Dataset to a User Namespace 110The following example delegates the 111.Ar tank/users 112dataset to a user namespace identified by user namespace file 113.Pa /proc/1234/ns/user . 114.Dl # Nm zfs Cm zone Ar /proc/1234/ns/user Ar tank/users 115. 116.Sh SEE ALSO 117.Xr zfsprops 7 118