Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Apr 2001 10:45:29 +0930
From:      Greg Lehey <grog@lemis.com>
To:        Michael Dosser <mic@t0.or.at>
Cc:        freebsd-isp@FreeBSD.ORG
Subject:   Re: vinum
Message-ID:  <20010421104529.B97904@wantadilla.lemis.com>
In-Reply-To: <Pine.BSF.4.21.0104210115170.51659-100000@chuck.t0.or.at>; from mic@t0.or.at on Sat, Apr 21, 2001 at 01:17:29AM %2B0200
References:  <3AE05058.28191.14F5EC5@localhost> <Pine.BSF.4.21.0104210115170.51659-100000@chuck.t0.or.at>

next in thread | previous in thread | raw e-mail | index | archive | help

--SLDf9lqlvOQaIe6s
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Saturday, 21 April 2001 at  1:17:29 +0200, Michael Dosser wrote:
> On Fri, 20 Apr 2001 danny@i-p-d.nl wrote:
>
>> I have been trying to setup vinum to mirror my first harddisk on a
>> second identical harddisk. I get the feeling that it is not possible to
>> mirror the first disk, as it is my FreeBSD bootdisk. Is that right?
>
> Don't know if somebody is interested in .. I made a small howto page for
> RAID-1 with vinum:
>
> http://org.netbase.org/vinum-mirrored.html

There are a number of errors in this page.  To even be able to read
it, I had to turn the colours off.  Are you colour blind?

I'm attaching a marked up version in HTML (exceptionally), since I
need to explain some things and why they're wrong.  You can also see
this page at http://www.lemis.com/grog/vinum-mirrored-corrected.html

Greg
--
Finger grog@lemis.com for PGP public key
See complete headers for address and phone numbers

--SLDf9lqlvOQaIe6s
Content-Type: text/html; charset=us-ascii
Content-Disposition: attachment; filename="vinum-mirrored-corrected.html"

<html>
<head>
<title>Vinum HOWTO for two mirrored disks</title>
</head>
<body>
&nbsp;
<center><h1><font color="#990000">Vinum HOWTO for two mirrored disks</font></h1></center><br>
<p>
<font color="#990000">Preface</font>
<p>
<a href="http://www.vinumvm.org">Vinum</a>; is a Logical Volume Manager for <a href="http://www.freebsd.org">FreeBSD</a>. It is able to do RAID-0, RAID-1 and RAID-5.

<font color=green>Also RAID-4, though this doesn't buy you anything.</font> This
document took a lot of information from a really good <a
href="http://www.jurai.net/~scanner/vinum-howto.html">HOWTO page</a> from
written by scanner at jurai dot net. Thanks to scanner and the freebsd-isp at
freebsd dot org mailing-list for information and documentation.  <p> <font
color="#990000">Foreword for RAID-1, mirrored disks</font>
<p>
Layout: one small disk for your FreeBSD system, which means for /. Two big disks
for your mirrored disks. Why this? You need to have one system disk because
FreeBSD connot boot off a vinum partition - it's like the chicken and the egg:
first you have to load the kernel in order to initialize the vinum mirrored
disks, so you cannot boot off vinum disks.

<font color=green>You can't find a disk small enough for a root partition and
swap only.  You'd be a whole lot better off putting swap on the second disk and
making it the same size as the root file system, leaving the rest of both disks
for a Vinum drive.</font>
<p>
O.k., so what now? I have written this document for a fresh installation of the
system. Please keep in mind, that partitioning can mean you destroy data. Take a
backup first. Well, let's start: First you have to install your system to the
FreeBSD system disk. Don't install ports and linux compatibility, because they
use lot's of space in /usr. You can do it afterwards with sysinstall.
<p>
<font color=green>It's easier to do it now.</font><p> <font
color="#990000">Fresh installation of FreeBSD</font>
<p>
Good, choose whatever install method you like (let's assume we've choosen
"Standard"). Partition your first disk (e.g. the FreeBSD System disk) and use
the entire disk by pressing "a" and write your data to disk by pressing
"w". Choosse the next disk and do the same and also for the last one. Then
install the bootmanager <strong>only</strong> for the first disk (your FreeBSD
system disk). After that you have to label your disk and put slices on it. For
the first disk take the following layout:
<p>
Part Mount Size<br>
da0s1a / [Nearly the full disk]<br>
da0s1b swap [The rest]
<p>
<font color=green>As mentioned above, put the swap on the second disk</font>
<p>
<font color="#990000">Installation and the mirrored disks</font>
<p>
For the two other disks make slices for the directories you want to mirror, like for example /usr and /var. Don't define these mountpoints here, but rather choose dummy mountpoints like /a or /b! Pay attention to create for each directory the same slices (e.g. da1s1e is 4000MB, and da2s1e is also 4000MB):
<p>
Part Mount Size:<br>
da1s1e /a [e.g.15000MB]<br>
da1s1f /b [e.g.5000MB]<br>
da2s1e /c [e.g.15000MB]<br>
da2s1f /d [e.g.5000MB]
<p>
<font color=green>It is wrong to make more than one Vinum drive per spindle.
Drop, say, <i>/dev/da1s1e</i> and <i>/dev/da1s2e</i> </font>
<p>
Install your FreeBSD system. Remember to keep your system as tiny as possible
(e.g. not to install ports, linux compatibitity etc.).
<p>
<font color="#990000">Vinum Configuration</font>
<p>
When the system is up we get into the vinum configuration. First of all comes
the disklabeling procedure. FreeBSD slices are labeled 4.2BSD which is not
suitable for vinum. Use the following command to change this:
<p>
# disklabel -e [name of the partition of the first to be mirrored partition, e.g. da1]
<p>
This is vi, you should know about how to use it. Change 4.2BSD to vinum (pay
attention: vinum should be written in small letters!)
<p>
Do the same for your second to be mirrored paritition.
<p>
The next step is to create a vinum configuration file. The name and its location
are irrelevant. I did it by creating it in /etc:
<p>
# vi /etc/vinum.conf
<p>
The layout I have choosen is very simple. This is an example, adjust it to your needs:<br>
I have /usr and /var choosen to be mirrored slices. The command "df" gives the following layout:
<p>
<pre>
/dev/da0s1a     49583    24678    20939    54%    /
/dev/da1s1e  14887091        1 14887090     0%    /a
/dev/da2s1e  14887091        1 14887090     0%    /b
/dev/da1s1f   4887091        1  4887090     0%    /c  
/dev/da2s1f   4887091        1  4887090     0%    /d
</pre>

