Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jan 2001 18:56:31 +1030
From:      Greg Lehey <grog@lemis.com>
To:        Randy Primeaux <randy@Cloudfactory.ORG>
Cc:        Tony Landells <ahl@austclear.com.au>, freebsd-questions@FreeBSD.ORG
Subject:   Re: installing onto vinum
Message-ID:  <20010131185631.L64451@wantadilla.lemis.com>
In-Reply-To: <200101310825.AAA17134@relay.ultimanet.com>; from randy@Cloudfactory.ORG on Tue, Jan 30, 2001 at 11:42:39PM -0800
References:  <grog@lemis.com> <200101310825.AAA17134@relay.ultimanet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, 30 January 2001 at 23:42:39 -0800, Randy Primeaux wrote:
> Greg Lehey writes:
>> On Wednesday, 24 January 2001 at 16:27:21 +1100, Tony Landells wrote:
>>> I'm in the process of setting up a number of FreeBSD boxes and I'd
>>> like to have them all mirroring with vinum.
>>>
>>> What I can't work out is how to get vinum up and running with my
>>> mirrors for /var, /usr, etc. before I start installing packages.
>>>
>>> I've tried using the 2nd CD and doing the fdisk and disklabel from
>>> the command line, but while my fdisk seems to set the correct label
>>> on the disks (as shown by disklabel -r), I can't get it to update
>>> the "in core" data, which I think may then be upsetting vinum.
>>> Perhaps I just haven't done things in the right order...
>>>
>>> At the moment my best option seems to be to install on one disk,
>>> and then work through the boot disks for the other systems by
>>> installing them as a second disk, setting everything up and
>>> installing packages on it, then putting it back in the box it
>>> belongs to.
>>>
>>> There must be a better way.  I hope.
>>
>> The "better way" is obviously to make sysinstall (or its successor)
>> Vinum-aware.  In the meantime, however, you can do this:
>>
>> 1.  Create the root file system normally.
>> 2.  Next, create a swap partition *exactly* 265 (no, that's not a
>>     typo, 265, not 256) sectors larger than you want.
>> 3.  Create all following file systems normally.
>> 4.  Install FreeBSD.
>> 5.  When you have finished the install, reboot to single user mode and
>>     use disklabel -e to shrink the size of the swap partition by 265
>>     sectors.  Create a Vinum partition starting from the new end of
>>     the swap partition and going to the end of the drive, overlaying
>>     all the file system partitions.  After that you can go into
>>     multi-user mode if you want.
>> 6.  Carefully calculate the offsets and the lengths of the file
>>     systems.  Create a Vinum configuration file something like this:
>>
>>     drive root dev /dev/ad0s1d
>>     volume usr
>>      plex org concat
>>       sd length 256m driveoffset 265s
>>     volume home
>>      plex org concat
>>       sd length 8g driveoffset 524553s
>>
>>     The lengths and offsets need to be exact, of course.  The best way
>>     to get offset and length is from the last 8 lines of disklabel
>>     output.
>>
>> 7.  Change your /etc/fstab to look something like this:
>>
>>      Device                Mountpoint      FStype  Options         Dump    Pa
>> ss#
>>      /dev/ad0s1b           none            swap    sw              0       0
>>      /dev/ad0s1a           /               ufs     rw              1       1
>>      /dev/vinum/usr        /usr            ufs     rw              1       1
>>      /dev/vinum/home       /home           ufs     rw              1       1
>>      /dev/ad0s1e           /usr            ufs     rw,noauto       1       1
>>      /dev/ad0s1f           /home           ufs     rw,noauto       1       1
>>
>>     The duplicate allocations are deliberate in case there are
>>     problems.
>>
>> 8.  Create the Vinum objects ("vinum create configfile").  This
>>     doesn't change anything in the file systems, which can be mounted
>>     at the time.
>>
>> 9.  Check you did it right by doing 'fsck -n /dev/vinum/usr', etc.
>>     You will get some errors, which you can ignore.  They come from
>>     the fact that fsck will be reading from disk, while there's
>>     modified metadata in buffer cache.  What you don't want to see are
>>     messages saying it can't find the superblock, which would indicate
>>     that you miscalculated the offsets.
>>
>> 10. Reboot.  You should come up running from Vinum.  If you have
>>     trouble, mount the disk partitions instead.
>>
>> This method assumes you don't want swap under Vinum control.  If you
>> do, you'll need to move the swap partition 265 sectors further and
>> have the Vinum drive start immediately after the root file system.
>>
>> Let me know how this works; normally I try these things out, but today
>> I had a power supply catch fire and kill the memory on the test box I
>> would have used, and I won't have it fixed in time.
>
> I attempted to follow this process using the following on a pair of
> IBM DTLA-307045 (just setting up the first one).  I think I may have
> mis-calculated the offset or size field(s) in the new disklabel.
>
> ad4s1a /          256M
> ad4s1b swap   1048841
> ad4s1e /var       256M
> ad4s1f /usr         4G
> ad4s1g /home 79574302
>
> I attempted to use `disklabel -e ad4s1` to modify the disklabel as
> such:
>
> 8 partitions:
> #        size   offset    fstype   [fsize bsize bps/cpg]
>   a:   524288        0    4.2BSD     1024  8192    16
>   b:  1048576   524288      swap
>   c: 90060327        0    unused        0     0
>   d: 88487463  1572864     vinum

These labels have nothing much to do with each other.  Did you try to
delete the e, f and g partitions?  You can't do that when they're
mounted, or you'll get an error message "ioctl DIOCWDINFO: open
partition would move or shrink".  More importantly, you would lose the
data.

> I got an error at this point:
> disklabel: ioctl DIOCWDINFO: open partition would move or shrink

Good Thing too :-)

> I continued to follow the list, not realizing that the new disklabel
> had not been written.
>
> I got a second set of errors in vinum, which i did not capture.

Not worth the trouble, you need to go back and start again.

> How do I obtain correct calculations for the new disklabel?

Judging by what you've shown, you don't want to include swap in your
Vinum volume.	In that case, you need to look at the 265 sectors and
carve them off the swap partition:

Now:

   b:  1048576   524288      swap
   d: 88487463  1572864     vinum

After:

   b:  1048311   524288      swap
   d:  7433728  1572599     vinum

I've changed the size as well to ensure that it doesn't go off the end
of the disk.  The size + offset for c and d should add up to the same
thing.

The only other thing you need to do is not to remove the other
partitions.  They can overlap, disklabel is too stupid to notice.

Greg
--
When replying to this message, please copy the original recipients.
If you don't, I may ignore the reply.
For more information, see http://www.lemis.com/questions.html
Finger grog@lemis.com for PGP public key
See complete headers for address and phone numbers


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010131185631.L64451>