xref: /freebsd/sys/contrib/openzfs/man/man8/zfs-jail.8 (revision 7cc42f6d)
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) 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.\"
40.Dd December 9, 2019
41.Dt ZFS-JAIL 8
42.Os FreeBSD
43.Sh NAME
44.Nm zfs Ns Pf - Cm jail
45.Nd Attaches and detaches ZFS filesystems from FreeBSD jails.
46.No A Tn ZFS
47dataset can be attached to a jail by using the
48.Qq Nm Cm jail
49subcommand. You cannot attach a dataset to one jail and the children of the
50same dataset to another jail. You can also not attach the root file system
51of the jail or any dataset which needs to be mounted before the zfs rc script
52is run inside the jail, as it would be attached unmounted until it is
53mounted from the rc script inside the jail. To allow management of the
54dataset from within a jail, the
55.Sy jailed
56property has to be set and the jail needs access to the
57.Pa /dev/zfs
58device. The
59.Sy quota
60property cannot be changed from within a jail. See
61.Xr jail 8
62for information on how to allow mounting
63.Tn ZFS
64datasets from within a jail.
65.Pp
66.No A Tn ZFS
67dataset can be detached from a jail using the
68.Qq Nm Cm unjail
69subcommand.
70.Pp
71After a dataset is attached to a jail and the jailed property is set, a jailed
72file system cannot be mounted outside the jail, since the jail administrator
73might have set the mount point to an unacceptable value.
74.Sh SYNOPSIS
75.Nm
76.Cm jail
77.Ar jailid Ns | Ns Ar jailname filesystem
78.Nm
79.Cm unjail
80.Ar jailid Ns | Ns Ar jailname filesystem
81.Sh DESCRIPTION
82.Bl -tag -width ""
83.It Xo
84.Nm
85.Cm jail
86.Ar jailid filesystem
87.Xc
88.Pp
89Attaches the specified
90.Ar filesystem
91to the jail identified by JID
92.Ar jailid .
93From now on this file system tree can be managed from within a jail if the
94.Sy jailed
95property has been set. To use this functuinality, the jail needs the
96.Va allow.mount
97and
98.Va allow.mount.zfs
99parameters set to 1 and the
100.Va enforce_statfs
101parameter set to a value lower than 2.
102.Pp
103See
104.Xr jail 8
105for more information on managing jails and configuring the parameters above.
106.It Xo
107.Nm
108.Cm unjail
109.Ar jailid filesystem
110.Xc
111.Pp
112Detaches the specified
113.Ar filesystem
114from the jail identified by JID
115.Ar jailid .
116.El
117.Sh SEE ALSO
118.Xr jail 8 ,
119.Xr zfsprops 8
120