<font color=green><p>
What you should have would look like:
<pre>
/dev/da0s1a     49583    24678    20939    54%    /
/dev/da1s1f  19772182        1 19772182     0%    /c  
/dev/da2s1f  19772182        1 19772182     0%    /d
</pre>
</font>
<p>
So my configuration file looks like that:
<p>
<pre>
drive drive1 device /dev/da1s1e
drive drive2 device /dev/da2s1e
 volume usr 
  plex org concat
    sd length 0 drive drive1
  plex org concat
    sd length 0 drive drive2
drive drive3 device /dev/da1s1f
drive drive4 device /dev/da2s1f
 volume var
  plex org concat
    sd length 0 drive drive3
  plex org concat
    sd length 0 drive drive4
</pre>

<font color=green>
Change that to:
<p>

<pre>
drive drive1 device /dev/da1s1f
drive drive2 device /dev/da2s1f
 volume usr 
  plex org concat
    sd length 14887091s drive drive1
  plex org concat
    sd length 14887091s drive drive2
 volume var
  plex org concat
    sd length 0 drive drive1
  plex org concat
    sd length 0 drive drive2
</pre></font>
<p>

<p>
The names drive1,2,3,4 are optional as the volume name is (usr, var). For me it
was easier that way, adjust it to your needs.<br> Then copy tar and vi to the
root file system, just to be sure if something goes wrong:
<p>
# cp /usr/bin/vi /bin/vi<br>
# cp /usr/bin/tar /bin/tar<br>
<p>
Then start the vinum program (man vinum for further information!)
<p>
# vinum     # This leads to the vinum prompt in the next line:<br>
vinum -> create -f [name of your configuration, in my case /etc/vinum.conf]
<p>
If you wish to see your configuration, type dumpconfig.

<p>
<font color=green>If you wish to see your configuration, type
 <tt><b>list</b></tt>.  <tt>dumpconfig</tt> is a utility to show what's really
 on the disk, and may not reflect the running configuration.  It's also
 difficult to read, and it doesn't show the names of the drives.</font>

<p>
If you want to discard your configuration, type resetconfig.
<p>
<font color=green>You should only use <tt>resetconfig</tt> in an emergency.  To
remove items from the configuration, use <tt>rm</tt>.</font>

<p>
If your configuration suits your needs, hit "control + d" to finish.
<p>
<font color=green>
After these operations, the configuration will not be correct.  It's possible
you'd miss it if you abuse <tt>dumpconfig</tt> to display the configuration, but
the subdisks <tt>usr.p1.s0</tt> and <tt>var.p1.s0</tt> will be in <tt>empty</tt>
state, and the plexes <tt>usr.p1</tt> and <tt>var.p1</tt> will be
<tt>faulty</tt>:

<p>
<pre>
2 volumes:
V usr                   State: up       Plexes:       2 Size:        921 MB
V var                   State: up       Plexes:       2 Size:       1092 MB

4 plexes:
P usr.p0              C State: up       Subdisks:     1 Size:        921 MB
P usr.p1              C State: faulty   Subdisks:     1 Size:        921 MB
P var.p0              C State: up       Subdisks:     1 Size:       1092 MB
P var.p1              C State: faulty   Subdisks:     1 Size:       1092 MB

