xref: /freebsd/sys/contrib/openzfs/man/man8/zfs-unjail.8 (revision 8ccc0d235c226d84112561d453c49904398d085c)
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 November 4, 2025
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
56The
57.Nm
58functionality can be used to assign a dataset onto a running
59.Fx
60system
61.Xr jail 4 ,
62allowing
63.Xr zfs 8
64management utilities to be run inside of the
65.Xr jail 4 .
66.Pp
67To allow management of the dataset from within a jail, the
68.Sy jailed
69property should be set and the required
70.Xr devfs.conf 5
71entries to expose
72.Pa /dev/zfs
73device within the jail must be present.
74The
75.Sy quota
76property cannot be changed from within a jail.
77.Pp
78To use this functionality, the jail needs the
79.Sy allow.mount
80and
81.Sy allow.mount.zfs
82parameters set to
83.Sy 1
84and the
85.Sy enforce_statfs
86parameter set to a value lower than
87.Sy 2 .
88.Pp
89The subcommands are as follows:
90.Bl -tag -width indent
91.It Xo
92.Cm jail
93.Ar jailid Ns | Ns Ar jailname
94.Ar filesystem
95.Xc
96Attach the specified
97.Ar filesystem
98to the jail identified by JID
99.Ar jailid
100or name
101.Ar jailname .
102From now on this file system tree can be managed from within a jail if the
103.Sy jailed
104property has been set.
105.Pp
106You cannot attach a jailed dataset's children to another jail.
107You can also not attach the root file system
108of the jail or any dataset which needs to be mounted before the zfs rc script
109is run inside the jail, as it would be attached unmounted until it is
110mounted from the rc script inside the jail.
111.Pp
112After a dataset is attached to a jail and the
113.Sy jailed
114property is set, a jailed file system cannot be mounted outside the jail,
115since the jail administrator might have set the mount point to an unacceptable
116value.
117.It Xo
118.Cm unjail
119.Ar jailid Ns | Ns Ar jailname
120.Ar filesystem
121.Xc
122Detaches the specified
123.Ar filesystem
124from the jail identified by JID
125.Ar jailid
126or name
127.Ar jailname .
128.El
129.Sh SEE ALSO
130.Xr devfs.conf 5 ,
131.Xr zfsprops 7 ,
132.Xr jail 8
133.Sh CAVEATS
134The root directory of jail can not be delegated to the jail with this
135utility because the jail must be running with a valid root directory.
136.Pp
137Jails are a
138.Fx
139feature and are not relevant on other platforms.
140See
141.Xr jail 8
142for more information on managing jails, or
143.Xr zfs-zone 8
144for the equivelant functionality on Linux.
145