Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove zpool altroot when creating datasets. #1018

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/share/poudriere/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ get_data_dir() {
# Explicitly set properties for values diverging from top dataset
zfs create -p -o atime=off \
-o compression=on \
-o mountpoint=${BASEFS} \
-o mountpoint="$(remove_altroot ${BASEFS})" \
${ZPOOL}${ZROOTFS}
zfs create ${ZPOOL}${ZROOTFS}/jails
zfs create ${ZPOOL}${ZROOTFS}/ports
Expand Down
14 changes: 12 additions & 2 deletions src/share/poudriere/include/fs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.

remove_altroot() {
[ $# -ne 1 ] && eargs remove_altroot mountpoint
local mountpoint altroot
mountpoint="$1"
altroot=
[ -n "${NO_ZFS}" ] || altroot=$(zpool get -Ho value altroot "${ZPOOL}")

echo "${mountpoint}" | sed "s,^${altroot},,"
}

createfs() {
[ $# -ne 3 ] && eargs createfs name mnt fs
local name mnt fs
Expand All @@ -37,7 +47,7 @@ createfs() {
if ! zfs create -p \
-o compression=on \
-o atime=off \
-o mountpoint=${mnt} ${fs}; then
-o mountpoint="$(remove_altroot ${mnt})" ${fs}; then
echo " fail"
err 1 "Failed to create FS ${fs}"
fi
Expand Down Expand Up @@ -294,7 +304,7 @@ clonefs() {
zfs_to=${fs}/${name}
fi

zfs clone -o mountpoint=${mnt} \
zfs clone -o mountpoint="$(remove_altroot ${mnt})" \
-o sync=disabled \
-o atime=off \
-o compression=off \
Expand Down