Files
mirror_zfs/man/man8/zfs-jail.8
T

145 lines
4.1 KiB
Plaintext
Raw Normal View History

2025-01-04 11:04:27 +11:00
.\" SPDX-License-Identifier: CDDL-1.0
2019-12-11 11:58:37 -08:00
.\"
.\" CDDL HEADER START
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2022-07-11 23:16:13 +02:00
.\" or https://opensource.org/licenses/CDDL-1.0.
2019-12-11 11:58:37 -08:00
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" CDDL HEADER END
.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
.\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd@FreeBSD.org>
.\" Copyright (c) 2012, Glen Barber <gjb@FreeBSD.org>
.\" Copyright (c) 2012, Bryan Drewery <bdrewery@FreeBSD.org>
.\" Copyright (c) 2013, Steven Hartland <smh@FreeBSD.org>
.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
.\" Copyright (c) 2014 by Adam Stevko. All rights reserved.
.\" Copyright (c) 2014 Integros [integros.com]
.\" Copyright (c) 2014, Xin LI <delphij@FreeBSD.org>
.\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved.
.\" Copyright (c) 2016 Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright 2019 Richard Laager. All rights reserved.
.\" Copyright 2018 Nexenta Systems, Inc.
.\" Copyright 2019 Joyent, Inc.
.\"
.Dd November 4, 2025
2019-12-11 11:58:37 -08:00
.Dt ZFS-JAIL 8
2021-05-27 02:46:40 +02:00
.Os
.
2019-12-11 11:58:37 -08:00
.Sh NAME
.Nm zfs-jail
2021-05-27 02:46:40 +02:00
.Nd attach or detach ZFS filesystem from FreeBSD jail
2019-12-11 11:58:37 -08:00
.Sh SYNOPSIS
2021-05-27 02:46:40 +02:00
.Nm zfs Cm jail
.Ar jailid Ns | Ns Ar jailname
.Ar filesystem
.Nm zfs Cm unjail
.Ar jailid Ns | Ns Ar jailname
.Ar filesystem
.
2019-12-11 11:58:37 -08:00
.Sh DESCRIPTION
The
.Nm
functionality can be used to assign a dataset onto a running
.Fx
system
.Xr jail 4 ,
allowing
.Xr zfs 8
management utilities to be run inside of the
.Xr jail 4 .
.Pp
To allow management of the dataset from within a jail, the
.Sy jailed
property should be set and the required
.Xr devfs.conf 5
entries to expose
.Pa /dev/zfs
device within the jail must be present.
The
.Sy quota
property cannot be changed from within a jail.
.Pp
To use this functionality, the jail needs the
.Sy allow.mount
and
.Sy allow.mount.zfs
parameters set to
.Sy 1
and the
.Sy enforce_statfs
parameter set to a value lower than
.Sy 2 .
.Pp
The subcommands are as follows:
.Bl -tag -width indent
2019-12-11 11:58:37 -08:00
.It Xo
.Cm jail
2021-05-27 02:46:40 +02:00
.Ar jailid Ns | Ns Ar jailname
.Ar filesystem
2019-12-11 11:58:37 -08:00
.Xc
2021-05-27 02:46:40 +02:00
Attach the specified
2019-12-11 11:58:37 -08:00
.Ar filesystem
to the jail identified by JID
2021-05-27 02:46:40 +02:00
.Ar jailid
or name
.Ar jailname .
2019-12-11 11:58:37 -08:00
From now on this file system tree can be managed from within a jail if the
.Sy jailed
2021-05-27 02:46:40 +02:00
property has been set.
.Pp
You cannot attach a jailed dataset's children to another jail.
You can also not attach the root file system
of the jail or any dataset which needs to be mounted before the zfs rc script
is run inside the jail, as it would be attached unmounted until it is
mounted from the rc script inside the jail.
.Pp
After a dataset is attached to a jail and the
.Sy jailed
property is set, a jailed file system cannot be mounted outside the jail,
2022-11-12 22:23:30 +10:00
since the jail administrator might have set the mount point to an unacceptable
value.
2019-12-11 11:58:37 -08:00
.It Xo
.Cm unjail
2021-05-27 02:46:40 +02:00
.Ar jailid Ns | Ns Ar jailname
.Ar filesystem
2019-12-11 11:58:37 -08:00
.Xc
Detaches the specified
.Ar filesystem
from the jail identified by JID
2021-05-27 02:46:40 +02:00
.Ar jailid
or name
.Ar jailname .
2019-12-11 11:58:37 -08:00
.El
.Sh SEE ALSO
.Xr devfs.conf 5 ,
.Xr zfsprops 7 ,
.Xr jail 8
.Sh CAVEATS
The root directory of jail can not be delegated to the jail with this
utility because the jail must be running with a valid root directory.
.Pp
Jails are a
.Fx
feature and are not relevant on other platforms.
See
.Xr jail 8
for more information on managing jails, or
.Xr zfs-zone 8
for the equivelant functionality on Linux.