<?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>shapeshifter.se &#187; FreeBSD</title>
	<atom:link href="http://www.shapeshifter.se/tag/freebsd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shapeshifter.se</link>
	<description>Mostly miscellaneous technical mumbo-jumbo.</description>
	<lastBuildDate>Mon, 11 Jul 2011 14:19:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>VirtualBox hacking</title>
		<link>http://www.shapeshifter.se/2009/08/21/virtualbox-hacking/</link>
		<comments>http://www.shapeshifter.se/2009/08/21/virtualbox-hacking/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 14:55:04 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[VirtualBox]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=661</guid>
		<description><![CDATA[VirtualBox (host mode) was quite recently ported to FreeBSD, some bits are still missing particular network support. So I spent the last couple of days hacking on it and how have a working implementation that supports bridged adapters.
Update 10 Sep: The patches have been committed upstreams. 
Update 9 Sep: working vboxnetadp and patchset sent upstreams.
Update: [...]]]></description>
			<content:encoded><![CDATA[<p>VirtualBox (host mode) was quite recently ported to FreeBSD, some bits are still missing particular network support. So I spent the last couple of days hacking on it and how have a working implementation that supports bridged adapters.</p>
<p>Update 10 Sep: <a href="http://www.virtualbox.org/changeset/22875">The patches have been committed upstreams. </a><br />
Update 9 Sep: working vboxnetadp and patchset sent upstreams.<br />
Update: Re-written to use netgraph, now works on FreeBSD 7 and 8</p>
<p>Patches can be found at</p>
<p><a href="http://www.shapeshifter.se/pub/patches/virtualbox/vbox-freebsd-netif-20090908.patch">http://www.shapeshifter.se/pub/patches/virtualbox/vbox-freebsd-netif-20090908.patch</a><br />
<a href="http://www.shapeshifter.se/pub/patches/virtualbox/vbox-freebsd-vboxnetadp-20090908.patch">http://www.shapeshifter.se/pub/patches/virtualbox/vbox-freebsd-vboxnetadp-20090908.patch</a><br />
<a href="http://www.shapeshifter.se/pub/patches/virtualbox/vbox-freebsd-vboxnetflt-20090908.patch">http://www.shapeshifter.se/pub/patches/virtualbox/vbox-freebsd-vboxnetflt-20090908.patch</a><br />
<a href="http://www.shapeshifter.se/pub/patches/virtualbox/Config.kmk-20090908.patch">http://www.shapeshifter.se/pub/patches/virtualbox/Config.kmk-20090908.patch</a><br />
<a href="http://www.shapeshifter.se/pub/patches/virtualbox/src-VBox-HostDrivers-Makefile.kmk-20090908.patch">http://www.shapeshifter.se/pub/patches/virtualbox/src-VBox-HostDrivers-Makefile.kmk-20090908.patch</a></p>
<p>Additional patches to test with the <strong>3.0.51.r22226</strong> version in FreeBSD ports.</p>
<p><a href="http://www.shapeshifter.se/pub/patches/virtualbox/Config.kmk-r22226-20090908.patch">http://www.shapeshifter.se/pub/patches/virtualbox/Config.kmk-r22226-20090908.patch</a><br />
<a href="http://www.shapeshifter.se/pub/patches/virtualbox/virtualbox-port-20090907.patch">http://www.shapeshifter.se/pub/patches/virtualbox/virtualbox-port-20090907.patch</a><br />
<a href="http://www.shapeshifter.se/pub/patches/virtualbox/ConsoleImpl2.cpp.patch">http://www.shapeshifter.se/pub/patches/virtualbox/ConsoleImpl2.cpp.patch</a></p>
<p>Re-install VirtualBox through ports using the following commands</p>
<blockquote>
<pre>
Apply/compile with
cd /usr/ports/emulators/virtualbox
make clean patch
mkdir work/virtualbox-3.0.51r22226/src/VBox/HostDrivers/VBoxNetFlt/freebsd
mkdir work/virtualbox-3.0.51r22226/src/VBox/HostDrivers/VBoxNetAdp/freebsd
patch < virtualbox-port-20090907.patch
patch -d work/virtualbox-3.0.51r22226/Config.kmk-r22226-20090908.patch
patch -d work/virtualbox-3.0.51r22226/ConsoleImpl2.cpp.patch
patch -d work/virtualbox-3.0.51r22226/src-VBox-HostDrivers-Makefile.kmk-20090908.patch
patch -d work/virtualbox-3.0.51r22226/vbox-freebsd-netif-20090908.patch
patch -d work/virtualbox-3.0.51r22226/vbox-freebsd-vboxnetadp-20090908.patch
patch -d work/virtualbox-3.0.51r22226/vbox-freebsd-vboxnetflt-20090908.patch
make install
</pre>
</blockquote>
<p>In VirtualBox network settings, under "Bridged Adapter" you should now see your available network interfaces. Select the one connected to your network and boot your virtual machine.  It should now be connected to your local network as any other machine.</p>
<p>Host only adapter mode can be used to create a virtual network with multiple guests, it creates a special vboxnetX adapter on the host. You'll have to do normal routing between this interface to get outside connectivity.</p>
<p>In addition to vboxdrv.ko you'll have to load vboxnetflt.ko and vboxnetadp.ko too.</p>
<blockquote>
<pre>
kldload /boot/modules/vboxnetflt.ko
kldload /boot/modules/vboxnetadp.ko
</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2009/08/21/virtualbox-hacking/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>uhso(4): Option HSDPA driver for FreeBSD 8</title>
		<link>http://www.shapeshifter.se/2009/07/20/uhso4-option-hsdpa-driver-for-freebsd-8/</link>
		<comments>http://www.shapeshifter.se/2009/07/20/uhso4-option-hsdpa-driver-for-freebsd-8/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 14:52:54 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[hsdpa]]></category>
		<category><![CDATA[hso]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=633</guid>
		<description><![CDATA[
A bit late, but here is the first beta of the Option HSDPA driver for FreeBSD 8. It&#8217;s more or less completely rewritten and there are some visible changes to the interface.
Because ucom(4) has matured it can now be utilized instead of mucking around directly with the TTY layer. This results in that the device [...]]]></description>
			<content:encoded><![CDATA[<p><!-- WSA: rules for context 'adsense-post-top' did not apply --></p>
<p>A bit late, but here is the first <strong>beta</strong> of the Option HSDPA driver for FreeBSD 8. It&#8217;s more or less completely rewritten and there are some visible changes to the interface.</p>
<p>Because ucom(4) has matured it can now be utilized instead of mucking around directly with the TTY layer. This results in that the device names in /dev has changed and are now longer called /dev/HSO*, instead they follow the standard ucom names of cuaU*.</p>
<p>The new USB stack attach USB devices per USB interface instead of per USB device, so it&#8217;s possible to get both a cuaU0 and cuaU1 device (instead of just cuaU0.0 and cuaU0.1). The number of found serial ports can be read through sysctl.</p>
<p>The packet interface is now exposed as a raw interface instead of emulating an Ethernet device (I seriously wonder why I did that&#8230;).</p>
<p>The driver switches automatically from install-cd mode to modem mode, there is no longer any need for manual switching through devd. Please remove the option-icon.conf file from your /usr/local/etc/devd directory.<br />
This can be disabled by setting hw.usb.uhso.auto_switch to 0</p>
<p>And last, I&#8217;ve renamed the driver to uhso to reflect its USB nature.</p>
<p>Download: <a href="/pub/hso/uhso-20091122.tar.gz">uhso-20091122.tar.gz</a> &#8211; Add support for iCON 505, fix probing of devices with dynamic number of interfaces, add new custom attach messages based on the port type.</p>
<p>Download: <a href="/pub/hso/uhsoctl-beta-20090820.tar.gz">uhsoctl-beta-20090820.tar.gz</a> &#8211; uhsoctl connection utility, similar to old hsoctl</p>
<p><span style="text-decoration: line-through;">Download: <a href="/pub/hso/uhso-beta-20090812.tar.gz">uhso-beta-20090812.tar.gz</a></span> &#8211; Minor bug fix and reworked sysctl nodes.</p>
<p><span style="text-decoration: line-through;">Download: <a href="/pub/hso/uhso-beta-20090723.tar.gz">uhso-beta-20090723.tar.gz</a></span> &#8211; No longer PTP interface (completely useless), fixed (hopefully) CDC notification on modem port, added several new device IDs. Thanks to Iain Hibbert for this!</p>
<p><span style="text-decoration: line-through;">Download: <a href="/pub/hso/uhso-beta-20090722.tar.gz">uhso-beta-20090722.tar.gz</a></span> &#8211; Bug fixes that should improve RX speed.</p>
<p><span style="text-decoration: line-through;">Download: <a href="/pub/hso/uhso-beta-20090720.tar.gz">uhso-beta-20090720.tar.gz</a></span></p>
<p><strong>If you own an Option device, please leave a comment (or send a mail) with its full name and USB device ID.</strong></p>
<p><strong>I&#8217;m particularly interested in the following devices iCON 031, iCON 210, iCON 315, iCON 322, iCON 401, iCON 431, iCON 451, iCON 452, iCON 505.</strong></p>
<p><strong>If you&#8217;re running FreeBSD 8 and own an Option device, please mail me the output of<br />
</strong></p>
<blockquote>
<pre>usbconfig -u X -a Y dump_device_desc
usbconfig -u X -a Y dump_all_config_desc</pre>
</blockquote>
<p>where X and Y (5 and 2 below) can be obtained through usbconfig</p>
<blockquote>
<pre># usbconfig
...
ugen5.2: &lt;Globetrotter HSDPA Modem Option N.V.&gt; at usbus5, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON</pre>
</blockquote>
<p><strong>This driver has been tested with a Globesurfer iCON 7.2, iCON 255, iCON 505<br />
</strong></p>
<p><strong>Quick setup for manual connection</strong><br />
<em>uhsoctl works as before!</em></p>
<p>Look up the serial ports</p>
<blockquote>
<pre># sysctl dev.uhso
dev.uhso.0.netif: uhso0
dev.uhso.0.type: Network/Serial
dev.uhso.0.ports: 2
dev.uhso.0.port.control.tty: cuaU0.0
dev.uhso.0.port.control.desc: Control
dev.uhso.0.port.application.tty: cuaU0.1
dev.uhso.0.port.application.desc: Application
...
dev.uhso.1.type: Serial
dev.uhso.1.ports: 1
dev.uhso.1.port.diagnostic.tty: cuaU1
dev.uhso.1.port.diagnostic.desc: Diagnostic</pre>
</blockquote>
<p>Open /dev/cuaU0.0 in a terminal application, for example minicom. Issue the following commands to establish a connection.</p>
<blockquote>
<pre>AT+CPIN="1234" # Your PIN
OK

AT_OWANCALL=1,1,1
OK

AT_OWANDATA=1
_OWANDATA: 1, 95.209.79.126, 0.0.0.0, 80.251.201.177, 80.251.201.178, 0.0.0.0, 0.0.0.0, 72000</pre>
</blockquote>
<p>If you haven&#8217;t configured a PDP context with your providers APN, please see the <a href="http://www.shapeshifter.se/code/hso/">hso page.</a></p>
<p>Configure the interface and set a default route</p>
<blockquote>
<pre># ifconfig uhso0 95.209.79.126
# route add default -interface uhso0</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2009/07/20/uhso4-option-hsdpa-driver-for-freebsd-8/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>PPTP from FreeBSD</title>
		<link>http://www.shapeshifter.se/2009/03/10/pptp-from-freebsd/</link>
		<comments>http://www.shapeshifter.se/2009/03/10/pptp-from-freebsd/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 20:40:05 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Mpd]]></category>
		<category><![CDATA[PPTP]]></category>
		<category><![CDATA[VPN]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=438</guid>
		<description><![CDATA[
Getting FreeBSD to connect to a Windows VPN using PPTP (who designed that protocol anyway?) is not the most pleasant experience, but at least it&#8217;s doable.
The most competent console tool for this in FreeBSD is probably Mpd5. It&#8217;s quite easy to work with but you&#8217;ll need to get all the details right otherwise it just [...]]]></description>
			<content:encoded><![CDATA[<p><!-- WSA: rules for context 'adsense-post-top' did not apply --><br />
Getting FreeBSD to connect to a Windows VPN using <a href="http://en.wikipedia.org/wiki/Pptp">PPTP</a> (who designed that protocol anyway?) is not the most pleasant experience, but at least it&#8217;s doable.</p>
<p>The most competent console tool for this in FreeBSD is probably <a href="http://mpd.sourceforge.net">Mpd5.</a> It&#8217;s quite easy to work with but you&#8217;ll need to get all the details right otherwise it just won&#8217;t work.</p>
<p>The following mpd.conf configuration file worked for me and allowed me to successfully connect to a Windows VPN. One of the keys were to disable EAP, this particular VPN server just plain refused to work with it enabled</p>
<blockquote>
<pre>default:
    load vpn
vpn:
    create bundle static B1
    # Create a default route (use a net/mask to create specific routes)
    set iface route default
    # Script to execute on connect (custom routes etc)
    # set iface up-script /usr/local/etc/route-up.sh
    # Accept any IP-address
    set ipcp ranges 0.0.0.0/0 0.0.0.0/0
    # Microsoft Point-to-Point Compression, only enable if you have a really fast machine
    # set bundle enable compression
    set ccp yes mppc
    set mppc yes e40
    set mppc yes e56
    set mppc yes e128
    create link static L1 pptp
    set link action bundle B1
    # Replace with you credentials or use the mpd.secret file
    set auth authname USERNAME
    set auth password SECRET
    set link max-redial 0
    set link mtu 1460
    set link keep-alive 20 75
    # Hostname/IP of the VPN server
    set pptp peer vpn.example.com
    set pptp disable windowing
    set link no eap</pre>
</blockquote>
<p>Save it to a file, say mpd.conf in /usr/local/etc/mpd.conf and simply run mpd5 mpd.conf and with some luck you&#8217;ll be connected the the VPN.</p>
<p><strong>The order of the statements are important</strong>. As they only apply to the current selected link (create link) or bundle (create bundle). Keep this in mind when editing.</p>
<h4>Windows logon name</h4>
<p>If you&#8217;re connecting to a Windows network you&#8217;ll probably need to use &#8220;DOMAIN\\username&#8221; as the authname (with the quotes and double backslash).</p>
<h4>Firewall and NAT issues</h4>
<p>The PPTP protocol is far from ideal. If you&#8217;re behind NAT chances are you won&#8217;t be able to do multiple PPTP connections to the <em>same</em> VPN server from within your LAN.</p>
<p>You&#8217;ll also need to allow the GRE protocol through, with Free/OpenBSD pf (packet filter) the following line is enough (you still won&#8217;t be able to do simultaneous connections to the same server though)</p>
<blockquote>
<pre>pass out on $ext_if proto gre from ($ext_if) to any keep state</pre>
</blockquote>
<p>Replace $ext_if with your external network interface.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2009/03/10/pptp-from-freebsd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>{hso,hsoctl}-20081023</title>
		<link>http://www.shapeshifter.se/2008/10/23/hso-20081023/</link>
		<comments>http://www.shapeshifter.se/2008/10/23/hso-20081023/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 10:40:27 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[hsdpa]]></category>
		<category><![CDATA[hso]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=380</guid>
		<description><![CDATA[New release of hso(4), FreeBSD driver for Option iCON branded 3G/HSDPA devices.
Changes to hso(4)

Support for the new TTY layer, driver now works with 7.0 upto todays 8.0-CURRENT.
Device IDs for Option GlobeTrotter HSUPA and Option GMT382 added.
Minor performance and stability issues have been addressed.

Changes to hsoctl(1)

hsoctl now forks into background upon a successful connection, the old [...]]]></description>
			<content:encoded><![CDATA[<p>New release of hso(4), FreeBSD driver for Option iCON branded 3G/HSDPA devices.</p>
<p><strong>Changes to hso(4)</strong></p>
<ul>
<li>Support for the new TTY layer, driver now works with 7.0 upto todays 8.0-CURRENT.</li>
<li>Device IDs for Option GlobeTrotter HSUPA and Option GMT382 added.</li>
<li>Minor performance and stability issues have been addressed.</li>
</ul>
<p><strong>Changes to hsoctl(1)</strong></p>
<ul>
<li>hsoctl now forks into background upon a successful connection, the old behvaior can be obtained with -n flag. Disconnection is possible by executing hsoctl -d hso0.  While running in background, important information is logged to syslog.  Complete daemonization is also possible with the -b flag.</li>
<li>Use of AT+CGREG in addition to AT+CREG to detect network registration (for service plans where voice calls are disabled).</li>
<li>resolv.conf handling have been improved, only nameserver entries are changed, other content is left intact. A bug that sometimes caused garbled data to be prepended to resolv.conf have also been addressed.  The resolv.conf path can be altered with the -r flag, disable resolv.conf with -r /dev/null.</li>
<li>hsoctl does now gracefully terminate upon unexpected device removal.</li>
<li>Default route installation have been improved.</li>
</ul>
<p>The code can be obtained from the <a href="http://www.shapeshifter.se/code/hso/">hso page</a>, the update should hit the ports tree soon (<a href="http://www.freshports.org/comms/hso-kmod/">comms/hso-kmod</a>).</p>
<p>Speed test from a rural location. Values are in bits/s, so that&#8217;s almost 300 kB/s downstream and around 40 kB/s upstream. Hopefully downstream is slightly better from a more urban location.</p>
<div id="attachment_387" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.shapeshifter.se/wp-content/uploads/2008/10/338202918.png"><img class="size-full wp-image-387" title="338202918" src="http://www.shapeshifter.se/wp-content/uploads/2008/10/338202918.png" alt="hso(4) speedtest" width="300" height="135" /></a><p class="wp-caption-text">hso(4) speedtest</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2008/10/23/hso-20081023/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Replacing a system disk</title>
		<link>http://www.shapeshifter.se/2008/07/03/replacing-a-system-disk/</link>
		<comments>http://www.shapeshifter.se/2008/07/03/replacing-a-system-disk/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 15:20:35 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[fdisk]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[smart]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=60</guid>
		<description><![CDATA[
I recently had to replace the system disk in a FreeBSD machine (SMART self-tests failed, better be safe than sorry), this is my recipe for an &#8220;online&#8221; replacement. I did this in multi-user mode with all services shut down.

ad4 is the disk that is going to be replaced (ie. the old disk) and ad6 is [...]]]></description>
			<content:encoded><![CDATA[<p><!-- WSA: rules for context 'adsense-post-top' did not apply --><br />
I recently had to replace the system disk in a FreeBSD machine (SMART self-tests failed, better be safe than sorry), this is my recipe for an &#8220;online&#8221; replacement. I did this in multi-user mode with all services shut down.</p>
<p><span id="more-60"></span></p>
<p>ad4 is the disk that is going to be replaced (ie. the old disk) and ad6 is new the new one, the new disk was of identical size so I simply kept the old partition layout.</p>
<p><strong>Be extremely careful when entering your disk names as one command to the wrong disk could make you loose data.</strong></p>
<p>The layout of the old disk looked like this</p>
<pre>Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad4s1a    496M    351M    105M    77%    /
/dev/ad4s1e    496M    213M    243M    47%    /tmp
/dev/ad4s1f    124G     29G     85G    26%    /usr
/dev/ad4s1d    3.9G    1.5G    2.0G    43%    /var</pre>
<p>Make sure the disk is treated as a new one (overwrite old slice information if any, should not be needed if it&#8217;s a brand new drive)</p>
<pre>&gt; <strong>dd if=/dev/zero of=/dev/ad6 bs=512 count=100</strong>
100+0 records in
100+0 records out
51200 bytes transferred in 0.038179 secs (1341054 bytes/sec)</pre>
<p>Create a slice that covers the whole disk and install MBR on the new disk</p>
<pre>&gt; <strong>fdisk -v -B -I -a /dev/ad6</strong></pre>
<p>I was replacing the disk with one of identical size so I just used the same partitions as before, If your disk is larger you&#8217;ll need to adjust your partition sizes.</p>
<p>Read and save the label from the old disk</p>
<pre>&gt; <strong>bsdlabel /dev/ad4s1 &gt; /tmp/label</strong></pre>
<p>Restore the label on the new disk and install boot code</p>
<pre>&gt; <strong>bsdlabel -R /dev/ad6s1 /tmp/label</strong>
&gt; <strong>bsdlabel -B /dev/ad6s1</strong></pre>
<p>I had a slight problem as the new disk which was &#8220;identical&#8221; in size actually was 2 MB larger so I had to adjust the c: partition in /tmp/label to cover the whole disk before restoring it onto the new one. fdisk /dev/ad6 reports the actual size.</p>
<p>Make sure the new partitions look OK and that bsdlabel doesn&#8217;t emit warning about overlapping partitions etc.</p>
<pre>&gt; <strong>bsdlabel /dev/ad6s1</strong>
# /dev/ad6s1:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
a:  1048576        0    4.2BSD     2048 16384     8
b:  4132160  1048576      swap
c: 293046705        0    unused        0     0         # "raw" part, don't edit
d:  8388608  5180736    4.2BSD     2048 16384 28528
e:  1048576 13569344    4.2BSD     2048 16384     8
f: 278423682 14617920    4.2BSD     2048 16384 14080</pre>
<p>As far as partitioning and MBR/boot code the disk should be ready. Now what&#8217;s left is formatting the partition and copying the data.</p>
<p>Create a file system on the / partition, no soft updates.</p>
<pre>&gt; <strong>newfs /dev/ad6s1a</strong></pre>
<p>Create file system for /tmp, /var and /usr with soft updates</p>
<pre>&gt; <strong>newfs -U /dev/ad6s1d</strong>
&gt; <strong>newfs -U /dev/ad6s1e</strong>
&gt; <strong>newfs -U /dev/ad6s1f</strong></pre>
<p>Mount the NEW root onto /mnt (or any other suitable place)</p>
<pre>&gt; <strong>mount /dev/ad1s1a /mnt/</strong></pre>
<p>Do a live level 0 dump of the original / onto the new /</p>
<pre>&gt; <strong>dump -L -0 -f- / | (cd /mnt/ &amp;&amp; restore -r -v -f-)</strong></pre>
<p>Mount the remaining partitions</p>
<pre>&gt; <strong>mount /dev/ad6s1e /mnt/tmp</strong>
&gt; <strong>mount /dev/ad6s1d /mnt/var</strong>
&gt;<strong> mount /dev/ad6s1f /mnt/usr</strong></pre>
<p>And do the dump/restore dance for these partitions as well.</p>
<pre>&gt; <strong>dump -L -0 -f- /tmp | (cd /mnt/tmp &amp;&amp; restore -r -v -f-)</strong>
&gt; <strong>dump -L -0 -f- /var | (cd /mnt/var &amp;&amp; restore -r -v -f-)</strong>
&gt; <strong>dump -L -0 -f- /usr | (cd /mnt/usr &amp;&amp; restore -r -v -f-)</strong></pre>
<p>Now either adjust /mnt/etc/fstab so that the partitions refer to the new disk name (in my case that would have be to replace ad4 with ad6) or simply reconnect the new disk to the old disks&#8217; (s)ata port (this is what I did). Disconnect the old disk and boot the system, it should now be running on the new disk with all data intact.</p>
<p>Depending on how much data there is to copy, down time can be kept to an hour or so.</p>
<p>If it doesn&#8217;t boot? Re-connect the old drive and redo the thing. Installing the boot code is very importat, otherwise it simply won&#8217;t boot.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2008/07/03/replacing-a-system-disk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Book review: Network Administration with FreeBSD 7</title>
		<link>http://www.shapeshifter.se/2008/06/06/network-administration-with-freebsd-7/</link>
		<comments>http://www.shapeshifter.se/2008/06/06/network-administration-with-freebsd-7/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 11:02:15 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[book review]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[network administration]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=56</guid>
		<description><![CDATA[
&#8220;Network Administration with FreeBSD 7&#8243; (paperback, 280 pages) by Babak Farrokhi (farrokhi@) is an excellent walk-through style book that guides the reader to how to perform, both common and uncommon, administration tasks with FreeBSD, ranging from basic system configuration to firewall and network services configurations.
This book is divided into three sections, system configuration, network configuration [...]]]></description>
			<content:encoded><![CDATA[<p><!-- WSA: rules for context 'adsense-post-top' did not apply --><br />
<a href="http://www.shapeshifter.se/wp-content/uploads/2008/06/network-administration-with-freebsd7.jpg"><img class="alignleft size-medium wp-image-59" style="margin: 10px;" title="network-administration-with-freebsd7" src="http://www.shapeshifter.se/wp-content/uploads/2008/06/network-administration-with-freebsd7-243x300.jpg" alt="Network Administration with FreeBSD 7" width="149" height="184" /></a>&#8220;Network Administration with FreeBSD 7&#8243; (paperback, 280 pages) by Babak Farrokhi (farrokhi@) is an excellent walk-through style book that guides the reader to how to perform, both common and uncommon, administration tasks with FreeBSD, ranging from basic system configuration to firewall and network services configurations.</p>
<p>This book is divided into three sections, system configuration, network configuration and network services and together they cover a lot of ground.</p>
<p>Chapter 1 through 4 deals with basic system configuration ranging from partition layout, swap configuration, quotas, software RAID (<a href="http://www.freebsd.org/cgi/man.cgi?query=geom">GEOM</a> framwork) to maintaining and keeping a system updated and secure, not only the FreeBSD system itself but also third party applications.</p>
<p><span id="more-56"></span></p>
<p>Chapter 5 discussion and gives examples of how <a href="http://www.freebsd.org/cgi/man.cgi?query=jail">FreeBSD Jails</a> can be used as semi-virtualization technique to provide better security and isolation to network services.</p>
<p>Chapter 6 gives a few tips and tricks on tuning system performance, both I/O and network performance.</p>
<p>Chapter 7 starts the networking section of the book with basic network configuration.  It deals with basic IP-configuration but also with other exotic protocols such as AppleTalk. It also deals with VLAN (not to get mixed up with WLAN) and hardware assisted TCP/IP checksum calculation.</p>
<p>Chapter 8 continues with how IP-tunnels can be configured using either GRE or IPSec. Excellent discussion on when to use which protocol.</p>
<p>Chapter 9 describes PPP (including PPPoE), both how to setup a client and a server.</p>
<p>Chapter 10 deals with routing and provides example configurations for both static routing, OSPF and BGP using OpenOSPF and OpenBGP.</p>
<p>Chapter 11 shows you how to use and configure IPv6. It also provides a small crash course in IPv6 for readers that are not very familiar with the concepts of IPv6.</p>
<p>Chapter 12 discusses firewall configuration and NAT configuration using both <a href="http://www.freebsd.org/cgi/man.cgi?query=ipfw">IPFW</a> and <a href="http://www.freebsd.org/cgi/man.cgi?query=pf">PF</a>. There is also a small section on traffic shaping with <a href="http://www.freebsd.org/cgi/man.cgi?query=dummynet">dummynet</a> but unfortunately nothing (substantial) on <a href="http://www.freebsd.org/cgi/man.cgi?query=altq">ALTQ</a>.</p>
<p>Chapter 13 and 14 deals with the configuration of various network services ranging from inetd, SSH, NTP, FTP, DHCP, NFS to BIND, Sendmail, Postfix and Apache.</p>
<p>All chapters provide several examples and configuration files as well as heads up warnings and general tips.</p>
<p>It should be stressed that the book is very practical oriented and focuses on how to get services working by providing examples and configuration file excerpts, the reader is assumed to already be somewhat familiar with the topics. Theory is kept to a minimum and for slightly more advanced topics such as OSPF or BGP it&#8217;s recommended to get a book just about that particular topic (If you already don&#8217;t know the theory behind it) because the information given in the book is simply not enough to grasp the whole idea behind these topics/protocols.</p>
<p>Who is this book for? I would say that the target reader is somebody who is already somewhat familiar with FreeBSD and wants to improve their skills in the administration and networking area through a practical approach. The book would also be very useful for administrators of other UNIX-style operating systems such as Linux that wants to move to FreeBSD.  If this description matches you I believe you will find the book quite useful.</p>
<p><a href="http://www.packtpub.com/network-administration-with-freebsd/book">Network Administration with FreeBSD 7 at Packt Publishing</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2008/06/06/network-administration-with-freebsd-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hso(4) in ports</title>
		<link>http://www.shapeshifter.se/2008/05/18/hso-in-ports/</link>
		<comments>http://www.shapeshifter.se/2008/05/18/hso-in-ports/#comments</comments>
		<pubDate>Sun, 18 May 2008 16:21:57 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[hso]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=58</guid>
		<description><![CDATA[Thanks to the great work of Ganaël LAPLANCHE the hso driver and the hsoctl utility can, as of today, be installed through FreeBSD ports from comms/hso-kmod.
Existing users should note that hsod has been renamed to hsoctl and that the utility now properly updates resolv.conf.
Device IDs for the following devices have been added to the driver. [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to the great work of <a href="http://www.martymac.com/">Ganaël LAPLANCHE</a> the <a href="http://www.shapeshifter.se/code/hso/">hso</a> driver and the hsoctl utility can, as of today, be installed through FreeBSD ports from <a href="http://www.freshports.org/comms/hso-kmod/">comms/hso-kmod</a>.</p>
<p>Existing users should note that hsod has been renamed to hsoctl and that the utility now properly updates resolv.conf.</p>
<p>Device IDs for the following devices have been added to the driver. However, this is completely untested, if you have any of these devices, please test and report if it works or not. Thank you.</p>
<ul>
<li>Option GlobeSurfer iCON HSUPA</li>
<li>Option iCON 401</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2008/05/18/hso-in-ports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New version of hso and first version of a connection utility</title>
		<link>http://www.shapeshifter.se/2008/05/04/new-version-of-hso-and-first-version-of-a-connection-utility/</link>
		<comments>http://www.shapeshifter.se/2008/05/04/new-version-of-hso-and-first-version-of-a-connection-utility/#comments</comments>
		<pubDate>Sun, 04 May 2008 19:36:27 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[hso]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=54</guid>
		<description><![CDATA[I&#8217;ve uploaded a new version of the hso driver that fixes some minor bugs related to the TTYs. I&#8217;ve also added device ID for Option GlobeSurfer iCON 225 after some initial positive feedback.
In addition to this I&#8217;ve published the first version of a connection utility (called hsod) that creates and maintains a UMTS/HSDPA connection and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve uploaded a new version of the hso driver that fixes some minor bugs related to the TTYs. I&#8217;ve also added device ID for Option GlobeSurfer iCON 225 after some initial positive feedback.</p>
<p>In addition to this I&#8217;ve published the first version of a connection utility (called hsod) that creates and maintains a UMTS/HSDPA connection and makes life a lot easier. The utility is still beta and requires some more work, for example I would like it to run in background so that it can be launched from devd when the interface is brought up (ifconfig hso0 up).</p>
<p>Both the driver and the connection utility can be found at the <a href="http://www.shapeshifter.se/code/hso/">hso</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2008/05/04/new-version-of-hso-and-first-version-of-a-connection-utility/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>First release of FreeBSD driver for Option HSDPA devices</title>
		<link>http://www.shapeshifter.se/2008/04/22/first-release-of-freebsd-driver-for-option-hsdpa-devices/</link>
		<comments>http://www.shapeshifter.se/2008/04/22/first-release-of-freebsd-driver-for-option-hsdpa-devices/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 21:12:00 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[hsdpa]]></category>
		<category><![CDATA[hso]]></category>
		<category><![CDATA[option]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=48</guid>
		<description><![CDATA[I&#8217;ve published the first public beta of my FreeBSD driver for Option HSDPA modems. The driver is still beta but have been successfully tested (and used) with a Option GlobeSurfer iCON 7.2 S device (using a Turbo 3G account from Tre/Hi3G Access Sweden).
The driver is available for download together with instructions at the hso page. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve published the first public beta of my FreeBSD driver for Option HSDPA modems. The driver is still beta but have been successfully tested (and used) with a Option GlobeSurfer iCON 7.2 S device (using a Turbo 3G account from Tre/Hi3G Access Sweden).</p>
<p>The driver is available for download together with instructions at the <a href="http://www.shapeshifter.se/code/hso">hso</a> page. Please report successes and failures.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2008/04/22/first-release-of-freebsd-driver-for-option-hsdpa-devices/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Mode switching of Option HSDPA cards</title>
		<link>http://www.shapeshifter.se/2008/04/16/mode-switching-of-option-hsdpa-cards/</link>
		<comments>http://www.shapeshifter.se/2008/04/16/mode-switching-of-option-hsdpa-cards/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 19:45:50 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[option]]></category>
		<category><![CDATA[scsi]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=44</guid>
		<description><![CDATA[The newer WWAN (HSDPA/UMTS/3G/whatever) USB devices from Option does not come bundled with CD that carries the drivers, instead they are accessible from a mass storage device, this is marketed as by Option as &#8220;ZeroCD&#8221;.  This also means that the device needs to be &#8220;switched&#8221; from the storage device to the modem/network interface before [...]]]></description>
			<content:encoded><![CDATA[<p>The newer WWAN (HSDPA/UMTS/3G/whatever) USB devices from Option does not come bundled with CD that carries the drivers, instead they are accessible from a mass storage device, this is marketed as by Option as &#8220;ZeroCD&#8221;.  This also means that the device needs to be &#8220;switched&#8221; from the storage device to the modem/network interface before it&#8217;s usable.<span id="more-44"></span></p>
<p>There is a utility called <a href="http://www.draisberghof.de/usb_modeswitch/">usb_modeswitch</a> based around libusb that allows one to switch both Option devices as well as Huwei devices.  Unfortunately  Option devices require a write to a bulk endpoint to a device that already is attached to a driver (umass), this is not possible with libusb in FreeBSD (it only allows such things on ugen devices).  It&#8217;s possible to work around this by unloading umass, attaching the device, and then do the switching.  This is quite annoying, especially if one needs to use any kind of umass devices at the same time.</p>
<p>The magic byte sequence usb_modeswitch is sending to the device is actually a SCSI REZERO (0&#215;01) command (quite suitable for the name ZeroCD <img src='http://www.shapeshifter.se/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ).  Sending such command is possible with the standard camcontrol utility.</p>
<pre>&gt; camcontrol devlist
&lt;Optiarc DVD RW AD-7173A 1-01&gt;     at scbus3 target 0 lun 0 (cd0,pass0)
&lt;ZCOPTION HSDPA Modem 3.00&gt;        at scbus8 target 0 lun 0 (pass1,cd1)</pre>
<p>The WWAN device is at cd1 (ZCOPTION, ZeroCd Option)</p>
<pre>&gt; camcontrol cmd cd1 -c "01 00 00 00 00 00" -i 1 i1
camcontrol: error sending command</pre>
<p>Even though camcontrol reports an error the device is switched properly.  I don&#8217;t know why it reports an error, but my best guess is that the device &#8220;switches&#8221; instantaneously  and the response gets lost.</p>
<pre>umass0: &lt;Option N.V. Globetrotter HSDPA Modem, class 0/0, rev 1.10/0.00,
addr 2&gt; on uhub0
cd1 at umass-sim0 bus 0 target 0 lun 0
cd1: &lt;ZCOPTION HSDPA Modem 3.00&gt; Removable CD-ROM SCSI-2 device
cd1: 1.000MB/s transfers
cd1: Attempt to query device size failed: NOT READY, Medium not present
umass0: BBB reset failed, STALLED
umass0: BBB bulk-in clear stall failed, STALLED
umass0: BBB bulk-out clear stall failed, STALLED
umass0: at uhub0 port 1 (addr 2) disconnected
(cd1:umass-sim0:0:0:0): lost device
(cd1:umass-sim0:0:0:0): removing device entry
umass0: detached
ugen0: &lt;Option N.V. Globetrotter HSDPA Modem, class 255/255, rev 1.10/0.00,
addr 2&gt; on uhub0</pre>
<h3>Glue for devd</h3>
<p>To get automatic switching, put the following in a file called option.conf and place it in /etc/devd/ (create the directory if it doesn&#8217;t exists). Replace product with the correct value for your device, usbdevs -v should report it.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">attach <span style="color: #000000;">100</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    match <span style="color: #ff0000;">&quot;device-name&quot;</span> <span style="color: #ff0000;">&quot;umass[0-9]+&quot;</span>;
    match <span style="color: #ff0000;">&quot;vendor&quot;</span>  <span style="color: #ff0000;">&quot;0x0af0&quot;</span>;
    match <span style="color: #ff0000;">&quot;product&quot;</span> <span style="color: #ff0000;">&quot;0x6911&quot;</span>;
    match <span style="color: #ff0000;">&quot;devclass&quot;</span> <span style="color: #ff0000;">&quot;0x00&quot;</span>;
    action <span style="color: #ff0000;">&quot;sleep 1; /sbin/camcontrol cmd 
<span style="color: #780078;">`/sbin/camcontrol devlist | /usr/bin/grep ZCOPTION | 
/usr/bin/awk '{match($11, /pass[0-9]+/); print substr($11, RSTART, RLENGTH) }'`</span>
-c '01 00 00 00 00 00' -i 1 i1 &gt; /dev/null&quot;</span>;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>;</pre></div></div>

<p>
Restart devd with /etc/rc.d/devd restart</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2008/04/16/mode-switching-of-option-hsdpa-cards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

