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