4 subdisks:
S usr.p0.s0             State: up       PO:        0  B Size:        921 MB
S usr.p1.s0             State: empty    PO:        0  B Size:        921 MB
S var.p0.s0             State: up       PO:        0  B Size:       1092 MB
S var.p1.s0             State: empty    PO:        0  B Size:       1092 MB
</pre> 
<p>
To start them, use the <tt>init</tt> command.  Alternatively,
modify your configuration to:
<p>

<pre>
 volume usr <font color=red>setupstate</font>
  plex org concat
    sd length 14887091s drive drive1
  plex org concat
    sd length 14887091s drive drive2
</pre>
<p>
to indicate that any discrepancies in the content can be ignored, since you will
be doing a <tt>newfs</tt> on the volume.
</font><p>
After that newfs your slice with the following command:
<p>
# newfs -v /dev/vinum/[name name of your mirror, e.g. usr]<br>
<p>
Do this for all of your slices you have configured for vinum! (e.g. var, etc.)
<p>
Then mount your new vinum slices lets say to /mnt/[name of the slice you want to clone:
<p>
# mkdir /mnt/usr<br>
# mount /dev/vinum/usr /mnt/usr<br>
<p>
Do this for every slice you want to clone.
<p>
<font color="#990000">Copying your old directories to the vinum slices</font>
<p>
Then you have to copy the files in your old directory to the new slice:
<p>
# cd /<br>
# tar cfv usr.tar usr<br>
# mv usr.tar /mnt<br>
# tar xfv usr.tar
<p>
Do this for every slice you want to clone.
<p>
<font color="#990000">Edit /etc/fstab</font>
<p>
If this and the previous steps were successful, edit your fstab:
<p>
# vi /etc/fstab
<p>
Add the following line:
<p>
/dev/vinum/[name of your mirror, e.g. usr]      /[name of your mountpoint, e.g. /usr]           ufs     rw              2       2
<p>
Repeat these steps for all of your mirror sets, like /var etc.
<p>
<font color="#990000">Don't forget /etc/rc.conf!!</font>
<p>
Now we are nearly finished! Add the following line to your /etc/rc.conf:
<p>
start_vinum="YES"
<p>
and reboot:
<p>
# reboot
<p>
After the System has come up make a "df" in order to see the fabulous mirrored disks!
<p>
<font color="#990000">Something goes wrong after the reboot</font>
<p>
If something goes wrong, e.g. you have not specified the right mountpoint etc.: you have vi in /bin, which means you can edit /etc/fstab, you have vinum in single user and you have still the copy of /usr and /var! You can repair everything like you want and repeat this steps by debbuging your configuration!
<p>
<font color="#990000">After-vinum configuration</font>
<p>
If all went smooth, reboot into single user mode and mount /. Remove your old /usr, var and other directories you don't need anymore. Reboot. The system should come up into multiuser. Now delete your *.tar files in /mnt and finish your installation (e.g. install ports, linux compatibility, upgrade your system to RELENG_4 or whatever). At this stage the vinum part should be finished.
<p>
<font color="#990000"><strong>PAY ATTENTION!</strong>: If you want to upgrade your system to -STABLE do the following:</font>
<p>
Make your normal cvsup to grep your new sources. When you are finished, make the following:
<p>
# cd /usr/src<br>
# make buildworld<br>
# make buildkernel KERNCONF=YOUR_KERNEL_HERE<br>
# make installkernel KERNCONF=YOUR_KERNEL_HERE<br>
<p>
<strong>Don't reboot yet!!</strong> First of all take a backup of your /sbin/vinum:
<p>
# cp /sbin/vinum /sbin/vinum.bak<br>
# cd /usr/src/sbin/vinum<br>
# make && make install<br>
# reboot
<p>
Stop in single user mode (boot -s at the prompt).
<p>
# fsck /dev/YOUR_ROOT_FILESYSTEM_HERE<br>
# mount /<br>
# vinum start<br>
# fsck /dev/vinum/YOUR_TO_BE_MOUNTED_FILESYSTEM<br>
# mount /YOUR_TO_BE_MOUNTED_FILESYSTEM<br>
<p>
Repeat the last for all of your essential slices (like /usr, /var, etc.)
<p>
Then go on with your normal upgrade process:
<p>
# make installworld<br>
# mergemaster # For a fresh install it's the best way to type "i", else type "m"<br>
# reboot<br>
<p>
<font color=green>I don't understand the point of all this rigmarole.  You
shouldn't need to do anything special here.</font>
<p>

Enjoy your new upgraded system! Michael Dosser.
<p>
<center><a href="http://www.anybrowser.org/campaign/"><img src="pics/anybrowser.gif" alt="| Lynx, w3m, links friendly |" border="0"></a><a href="http://www.bostic.com/vi/"><img SRC="pics/vi.gif" alt="| Coded with vi |" border="0"></a></center>
<p>
</body>
</html>

--SLDf9lqlvOQaIe6s--

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




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