5.x separate /boot slice?

Garance A Drosehn gad at FreeBSD.org
Fri Aug 5 19:43:54 GMT 2005

While this is a reply to a private message, I'm also sending it
back to freebsd-questions.  I would rather not spend this much
time writing up information for a general topic, and then send
it to just one person...

Given how often this topic comes up, my hope is that other users
might find these notes somewhat helpful.  You had several good
questions that are probably of general interest.

At 2:42 PM +0300 8/5/05, Michael Dexter wrote:
>>At 12:56 AM +0300 8/5/05, Michael Dexter wrote:
>>>>>  I would like to try a separate /boot slice as permitted
>>>>>by FreeBSD 5.x...
>>I missed the beginning of this thread.  Where did you get the
>>impression that FreeBSD will work if you create /boot as a
>>separate partition?

Ah.  That page is basically correct, as far as it goes, but I
think you're drawing the wrong conclusion from it...  5.x did
switch to moving most boot-related files into /boot, and that
does make it easier to sync boot-files between different
partitions.  But the page doesn't actually say that /boot is
a separate partition.  And indeed, it won't work if you try
to make /boot a separate partition from '/'.

>>I do exactly what you'd like to do, but the partition I
>>duplicate is '/'.
>Are you sharing /var and /tmp between the current and
>updated systems?

Well, yes.  Although I guess what I do is more like the opposite
of what you do.  I create a backup of the active system, and
then install into that active system.  So, I only need my /xRoot
(backup) if something goes wrong.  I am a FreeBSD developer,
and I am both tracking the cutting-edge branch (-current) and
writing my own little changes.  So, I'm more likely to see
something go wrong than most people are...

In any case, I'm not sure the install process will support what
you would want to do (if you tried doing what I do...).  You
can't say "install part of this build into /xRoot, and other
parts into /usr", and you can't mount /usr onto two different
places at the same time.  (so you couldn't mount it as /usr
and /xRoot/usr).

>>I have a '/' partition and a '/xRoot' partition, and I
>>use FreeBSD's snapshot feature (in 5.x and better) to
>>duplicate that partition into /xRoot.
>I was planning for a fresh install but seemingly rsync
>would give a similar effect. Why snapshots in this case?

Snapshots just give you a consistent snapshot of the active
partition, and then you can use whatever tool you want to copy
data from that snapshot to the backup partition.  The important
benefit of the snapshot is that it gives you a consistent,
frozen-in-time picture of what the partition was, even though
files on the real partition are constantly changing.

I use dump/restore to copy everything.  I suppose you could
use rsync too, although I don't know how well that would do
with everything in /dev.

>Snapshots do interest me for other reasons and might you be
>able to refer me to more about them? I only see the mksnap_ffs
>man page. Presumably it can rollback in some way?

No, no rollback.  That *could* be implemented, but no one has
done it yet.  (I talked to Kirk about it once, and at one time
I even had a student who claimed they would work on it for me,
but so far nothing's happened...).  I think there's a writeup
somewhere on making/using snapshots.  I'll see if I can
remember where it is.

Since there is no rollback, I use dump/restore to duplicate
the snapshot on some other partition.  I can then use *that*
partition to boot up the system, if I need to.

>>This gives me a nice backup of /boot, /root, and /etc.
>How are you handling /usr?

I don't.  If I can boot up a known-good backup kernel, and I have
a known-good /bin and /sbin to match it, then I've been able to
dig myself out of most troubles that I get myself into.  YMMV.

Er, by "I don't", I mean I rarely make a special backup of it
before installing.  But if I *do* have to boot into using the
backup copy of '/', then that will mount the same /usr which the
standard '/' would use.  So, I'll have the "updated" /usr, along
with the "back-level" '/', '/sbin', '/bin'.  This can get you
into trouble if you don't know what you're doing.  But it is a
much better starting point than if you didn't have any bootable
backup partition at all...

>>I then upgrade the running system.  It
>>seems to work fine for me.
>Thus giving you a system to roll back to if things go wrong?


>How are you choosing between the roots? nextboot? The

I type commands into the boot loader. Note that I'm not doing
remote-installs, so I'm able to type at the console when the
system boots up.

>>The one trick involved is that you duplicate '/' to '/xRoot',
>>and then you have to remember to change '/xRoot/etc/fstab' so
>>that it points to itself as the '/' partition...  I do that
>>in a script, so that change is handled automatically...
>That answers one of my questions above. As I prefaced, there
>are many things to keep track of to make this work.
>Considering the big picture... do you feel you've eliminated
>the risks involved with updating over ssh?

No.  I don't do remote installs.  I'm just trying to deal with
the dangers of constantly running the -current branch.  And
strange as it may seem, I have occasionally written my own
kernel changes which have had a few bugs in them...

>In my research the recently introduced /boot
>directory/partition may provide some help.

I do not think it will help you with what you're hoping for.
/boot is a separate directory now (and that *is* a good change)
but it will not work as a separate partition.

>On that note, have you ever tried binary updates?

No.  I'm a systems-programmer, so I do want to do all my own
builds, so I can try my own coding-changes, etc.

Garance Alistair Drosehn     =      gad at gilead.netel.rpi.edu
Senior Systems Programmer               or   gad at FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA

More information about the freebsd-questions mailing list