[OpenIndiana-discuss] Relocated root home directory
Jim Klimov
jimklimov at cos.ru
Fri Feb 15 01:23:40 UTC 2013
On 2013-02-09 02:52, Jim Klimov wrote:
> Hello all,
>
> I found it not very convenient to have root's home directory
> as a part of rootfs - if I switch between different BEs, the
> homedir changes back and forth. It also consumes space in the
> snapshots, if a BE is cloned from a variant which had some
> junk in this path.
Okay, I also found the first solution proposed to the list unpopular,
and indeed it may be a bug or feature that it solves the problem for
interactive logins, while non-interactive (services, ssh, etc.) don't
use .profile and thus rely on a different set of config files.
As part of that discussion I elaborated on another idea, which I can
present here for likers and haters: mount the dedicated dataset over
the /root/ path, in a manner that should be resilient to non-empty
mountpoint and transparent to interactive and non-interactive use:
:; zfs create -o compression=gzip-9 rpool/export/home/root
:; chmod 700 /export/home/root
:; rsync -avPHK /root/ /export/home/root/ || cp -prf /root/ /export/home
:; zfs set mountpoint=legacy rpool/export/home/root
:; grep 'rpool/export/home/root' /etc/vfstab || \
echo 'rpool/export/home/root - /root zfs - yes -O' >> /etc/vfstab
:; mount /root
:; df -k /root
The idea here is to automate mounting with allowed overlaying of
non-empty directories. Testing showed however, that some system
services (scsi/initiator and rpc/bind on my testbed) use root's
homedir as their current and this disallows mounting unless I
force it on command-line as
:; mount -O /root
I am not sure how that would go into /etc/vfstab - as double-O?
However, upon reboot (or svcadm disable XXX; mount; enable) all
is proper and fine.
Also note that while this overlay hides the original contents of
/root (as part of rootfs), you can still reach it via snapshots
of your rootfs (rpool/ROOT/$bename/.zfs/snapshots/$snapname/root).
Hope this helps someone,
//Jim Klimov
More information about the OpenIndiana-discuss
mailing list