tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: altroot



> Whats the point of /altroot?

I don't know what the intent was/is.  Personally, I use it mostly as a
staging-ground for installing new builds when there is, or I think
there might be, an incompatibility that prevents build.sh install=/
from working.  (I then reboot single-user and copy from /altroot over /
either by using statically-linked tools or by booting from elsewhere
and mounting the affected partition as data.)

> hier(7) says "Alternate root file system, in case of disaster."  Is
> there a way to boot such that / is not inode 2, but that of altroot?

Not that I know of, though possibly there should be.

In my 1.4T, I added RB_CHROOT (and, for four ports - alpha, i386,
sparc, and sun3 - support for setting it when booting).  When set, it
prompts for a directory within what would otherwise be /, replacing
rootvnode, thus chrooting the whole system.  However, I found I used it
so little I never bothered reimplementing it under any other version
and never bothered writing the boot support for any other ports.

It would be of limited use for repairing broken systems in any case,
though, because the broken install isn't accessible when chrooted to
/altroot.  You'd have to do dangerous things like double-mounting the
root filesystem, leaving the subtree the system is running from
untouched while writing to the rest to repair it.  This works only for
filesystems which don't modify (eg move) data not conceptually being
written to, so the repair writes don't upset the system running from
/altroot (FFS mostly[%] satisfies this; I don't know what others do),
and in my experience often[$] requires creating another partition
naming the same piece of disk, since it really doesn't like mounting
the same partition multiple times (a sane check, usually).

[%] I think FFS can fail this criterion under a few circumstances, none
of which would be relevant to such repair efforts; the only ones I can
think of involve writes to directories leading to moving otherwise
unaffected directory entries.

[$] Not always; for example, on i386 or amd64, a and c often begin at
the same place, with c bigger, so if a is mounted read-only you can
mount c read/write for this kind of trick.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index