On 2013-02-09 12:44, Sašo Kiselkov wrote:
On 02/09/2013 02:52 AM, Jim Klimov wrote:
1) created dedicated dataset, i.e. rpool/export/home/root
    and transferred all contents of /root into it

2) created /root/.profile with this text:

# === /root/.profile
if [ x"$_SLASH_PROFILE" = x ]; then
     _SLASH_PROFILE=Y
     export _SLASH_PROFILE
     if [ -d /export/home/root ]; then
         HOME=/export/home/root
         cd $HOME
         export HOME
         /bin/test -s ./.profile && . ./.profile
     fi
     unset _SLASH_PROFILE
fi
# === /root/.profile

Thanks, and hope this trick helps others,

What's with all the black magic?

Why couldn't you simply do:

# mv /root /root-old
# zfs create -o mountpoint=/root rpool/export/home/root
# chmod 700 /root
# /usr/gnu/bin/cp -ar /root2/* /root/

In fact, no I could not (and you're inconsistent with root2
and root-old :) ). Here's why: there are cases where the OS
does use the nominal home for actual work - such as repairs
and other single-user works, as well as cases where the home
is on another pool and can't be mounted. As a result, the OS
will work with /root and place some files there, rendering
it an unviable mountpoint for ZFS auto-mounter for the actual
relocated home - at least as long as there is no analog for
"mount -O" enforcement via dataset properties to do overlay
mounts over non-empty directories. And failure of dataset
automounter leads to single-user mode and lack of service.

Workarounds are still possible, such as setting rootfs's /root
directory immutable, but I am not sure it would work under
Solaris - (almost certainly) not in sol10u8. Also, you might
indeed want some files to be in the "repair-time" root home,
such as some SSH keys or your bash aliases and history of
repair commands, etc.

//Jim Klimov


_______________________________________________
OpenIndiana-discuss mailing list
[email protected]
http://openindiana.org/mailman/listinfo/openindiana-discuss

Reply via email to