<?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>ClearChain &#187; mbr</title>
	<atom:link href="http://www.clearchain.com/blog/tags/mbr/feed" rel="self" type="application/rss+xml" />
	<link>http://www.clearchain.com/blog</link>
	<description>-= Daily Happenings =-</description>
	<lastBuildDate>Thu, 17 May 2012 03:51:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Booting FreeBSD from a root zfs pool using a standard MBR and partition table</title>
		<link>http://www.clearchain.com/blog/posts/booting-freebsd-from-a-root-zfs-pool-using-a-standard-mbr-and-partition-table</link>
		<comments>http://www.clearchain.com/blog/posts/booting-freebsd-from-a-root-zfs-pool-using-a-standard-mbr-and-partition-table#comments</comments>
		<pubDate>Fri, 08 May 2009 03:51:02 +0000</pubDate>
		<dc:creator>Benjamin Close</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[booting]]></category>
		<category><![CDATA[BTX]]></category>
		<category><![CDATA[dual boot]]></category>
		<category><![CDATA[mbr]]></category>
		<category><![CDATA[partition]]></category>
		<category><![CDATA[zfs]]></category>
		<category><![CDATA[zfsboot]]></category>
		<category><![CDATA[zfsldr.S]]></category>
		<category><![CDATA[zfsonroot]]></category>
		<category><![CDATA[zpool]]></category>

		<guid isPermaLink="false">http://www.clearchain.com/blog/?p=366</guid>
		<description><![CDATA[<a href="http://www.clearchain.com/blog/posts/booting-freebsd-from-a-root-zfs-pool-using-a-standard-mbr-and-partition-table"><img align="left" hspace="5" width="150" height="150" src="http://www.clearchain.com/blog/wp-content/plugins/thumbnail-for-excerpts/tfe_no_thumb.png" class="alignleft wp-post-image tfe" alt="" title="" /></a>This page documents the current state of play for booting the root filesystem (/) off a zfs zpool under FreeBSD, using a standard master boot record (MBR) and a standard partition table. The aim was to be able to have a dual boot system for my laptop using the standard FreeBSD quick selection boot loader.<a href="http://www.clearchain.com/blog/posts/booting-freebsd-from-a-root-zfs-pool-using-a-standard-mbr-and-partition-table"> <font size=-2>[..more..]</font></a>]]></description>
			<content:encoded><![CDATA[<p>This page documents the current state of play for booting the root filesystem (/) off a zfs zpool under FreeBSD, using a standard master boot record (MBR) and a standard partition table. The aim was to be able to have a dual boot system for my laptop using the standard FreeBSD quick selection boot loader.</p>
<p><span style="color: #0000ff;">Note, this does not cover using the gpt based partition tables. If you want to use these, please refer to the following page: </span><span style="color: #0000ff;"><a href="http://blogs.freebsdish.org/lulf/2008/12/16/setting-up-a-zfs-only-system/">http://lulf.geeknest.org/blog/freebsd/Setting_up_a_zfs-only_system/</a> or booting zfs as root using a small ufs boot partition as provided by the instructions at: <a href="http://wiki.freebsd.org/ZFSOnRoot">http://wiki.freebsd.org/ZFSOnRoot.<br />
</a></span></p>
<p>Below is the steps required to be able to setup the root zpool</p>
<ol>
<li>Download a FreeBSD -current fixit cdrom snapshot later than 200901, as these have loader ZFS support</li>
<li>Burn the CD</li>
<li>Boot the CD</li>
<li>Setup any partitions you want &#8211; <span style="color: #ff0000;">note you must setup the &#8216;a&#8217; partition to cover the entire device as the loader will use this.</span></li>
<li>Select Fixit from the menu, and use the CDrom as a source</li>
<li>Create the pool and install the loader (see below)</li>
<li>Copy the required files to boot (see below)</li>
</ol>
<h2>Creating the root zpool and installing the Loader</h2>
<p>The fixit cd has everything required to create a zpool, however by default none of the required modules are loaded. Hence they need to be loaded first:</p>
<pre style="padding-left: 30px;"><span style="font-family: Georgia; line-height: 19px; white-space: normal;"><span style="font-family: times new roman,times;"><span style="line-height: 18px; white-space: pre;">cd /mnt2/boot/kernel
<span style="white-space: normal;">kldload ./opensolaris.ko
<span style="white-space: pre;">
kldload ./zfs.ko</span></span></span></span></span></pre>
<p>Once the modules have been loaded all the zfs tools (zpool,zfs,zdb) should now work. Let assume you want to install FreeBSD to /dev/ad4s2 (second partition on a sata disk). You can do this using:</p>
<pre>    zpool create <strong><em>somename</em></strong> /dev/ad4s2</pre>
<p>Where <span style="text-decoration: underline;">somename</span> is the name of the pool you want to create. This creates a single zfs filesystem and a zfs pool of storage. To install the boot loader you need to do:</p>
<pre>    # dd if=/mnt2/boot/zfsboot of=/dev/da0s1 count=1
    # dd if=/mnt2/boot/zfsboot of=/dev/da0s1 skip=1 seek=1024</pre>
<p>The first line installs boot1, the second line installs boot2.  However, boot2 is responsible for loading boot3 (aka the loader &#8211; found in /boot/loader). Hence that must be put in place.</p>
<h2>Copying the required files to boot</h2>
<p>The easiest way to get things to the point where things are ready to boot is to copy all the files from /dist  - the live distribution. Before you do this, you might like to take advantage of zfs and create some subfilesystems so you can snapshot, monitor space, etc.</p>
<p>For instance creating a /usr and /var filesystem is often very handy:</p>
<pre>    #zfs create somename/usr
    #zfs create somename/var</pre>
<p>Now you can copy the base system:</p>
<pre>    cp -a /dist/* /somename</pre>
<p>This will install among other things:</p>
<ul>
<li>/somename/boot/kernel/kernel  - FreeBSD kernel</li>
<li>/somename/boot/kernel/opensolaris.ko &#8211; zfs dependency</li>
<li>/somename/boot/kernel/zfs.ko &#8211; module understanding zpools/zfs</li>
<li>/somename/boot/loader  - the FreeBSD loader<span style="color: #ff0000;"><br />
</span></li>
</ul>
<p>At this point you need to replace the loader with one that understands zfs. You can download the loader from: (To be advise &#8211; see cavet below)<br />
And if you have a usb stick copy it in place using:</p>
<pre>   mount_msdos /dev/da0s1 /mnt
   cp /mnt/loader /somename/boot</pre>
<p>Finally you have to tell FreeBSD where to mount filesystems on a standard boot:</p>
<pre>   zfs set mountpoint=/var somename/var
   zfs set mountpoint=/usr somename/usr</pre>
<p>At this point any command you type will now probably fail indicating it&#8217;s missing some shared library. This is because /usr has now changed. You can get around this by telling the loader where to find valid libraries:</p>
<pre>   export LD_LIBRARY_PATH=/mnt2/lib</pre>
<p>Next we need to build the zfs cache. This is used by zfs mount to automatically mount zfs filesystems by /etc/rc.d/zfs at boot time. It&#8217;s also used to determine if a filesystem is local to the system or belongs to an exported pool.</p>
<pre>   mkdir /boot/zfs
   mkdir /somename/boot/zfs
   cd /
   zfs export somename
   zfs import -f somename
   cp /boot/zfs/zfs.cache /somename/boot/zfs/</pre>
<p>Finally we tell the loader where we want to boot from and set the init scripts to automatically start all zfs filesystems:</p>
<pre>    echo 'zfs_enable="YES"' &gt; /somename/etc/rc.conf
    echo 'zfs_load="YES"' &gt; /somename/boot/loader.conf
    echo 'vfs.root.mountfrom="zfs:somename"' &gt;&gt; /somename/boot/loader.conf</pre>
<p>And set the root filesystem to a legacy mountpoint (so zfs mount -a won&#8217;t try and mount an already mounted filesystem)</p>
<pre>     zfs set mountpoint=legacy somename</pre>
<p>At this point you can reboot and things should now boot!<br />
<span style="text-decoration: underline;"><em><strong>Update: 20090809</strong></em></span></p>
<p>There has been a lot of updates to instructions along the way. There are now official ZFS on Root instructions available using GPT/MBR/other available at: <a href="http://wiki.freebsd.org/RootOnZFS">http://wiki.freebsd.org/RootOnZFS</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.clearchain.com/blog/posts/booting-freebsd-from-a-root-zfs-pool-using-a-standard-mbr-and-partition-table/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>FreeBSD &amp; WINDOWS VISTA</title>
		<link>http://www.clearchain.com/blog/posts/freebsd-windows-vista</link>
		<comments>http://www.clearchain.com/blog/posts/freebsd-windows-vista#comments</comments>
		<pubDate>Fri, 07 Nov 2008 03:43:22 +0000</pubDate>
		<dc:creator>Benjamin Close</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[bcdedit]]></category>
		<category><![CDATA[bootloader]]></category>
		<category><![CDATA[dual boot]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[mbr]]></category>
		<category><![CDATA[vista]]></category>

		<guid isPermaLink="false">http://www.clearchain.com/blog/?p=44</guid>
		<description><![CDATA[<a href="http://www.clearchain.com/blog/posts/freebsd-windows-vista"><img align="left" hspace="5" width="150" height="150" src="http://www.clearchain.com/blog/wp-content/plugins/thumbnail-for-excerpts/tfe_no_thumb.png" class="alignleft wp-post-image tfe" alt="" title="" /></a>Dual Booting Windows Vista &#38; FreeBSD / Linux / Some other OS The Problem After installing Windows Vista Enterprise Edition, I very quickly wanted to get back to FreeBSD. As per previous versions of Windows, Vista does a great job of overwriting the Master boot record (MBR). Unlike previous versions of windows, you cannot just<a href="http://www.clearchain.com/blog/posts/freebsd-windows-vista"> <font size=-2>[..more..]</font></a>]]></description>
			<content:encoded><![CDATA[<p><big>Dual Booting Windows Vista &amp; FreeBSD / Linux / Some other OS</big></p>
<h2><span class="mw-headline">The Problem</span></h2>
<p>After installing Windows Vista Enterprise Edition, I very quickly wanted to get back to FreeBSD. As per previous versions of Windows, Vista does a great job of overwriting the Master boot record (MBR). Unlike previous versions of windows, you cannot just install a different boot loader in the MBR &#8211; so I found out the hard way. (It used to be sooo easy fdisk /mbr would fix any broken boot sectors, then just install your favourite boot loader).<span id="more-44"></span></p>
<p>Vista writes a unique disk id in the MBR. This unique id (UID) is used by Vista to determine what disk is what. It does make some sense, Hardware can shift around, but the UID should always be the same. This allows Vista to always know where it&#8217;s files are and to appropriate label drive C: as the correct drive.</p>
<p>Installing another boot loader, however (ie Grub, lilo, the FreeBSD boot0 / boot loader /boot manager) will overwrites the UID in the MBR and Vista fails to load with an error:</p>
<pre>"unable to access \windows\winload.exe"</pre>
<p>The error message is semi appropriate but very misleading. What it really should say is &#8221;I can&#8217;t work out which of my the drives has my files on it hence I can&#8217;t find winload.exe&#8221;.</p>
<ul>
<li>&#8216;Full details about the UID can be found at: <a class="external free" title="http://multibooters.co.uk/mbr.html" rel="nofollow" href="http://multibooters.co.uk/mbr.html">http://multibooters.co.uk/mbr.html</a></li>
</ul>
<p><a name="Existing_Solutions"></a></p>
<h3><span class="mw-headline">Existing Solutions</span></h3>
<p>Out on the web there is many solutions to the dreaded winload.exe. Many of them are misleading, some I believe are not even tested. Also many apply to Vista Release Candidate 1 (rc1) which I believe didn&#8217;t required the UID to be present in order to successfully boot. Below is some of the solutions that people say work (but Ifound didn&#8217;t).</p>
<p><a name="Using_Grub"></a></p>
<h4><span class="mw-headline">Using Grub</span></h4>
<ul>
<li>Ref: <a class="external free" title="http://ubuntuforums.org/showthread.php?t=358175" rel="nofollow" href="http://ubuntuforums.org/showthread.php?t=358175">http://ubuntuforums.org/showthread.php?t=358175</a></li>
<li>Ref: <a class="external free" title="http://blogs.sun.com/moinakg/entry/vista_and_solaris_express_dual" rel="nofollow" href="http://blogs.sun.com/moinakg/entry/vista_and_solaris_express_dual">http://blogs.sun.com/moinakg/entry/vista_and_solaris_express_dual</a></li>
</ul>
<p>Some say grub loading windows with something like:</p>
<pre>Title Vista
  root (hd0,0)
  makeactive
  chainloader +1</pre>
<p>will work &#8211; but grub still over writes the MBR hence the same issue will occur &#8211; though you may be lucky as the grub MBR is really small (and might leave the UID) untouched.</p>
<p><a name="Using_gag"></a></p>
<h4><span class="mw-headline">Using gag</span></h4>
<p>There&#8217;s reports on a FreeBSD mailing list that gag will work, thought I&#8217;m running FreeBSD/amd64 which gag or grub for that matter won&#8217;t compile on. I know I could always install the lib32 compatability distribution to use it but I wanted the default FreeBSD boot loader.</p>
<p><a name="Using_the_Vista_Boot_Loader"></a></p>
<h4><span class="mw-headline">Using the Vista Boot Loader</span></h4>
<ul>
<li>Refs: <a class="external free" title="http://www.tech-recipes.com/rx/2014/vista_using_bcdedit_boot_up_options_dual_boot_xp_prof'" rel="nofollow" href="http://www.tech-recipes.com/rx/2014/vista_using_bcdedit_boot_up_options_dual_boot_xp_prof'">http://www.tech-recipes.com/rx/2014/vista_using_bcdedit_boot_up_options_dual_boot_xp_prof&#8217;</a></li>
</ul>
<p>Many people have given up on trying to use a normal boot loader, and instead use the Vista boot loader.<br />
The WinXP/NT bootloader (ntldr &amp; config file boot.ini) have been replaced with files winboot.exe and bcedit.exefor configuration.</p>
<p>Theses commands could be setup to boot other operating systems though your milege may vary.</p>
<p><a name="Commercial_Software"></a></p>
<h4><span class="mw-headline">Commercial Software</span></h4>
<p>Many people have decided it&#8217;s all too hard and gone and purchased software to handle it for them &#8211; there&#8217;s lots out there</p>
<ul>
<li>VistaBoot (<a class="external free" title="http://vistabootpro.org" rel="nofollow" href="http://www.vistabootpro.org/">http://vistabootpro.org</a>)</li>
<li>EasyBCD</li>
</ul>
<p><a name="Utilities"></a></p>
<h4><span class="mw-headline">Utilities</span></h4>
<ul>
<li>Ref: <a class="external free" title="http://www.sysint.no/en/Download.aspx" rel="nofollow" href="http://www.sysint.no/en/Download.aspx">http://www.sysint.no/en/Download.aspx</a></li>
</ul>
<p>There is many utilities that claim to fix the issue. One such util is MBRFix.exe, this fixes the fact that vista won&#8217;t boot but it will clobber any boot loader you have got installed.</p>
<p><a name="The_Fix_.28That_Worked.29"></a></p>
<h2><span class="mw-headline">The Fix (That Worked)</span></h2>
<ul>
<li>Obtained from: <a class="external free" title="http://forum.onmac.net/showthread.php?t=1324" rel="nofollow" href="http://forum.onmac.net/showthread.php?t=1324">http://forum.onmac.net/showthread.php?t=1324</a></li>
</ul>
<p>The simple fix is to tell Vista that the drive it boots off of will always be the drive it can find its files on. This way you can clobber the UID in the MBR as much as you want and Vista won&#8217;t care. To do this you run:</p>
<pre>BCDEDIT /set {bootmgr} device boot
BCDEDIT /set {default} device boot
BCDEDIT /set {default} osdevice boot</pre>
<p>This can be run from either the Vista repair cd, from within Vista, or from something like<a class="external free" title="http://www.ultimatebootcd.com" rel="nofollow" href="http://www.ultimatebootcd.com/">http://www.ultimatebootcd.com</a> (For Windows).</p>
<p><a name="Conclusion"></a></p>
<h2><span class="mw-headline">Conclusion</span></h2>
<p>Hence it IS possible to run Vista with any boot loader that you like &#8211; in my case the FreeBSD boot loader is the one of choice.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.clearchain.com/blog/posts/freebsd-windows-vista/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

