Skip to content

Commit

Permalink
Investigate mountopts
Browse files Browse the repository at this point in the history
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
  • Loading branch information
usaleem-ix committed Jun 9, 2024
1 parent f58cd6c commit ee3630f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
7 changes: 7 additions & 0 deletions cmd/mount_zfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;

verbose += 10;
printf("--> mount.zfs invoked\n");
printf(" number of args: %d\n", argc);
for (int i = 0; i < argc; ++i) {
printf(" arg %d: %s\n", i, argv[i]);
}

/* check that we only have two arguments */
if (argc != 2) {
if (argc == 0)
Expand Down
15 changes: 9 additions & 6 deletions contrib/initramfs/scripts/zfs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ mount_fs()

# Need the _original_ datasets mountpoint!
mountpoint=$(get_fs_value "$fs" mountpoint)
ZFS_CMD="mount -o zfsutil -t zfs"
ZFS_CMD="zfs mount"
ZFS_MTPT=""
if [ "$mountpoint" = "legacy" ] || [ "$mountpoint" = "none" ]; then
# Can't use the mountpoint property. Might be one of our
# clones. Check the 'org.zol:mountpoint' property set in
Expand All @@ -366,32 +367,34 @@ mount_fs()
fi
# Last hail-mary: Hope 'rootmnt' is set!
mountpoint=""
ZFS_MTPT="${rootmnt}/${mountpoint}"
else
mountpoint="$mountpoint1"
ZFS_MTPT="${rootmnt}/${mountpoint}"
fi
fi

# Possibly decrypt a filesystem using native encryption.
decrypt_fs "$fs"

[ "$quiet" != "y" ] && \
zfs_log_begin_msg "Mounting '${fs}' on '${rootmnt}/${mountpoint}'"
zfs_log_begin_msg "Mounting '${fs}' on '${ZFS_MTPT}'"
[ -n "${ZFS_DEBUG}" ] && \
zfs_log_begin_msg "CMD: '$ZFS_CMD ${fs} ${rootmnt}/${mountpoint}'"
zfs_log_begin_msg "CMD: '$ZFS_CMD ${fs} ${ZFS_MTPT}'"

ZFS_STDERR=$(${ZFS_CMD} "${fs}" "${rootmnt}/${mountpoint}" 2>&1)
ZFS_STDERR=$(${ZFS_CMD} "${fs}" "${ZFS_MTPT}" 2>&1)
ZFS_ERROR=$?
if [ "${ZFS_ERROR}" != 0 ]
then
[ "$quiet" != "y" ] && zfs_log_failure_msg "${ZFS_ERROR}"

disable_plymouth
echo ""
echo "Command: ${ZFS_CMD} ${fs} ${rootmnt}/${mountpoint}"
echo "Command: ${ZFS_CMD} ${fs} ${ZFS_MTPT}"
echo "Message: $ZFS_STDERR"
echo "Error: $ZFS_ERROR"
echo ""
echo "Failed to mount ${fs} on ${rootmnt}/${mountpoint}."
echo "Failed to mount ${fs} on ${ZFS_MTPT}."
echo "Manually mount the filesystem and exit."
shell
else
Expand Down

0 comments on commit ee3630f

Please sign in to comment.