<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nejko's randomness &#187; gmirror</title>
	<atom:link href="http://nejc.skoberne.net/tag/gmirror/feed/" rel="self" type="application/rss+xml" />
	<link>http://nejc.skoberne.net</link>
	<description>Random thoughts with high entropy</description>
	<lastBuildDate>Sun, 20 Mar 2011 22:12:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>gmirror and gvinum on the same drives</title>
		<link>http://nejc.skoberne.net/2008/11/gmirror-and-gvinum-on-the-same-drives/</link>
		<comments>http://nejc.skoberne.net/2008/11/gmirror-and-gvinum-on-the-same-drives/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 21:05:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[gmirror]]></category>
		<category><![CDATA[gvinum]]></category>
		<category><![CDATA[RAID]]></category>

		<guid isPermaLink="false">http://nejc.skoberne.net/?p=99</guid>
		<description><![CDATA[In 2006, when I was installing a FreeBSD server for our client, one of the requests was also a RAID-5 array of some kind. I checked out and discovered GEOM vinum (or gvinum), which provided what I needed at that time. It is a file server, but throughput is not a critical issue, so I [...]]]></description>
			<content:encoded><![CDATA[<p>In 2006, when I was installing a <a class="zem_slink" title="FreeBSD" rel="homepage" href="http://www.freebsd.org">FreeBSD</a> server for our client, one of the requests was also a <a class="zem_slink" title="RAID" rel="wikipedia" href="http://en.wikipedia.org/wiki/RAID">RAID</a>-5 array of some kind. I checked out and discovered <a href="http://www.freebsdwiki.net/index.php/Gvinum" target="_blank">GEOM vinum</a> (or gvinum), which provided what I needed at that time. It is a <a class="zem_slink" title="File server" rel="wikipedia" href="http://en.wikipedia.org/wiki/File_server">file server</a>, but throughput is not a critical issue, so I tried it (at that time, <a href="http://en.wikipedia.org/wiki/Geom_raid5" target="_blank">graid5</a> was not yet available, AFAIK). I am writing this because this weekend I had to rebuild the array (and copy the data) with new, larger drives, which took me many hours to do it, because there is not so many documentation on how to make different <a href="http://en.wikipedia.org/wiki/GEOM" target="_blank">GEOM</a> RAID subsystems share the same three drives.</p>
<p>This is what I wanted to achieve: have three drives, which would contain two <a href="http://www.freebsd.org/doc/en/books/handbook/geom-mirror.html" target="_blank">gmirror</a> (RAID-1) arrays (one for root partition, the other for swap) and three gvinum (RAID-5) volumes &#8211; for <a class="zem_slink" title="Filesystem Hierarchy Standard" rel="wikipedia" href="http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard"></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/var</div></div>
<p></a>,</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/tmp</div></div>
<p>and</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/usr</div></div>
<p>. For the latter, it is best to use volume management capabilities of gvinum, which allows you to join only three physical devices (or slices or partitions) with it, so that the logical volumes are created &#8220;inside&#8221; the vinum manager.</p>
<p>The main problem was, that I forgot how to do this &#8220;properly&#8221;. It was 2 years since I did this (of course, I didn&#8217;t write it down how I did it, although it took me a few hours) last time and since the machine is far away, I don&#8217;t have physical access. This would have helped, because I could just put the old drives back and see how they were configured, but the remote system administrator already exchanged the drives and I didn&#8217;t want to bother him.</p>
<p>In FreeBSD terms, a partition is a logical unit, which resides on a slice (which is actually a partition from other operating systems&#8217; point of view).  Let&#8217;s have four drives on the system:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad0</div></div>
<p>,</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad1</div></div>
<p>,</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad2</div></div>
<p>and</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad3</div></div>
<p>. We&#8217;ll assume that on</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad0</div></div>
<p>there is the system we are booting and running FreeBSD at the moment and we wan&#8217;t to create the arrays on the other three drives, which will eventually run by themselves (we&#8217;ll pull the</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad0</div></div>
<p>out when we finish). When you create a slice on</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad1</div></div>
<p>, for example, you&#8217;ll be able to access it via</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad1s1</div></div>
<p>. When you create a partition on this slice, you&#8217;ll see it as</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad1s1a</div></div>
<p>, where the last letter &#8220;a&#8221; can also be &#8220;b&#8221;, &#8220;d&#8221;, &#8220;e&#8221;, and so on, you know the alphabet. This naming system is somewhat <a href="http://www.freebsd.org/doc/en/books/handbook/disk-organization.html" target="_blank">peculiar</a>, and I don&#8217;t like it but I can live with it. The letter &#8220;a&#8221; usually hosts the root partition, and the letter &#8220;b&#8221; provides swap space. As you can see, there is no letter &#8220;c&#8221;. This is because it specifies the whole slice and therefore it should not be used for anything else.</p>
<p>Usually, when you&#8217;re setting up the gmirror RAID-1 on FreeBSD, you make put it on the physical drive directly, i.e. you make the</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad0</div></div>
<p>visible as</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/mirror/gm0</div></div>
<p>(after you put the metadata on the drive, by running &#8216;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gmirror create</div></div>
<p>&#8216;), which also means that all existing slices and partitions will be visible at the new location. If you had</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad0s1a</div></div>
<p>, you&#8217;ll now have</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/mirror/gm0s1a</div></div>
<p>. Which is very nice and makes gmirror very easy to set up after the system was installed. In the end, you just add other mirrors (</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad1</div></div>
<p>, &#8230;) in the array and that&#8217;s it.</p>
<p>However, if you want to use gvinum on the same drives (to make RAID-5 arrays, for example), you can&#8217;t do that. You&#8217;ll need to gmirror something else: the slices or the partitions, but not the whole drives. Now FreeBSD allows you to have no slices at all &#8211; to create the FreeBSD partitions (the letters) directly on the drive (so you&#8217;ll have</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad1a</div></div>
<p>). So when I started to think about how I would partition the drives and which units will I merge with gvinum and gmirror, I became a bit confused. So I tried a few ideas I had and none of them really worked because I didn&#8217;t know what actually the command such as &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">bsdlabel -w</div></div>
<p>&#8220;, &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">boot0cfg</div></div>
<p>&#8220;, &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gmirror label</div></div>
<p>&#8220;, &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gvinum create</div></div>
<p>&#8221; and creating slices via &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sysinstall</div></div>
<p>&#8221; actually do. Where do they write their data? At what offsets and what are the sizes of these metadata? I found it quite annoying that there isn&#8217;t much documentation about this (at least not well organized), so I had to do some homework. Here is what I discovered:</p>
<p><strong>gvinum &#8212; </strong>When you run &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gvinum create</div></div>
<p>&#8220;, it will rewrite the bytes from <strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">0x1000</div></div>
<p></strong> to <strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">0x21200</div></div>
<p></strong>, that is from block 8 (first 8 blocks are left untouched) to block 265 with its own configuration data, so you have to be careful not to mess with these blocks.</p>
<p><strong>gmirror &#8212; </strong>Running &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gmirror label</div></div>
<p>&#8221; puts gmirror&#8217;s metadata on the last block of the device. The size in blocks of the mirror is then number of block of the device &#8211; 1.</p>
<p><strong>bsdlabel &#8212; </strong>When labelling a slice (or the drive directly), bsdlabel writes label information to the second block (from address <strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">0x200</div></div>
<p></strong> on, in my tests it never passed the <strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">0x2c0</div></div>
<p></strong> limit, which still fits into the second block).</p>
<p><strong>boot0cfg &#8212; </strong>Since it rewrites the <a class="zem_slink" title="Master boot record" rel="wikipedia" href="http://en.wikipedia.org/wiki/Master_boot_record">MBR</a> with BootMgr, this means it rewrites the first block (block 0) of the drive.</p>
<p><strong>fdisk &#8212; </strong>Fdisk writes the slice information into first 16 blocks of <strong>the slice</strong>. This means, that you shouldn&#8217;t label them with bsdlabel (don&#8217;t assign them to any of the partitions), or you can have problems.</p>
<p>To sum up, the only configuration, which worked for me on FreeBSD 6.1 (yes, quite old one) was the following. First I created slices on all of the drives (one on each drive) and wrote the BootMgr onto them (you can do this easily by running <strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sysinstall</div></div>
<p></strong> and then going to <strong>Custom </strong>and then <strong>Partition</strong>. You select the first drive (of the three) and then, when in fdisk-editor, press <strong>a</strong> and then <strong>w</strong> to write the slice. When asked about MBR, just say <strong>BootMgr</strong> and that&#8217;s it. This will ensure that there is a boot manager on the drive (which means you can boot from it). You have to repeat this procedure for the other (two) drives as well.</p>
<p>Then, you have to edit the label of all three slices, running &#8220;<strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">bsdlabel -e /dev/ad1s1</div></div>
<p></strong>&#8221; (for the slice on the first drive). You have to provide the following partition set:</p>
<pre>a:  1048576       16    4.2BSD        0     0     0
b:  4194304  1048592      swap
c: 976768002       0    unused        0     0         # "raw" part, don't edit
d: 971525106 5242896     vinum</pre>
<p>In this configuration you can see that the size of &#8220;a&#8221; (root) partition is 1048576 512-byte blocks which means 512 MB. The offset of 16 blocks for the &#8220;a&#8221; partition is very important, since the slice needs the first 16 blocks for itself. The size of the &#8220;b&#8221; (swap) partition is 4 times the size of &#8220;a&#8221; (2 GB) and the &#8220;d&#8221; takes all the space left on the slice.</p>
<p>So the idea is to make two gmirror arrays, the first one will consist of the three &#8220;a&#8221; partitions (remember, we have three hard drives) and will be used as the root partition. The second one will consist of the three &#8220;b&#8221; partitions and will be used as swap space. All the &#8220;d&#8221; partitions will be used for the construction of the gvinum array.</p>
<p>First, you need to load the</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">geom_mirror module</div></div>
<p>, which enables kernel to handle the gmirror arrays. You do this by running &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">kldload geom_mirror</div></div>
<p>&#8220;. But, it is needed to make this change permanent (so the module will load at boot) so you need to add these two lines to</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/boot/loader.conf</div></div>
<p>:</p>
<pre>geom_mirror_load="YES"
geom_vinum_load="YES"</pre>
<p>This will also enable loading gvinum at boot, which we will need later (when the system will boot from the new arrays). No it&#8217;s time to create the arrays. You&#8217;ll run something like:</p>
<pre># gmirror label -v -b round-robin root /dev/ad1s1a
# gmirror label -v -b round-robin swap /dev/ad1s1b
# gmirror insert root /dev/ad2s1a
# gmirror insert root /dev/ad3s1a
# gmirror insert swap /dev/ad2s1b
# gmirror insert swap /dev/ad3s1b</pre>
<p>This was for the gmirror arrays. Now make a file named</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gvinum.conf</div></div>
<p>and put this in it:</p>
<pre>drive disk1 device /dev/ad1s1d
drive disk2 device /dev/ad2s1d
drive disk3 device /dev/ad3s1d
 volume var
  plex org raid5 491k
   sd length 1024m drive disk1
   sd length 1024m drive disk2
   sd length 1024m drive disk3
 volume tmp
  plex org raid5 491k
   sd length 512m drive disk1
   sd length 512m drive disk2
   sd length 512m drive disk3
 volume usr
  plex org raid5 491k
   sd length 0 drive disk1
   sd length 0 drive disk2
   sd length 0 drive disk3</pre>
<p>And then you run:</p>
<pre># gvinum create gvinum.conf</pre>
<p>This will create three gvinum RAID-5 arrays &#8211; for</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/var</div></div>
<p>,</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/usr</div></div>
<p>and</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/tmp</div></div>
<p>. They will be accessible via</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/gvinum/var</div></div>
<p>,</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/gvinum/usr</div></div>
<p>and</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/gvinum/tmp</div></div>
<p>respectively. You should know, that the size of the RAID-5 array is the sum of the size of all drives &#8211; the size of one drive. This makes our</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/var</div></div>
<p>2 GB,</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/tmp</div></div>
<p>1GB and</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/usr</div></div>
<p>the rest. If you execute &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gvinum list</div></div>
<p>&#8221; now, you&#8217;ll see that all the arrays are marked as <strong>up</strong>. However, this will not be the case after you reboot. I don&#8217;t know exactly why, perhaps this is a bug. Also I am not sure if it is present in the newest FreeBSD releases. So it is very important now, that you <strong>reboot</strong> the system now. After it comes back online, you have to run:</p>
<pre># gvinum start var
# gvinum start usr
# gvinum start tmp</pre>
<p>Then you have to wait for the arrays to become synchronized. It may take a while. You can always check status with &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gvinum list</div></div>
<p>&#8220;. When the arrays are synchronized, you need to create the filesystems on all of them:</p>
<pre># newfs /dev/mirror/root
# newfs -U /dev/gvinum/var
# newfs -U /dev/gvinum/usr
# newfs -U /dev/gvinum/tmp</pre>
<p>After that, you should mount these new arrays in</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/mnt</div></div>
<p>and copy the system, you are running now onto them:</p>
<pre># mount /dev/mirror/root /mnt
# cd /mnt
# mkdir var tmp usr
# chmod 1777 tmp
# mount /dev/gvinum/var /mnt/var
# mount /dev/gvinum/usr /mnt/usr
# mount /dev/gvinum/tmp /mnt/tmp
# cd / &amp;&amp; find . -xdev | cpio -pm /mnt
# cd /var &amp;&amp; find . -xdev | cpio -pm /mnt/var
# cd /usr &amp;&amp; find . -xdev | cpio -pm /mnt/usr
# cd /tmp &amp;&amp; find . -xdev | cpio -pm /mnt/tmp</pre>
<p>Finally, you have to modify your</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">fstab</div></div>
<p>file on the root gmirror array. Edit</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/mnt/etc/fstab</div></div>
<p>as follows:</p>
<pre># Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/mirror/swap        none            swap    sw              0       0
/dev/mirror/root        /               ufs     rw              1       1
/dev/gvinum/tmp         /tmp            ufs     rw              2       2
/dev/gvinum/usr         /usr            ufs     rw              2       2
/dev/gvinum/var         /var            ufs     rw              2       2
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0</pre>
<p>Now you can try to boot the system from one of the three drives which hold the RAID arrays and you should be lucky. If you aren&#8217;t, you are welcome to post comments here and we&#8217;ll try to sort it out together.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/e81a812b-6bbf-4f2b-a7fd-73e32c29517d/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=e81a812b-6bbf-4f2b-a7fd-73e32c29517d" alt="Reblog this post [with Zemanta]" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://nejc.skoberne.net/2008/11/gmirror-and-gvinum-on-the-same-drives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

