<?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>Dada's Blog &#187; 作業系統</title>
	<atom:link href="http://blog.urdada.net/category/comp/os/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.urdada.net</link>
	<description>Just for fun</description>
	<lastBuildDate>Fri, 13 Jan 2012 09:14:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>我愛用的免費軟體 (my favorite freeware)</title>
		<link>http://blog.urdada.net/2009/03/02/148/</link>
		<comments>http://blog.urdada.net/2009/03/02/148/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 14:53:02 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>
		<category><![CDATA[軟體]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/?p=148</guid>
		<description><![CDATA[最近已經快滿三年的 Thinkpad X60 跑得越來越慢，又常常當機，所以找個比較有空的時間就把它重灌 Windows XP Professional，順便作一下筆記 灌好作業系統後，可以先把 ThinkVantage System Update 裝起來，這樣 Thinkpad 相關的驅動程式及軟體都可以直接從這邊更新回來。對了，記得不要裝 Client Security Solution 因為裝了真的是自找麻煩! 另外 System Migration Assistant 和 Rescue and Recovery 我也沒裝.. 接下來就是安裝應用程式了，儘可能都以免費的軟體為主: PicPick 是一個很強大的截圖軟體 XnView 看圖及簡單的圖形處理 Paint.NET 是一個短小精幹的繪圖軟體 FileZilla 支援 FTP 及 SFTP 的檔案傳輸軟體 7-Zip 檔案解壓縮工具 K-Lite Codec Pack 播放各種影音檔案 Adobe Reader 閱讀 PDF 文件 Alcohol 52% Free Edition [...]]]></description>
			<content:encoded><![CDATA[<p>最近已經快滿三年的 Thinkpad X60 跑得越來越慢，又常常當機，所以找個比較有空的時間就把它重灌 Windows XP Professional，順便作一下筆記</p>
<p>灌好作業系統後，可以先把 <a href="http://www-307.ibm.com/pc/support/site.wss/TVSU-UPDATE.html" target=_blank>ThinkVantage System Update</a> 裝起來，這樣 Thinkpad 相關的驅動程式及軟體都可以直接從這邊更新回來。對了，記得不要裝 Client Security Solution 因為裝了真的是自找麻煩! 另外 System Migration Assistant 和 Rescue and Recovery 我也沒裝..</p>
<p>接下來就是安裝應用程式了，儘可能都以免費的軟體為主:</p>
<p><a href="http://picpick.wiziple.net/" target=_blank>PicPick</a> 是一個很強大的截圖軟體<br />
<a href="http://www.xnview.com/" target=_blank>XnView</a> 看圖及簡單的圖形處理<br />
<a href="http://www.paint.net/" target=_blank>Paint.NET</a> 是一個短小精幹的繪圖軟體<br />
<a href="http://filezilla-project.org/" target=_blank>FileZilla</a> 支援 FTP 及 SFTP 的檔案傳輸軟體<br />
<a href="http://7-zip.org/" target=_blank>7-Zip</a> 檔案解壓縮工具<br />
<a href="http://www.free-codecs.com/download/K_lite_codec_pack.htm" target=_blank>K-Lite Codec Pack</a> 播放各種影音檔案<br />
<a href="http://www.adobe.com/tw/products/reader/" target=_blank>Adobe Reader</a> 閱讀 PDF 文件</p>
<p><a href="http://trial.alcohol-soft.com/en/" target=_blank>Alcohol 52% Free Edition</a> 虛擬光碟 (裝免費版的即可, 可選擇不裝贊助軟體)<br />
<a href="http://www.free-av.com/" target=_blank>Avira AntiVir</a> 掃毒軟體<br />
<a href="http://ccollomb.free.fr/unlocker/" target=_blank>Unlocker</a> 強制解鎖<br />
<a href="http://rocketdock.com/" target=_blank>RocketDock</a> 像蘋果的工具列<br />
<a href="http://chewing.csie.net/download/win32/" target=_blank>新酷音輸入法</a> (最新版: 0.3.4.8)</p>
<p>其他網路工具包含:</p>
<ul>
<li><a href="http://pank.org/im/" target=_blank>Messenger</a>
<li><a href="http://www.moztw.org/firefox/" target=_blank>Mozilla Firefox</a>
<li><a href="http://www.skype.com/intl/zh-Hant/" target=_blank>Skype</a>
<li><a href="http://pcman.openfoundry.org/" target=_blank>PCMan Lite</a>
<li><a href="http://www.flickr.com/tools/uploadr/" target=_blank>Flickr Uploadr</a>
</ul>
<p>Google 提供的工具:</p>
<ul>
<li><a href="http://www.google.com/chrome" target=_blank>Google Chrome</a>
<li><a href="http://www.google.com/talk/intl/zh-TW/" target=_blank>Google Talk</a>
<li><a href="http://earth.google.com/intl/zh-TW/" target=_blank>Google Earth</a>
<li><a href="http://picasa.google.com.tw/" target=_blank>Picasa</a>
</ul>
<p>另外微軟的 <a href="http://www.microsoft.com/windowsxp/Downloads/powertoys/Xppowertoys.mspx" target=_blank>PowerToys for Windows XP</a> 也有幾個不錯的小工具:</p>
<ul>
<li>CmdHere
<li>PowerToy Calculator
<li>Tweak UI
</ul>
<p>還有之前微軟有提供一個 Microsoft Chinese Date and Time，是一個我很愛用的農民曆及世界時間工具，但現在微軟似乎把連結拿掉了，不過網路上搜尋一下就找到了</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2009/03/02/148/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>一個長整數各自表述 (in 64-bit system)</title>
		<link>http://blog.urdada.net/2008/04/18/85/</link>
		<comments>http://blog.urdada.net/2008/04/18/85/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 14:06:30 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>
		<category><![CDATA[程式語言]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2008/04/18/85/</guid>
		<description><![CDATA[Size of long integer may be different between 64-bit systems (一個長整數各自表述) 不知道是不是我太落伍了... 我一直以為 C/C++ 下面 short, long, long long 三種資料型態都固定是 2, 4, 8 個 bytes 大小。只有 int 這個資料型態會因為 16-bit/32-bit 系統的不同而變成 2 或 4 bytes 的大小，所以理所當然 int 在 64-bit 的電腦也應該會變成 8 bytes (64-bit) 的大小囉 ?! 在整理前一篇文章《Bypass the 2GB file size limit on 32-bit Linux》的時候，讓我驚覺在 64-bit 的系統下，long [...]]]></description>
			<content:encoded><![CDATA[<p>Size of long integer may be different between 64-bit systems (一個長整數各自表述)</p>
<p>不知道是不是我太落伍了...</p>
<p>我一直以為 C/C++ 下面 short, long, long long 三種資料型態都固定是 2, 4, 8 個 bytes 大小。只有 int 這個資料型態會因為 16-bit/32-bit 系統的不同而變成 2 或 4 bytes 的大小，所以理所當然 int 在 64-bit 的電腦也應該會變成 8 bytes (64-bit) 的大小囉 ?!</p>
<p>在整理前一篇文章《<a href=http://blog.urdada.net/2008/04/18/84/ target=_blank>Bypass the 2GB file size limit on 32-bit Linux</a>》的時候，讓我驚覺在 64-bit 的系統下，long 的長度也是各自表述的！</p>
<p>首先，int 的大小即使到了 64-bit 的機器上，大部分的系統仍然使用 4 bytes 的大小而已，這主要是為了避免程式從 32-bit 系統轉換到 64-bit 系統需要修改太多地方</p>
<p>再來，請參考 Wikipedia: <a href=http://en.wikipedia.org/wiki/64-bit#64-bit_data_models target=_blank>64-bit data models</a> 的說明</p>
<p>絕大多數的 UNIX 系統在 64-bit 下面採用 <a href=http://www.unix.org/version2/whatsnew/lp64_wp.html target=_blank>LP64</a> 這種 data model，這時候 long 就不再是固定為 4 bytes 大小，而是變成 8 bytes 的大小了！</p>
<p>然而，Win64 卻不是使用 LP64，而是採用 LLP64 這個 data model，這時候 long 的大小仍然還是 4 bytes</p>
<p><img src=http://farm4.static.flickr.com/3219/2422521769_4f4c50c2f2.jpg /></p>
<p><strong><i>Many 64-bit compilers today use the <strong>LP64</strong> model (including Solaris, AIX, HP, Linux, Mac OS X, and IBM z/OS native compilers). Microsoft's VC++ compiler uses the <strong>LLP64</strong> model.</i></strong></p>
<p>兩種 data model 的最大差異點就是 long 這個資料型態的大小，LP64 是 64-bit，而 LLP64 則是 32-bit</p>
<p>LLP64 data model 基本上可以說跟 32-bit 的系統一樣，唯一差別只有位址(pointer)改成了 64-bit 而已。資料物件(class, structure) 等如果沒有包含 pointer 的成員的話，整個物件的大小是與 32-bit 系統一樣的！</p>
<p>而 LP64 則是除了位址(pointer)改成 64-bit 之外，long 的大小也變成了 64-bit 大小。所以在 UNIX 下面，要把 32-bit 程式 porting 到 64-bit 可能要比 Windows 多花費多一點功夫。</p>
<p>所以呢，我們觀察到兩個問題影響著程式的相容性</p>
<ol>
<li>在 UNIX 下面，long 的大小在 32-bit 與 64-bit 的系統下是不一樣的
<li>同樣是 64-bit 系統，UNIX 與 Windows 對於 long 的大小看法是不一致的
</ol>
<p>為了使程式在 32-bit 與 64-bit 之間以及 UNIX 與 Windows 之間的相容性提昇，改用固定長度的資料型態是寫程式的一個好習慣</p>
<p>在 UNIX 下面，我們可以改用 <a href=http://en.wikipedia.org/wiki/Stdint.h target=_blank>stdint.h</a> 這個 header file 中對於資料型態的定義:</p>
<pre>
int8_t     8-bit signed interger
int16_t    16-bit signed interger
int32_t    32-bit signed interger
int64_t    64-bit signed interger
uint8_t    8-bit unsigned interger
uint16_t   16-bit unsigned interger
uint32_t   32-bit unsigned interger
uint64_t   64-bit unsigned interger
</pre>
<p>在 Windows 下面，則改用下面這些整數固定大小的資料型態</p>
<pre>
INT8       8-bit signed integer
INT16      16-bit signed integer
INT32      32-bit signed integer
INT64      64-bit signed integer
UINT8      8-bit unsigned integer
UINT16     16-bit unsigned integer
UINT32     32-bit unsigned integer
UINT64     64-bit unsigned integer
</pre>
<p>絕對不要再使用 int 和 long 了！</p>
<p>尤其是寫網路程式時，很可能 client 是 Windows 而 server 是 UNIX，然後又有 32-bit 及 64-bit 系統混在裡面，一不小心就發生不相容的問題了...</p>
<p>當然，在 64-bit 的系統下寫程式，要考慮的絕對不只上面這些基本的資料型態。除了 pointer 的大小變成 64-bit 外，許多系統內建函式會用到的 size_t 及 off_t 的大小也變成 64-bit 了.... 寫程式時若有用到這些資料型態，需特別注意，尤其是 casting 時，千萬不要用 32-bit 的整數去裝這些資料，免得造成不可預期的結果！</p>
<p>最後提供一個小程式讓你得知你的系統主要資料型態的大小</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;sys/types.h&gt;</span>
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;sizeof(short)     = %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">short</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;sizeof(int)       = %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;sizeof(long)      = %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">long</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;sizeof(long long) = %d<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">long</span> <span style="color: #993333;">long</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;sizeof(size_t)    = %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>size_t<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;sizeof(off_t)     = %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>off_t<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;sizeof(void *)    = %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>參考資料:</p>
<ol>
<li>Wikipedia: <a href=http://en.wikipedia.org/wiki/64-bit#64-bit_data_models target=_blank>64-bit data models</a>
<li><a href=http://www.unix.org/version2/whatsnew/lp64_wp.html target=_blank>64-Bit Programming Models: Why LP64?</a>
<li><a href=http://technet.microsoft.com/en-us/library/bb496995.aspx target=_blank>Introduction to Win32/Win64</a>
<li><a href=http://softwarecommunity.intel.com/articles/eng/1660.htm target=_blank>Porting 32-bit Applications to the Itanium® Architecture</a>
<li><a href=http://cache-www.intel.com/cd/00/00/01/79/17969_codeclean_r02.pdf target=_blank>Preparing Code for the IA-64 Architecture</a> (PDF)
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2008/04/18/85/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Bypass the 2GB file size limit on 32-bit Linux</title>
		<link>http://blog.urdada.net/2008/04/18/84/</link>
		<comments>http://blog.urdada.net/2008/04/18/84/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 18:18:56 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2008/04/18/84/</guid>
		<description><![CDATA[Bypass the 2GB file size limit on 32-bit Linux (在 Linux 上面突破 2GB 的檔案大小限制) 在 32 位元的 Linux 上面寫超過 2GB 的檔案會發生錯誤，甚至導致程式終止執行 這是因為 Linux 的系統內部處理檔案時用的指標定義為 long，而 long 在 32 位元的系統上的大小為 32 位元，因此最大只能支援 2^31-1 = 2,147,483,647 bytes 等於是 2GB 扣掉 1 byte 的檔案大小 64 位元的系統 (例如 AMD64 或 IA64) 則因為 long 定義成 64 位元，所以不會有問題.. # if __WORDSIZE [...]]]></description>
			<content:encoded><![CDATA[<p>Bypass the 2GB file size limit on 32-bit Linux (在 Linux 上面突破 2GB 的檔案大小限制)</p>
<p>在 32 位元的 Linux 上面寫超過 2GB 的檔案會發生錯誤，甚至導致程式終止執行</p>
<p>這是因為 Linux 的系統內部處理檔案時用的指標定義為 long，而 long 在 32 位元的系統上的大小為 32 位元，因此最大只能支援 2^31-1 = 2,147,483,647 bytes 等於是 2GB 扣掉 1 byte 的檔案大小</p>
<p>64 位元的系統 (例如 <a href=http://en.wikipedia.org/wiki/Amd64 target=_blank>AMD64</a> 或 <a href=http://en.wikipedia.org/wiki/IA64 target=_blank>IA64</a>) 則因為 long 定義成 64 位元，所以不會有問題..</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#  if __WORDSIZE == 64</span>
<span style="color: #993333;">typedef</span> <span style="color: #993333;">long</span> <span style="color: #993333;">int</span> <span style="color: #993333;">int64_t</span><span style="color: #339933;">;</span>
<span style="color: #339933;"># endif</span></pre></div></div>

<p>不過在 FreeBSD 上面，即使是 32 位元的系統，也不會有 2GB 檔案大小的限制，這是因為 FreeBSD 內部處理檔案時，本來就是使用 64 位元的數字當作指標，所以不會有問題</p>
<p>因此在 32 位元的 Linux 上面，程式需要作一些額外處理才能正確寫超過 2GB 的檔案</p>
<p>我們先寫一個小程式來測試一下 (large.c)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;string.h&gt;</span>
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
<span style="color: #339933;">#include &lt;fcntl.h&gt;</span>
<span style="color: #339933;">#include &lt;sys/types.h&gt;</span>
<span style="color: #339933;">#include &lt;sys/stat.h&gt;</span>
<span style="color: #339933;">#include &lt;signal.h&gt;</span>
<span style="color: #339933;">#include &lt;unistd.h&gt;</span>
<span style="color: #339933;">#include &lt;errno.h&gt;</span>
<span style="color: #993333;">void</span> sig_xfsz<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> sig<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;ERROR: SIGXFSZ (%d) signal received!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> sig<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
        <span style="color: #993333;">int</span>     i<span style="color: #339933;">,</span> fd<span style="color: #339933;">;</span>
        <span style="color: #993333;">char</span>    dummy<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4096</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
        signal<span style="color: #009900;">&#40;</span> SIGXFSZ<span style="color: #339933;">,</span> sig_xfsz <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        unlink<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;large.log&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        fd <span style="color: #339933;">=</span> open<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;large.log&quot;</span><span style="color: #339933;">,</span> O_CREAT<span style="color: #339933;">|</span>O_WRONLY<span style="color: #339933;">,</span> <span style="color: #208080;">0644</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        bzero<span style="color: #009900;">&#40;</span> dummy<span style="color: #339933;">,</span> <span style="color: #0000dd;">4096</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #808080; font-style: italic;">/* 2GB = 4KB x 524288 */</span>
        <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span> i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">524287</span> <span style="color: #339933;">;</span> i<span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span>
                write<span style="color: #009900;">&#40;</span> fd<span style="color: #339933;">,</span> dummy<span style="color: #339933;">,</span> <span style="color: #0000dd;">4096</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        write<span style="color: #009900;">&#40;</span> fd<span style="color: #339933;">,</span> dummy<span style="color: #339933;">,</span> <span style="color: #0000dd;">4095</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;large.log: 2147483647 bytes<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> write<span style="color: #009900;">&#40;</span> fd<span style="color: #339933;">,</span> dummy<span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">0</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;ERROR: %s [errno:%d]<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>strerror<span style="color: #009900;">&#40;</span>errno<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>errno<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">else</span>
                <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;large.log: 2147483648 bytes<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        close<span style="color: #009900;">&#40;</span>fd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        exit<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>在 32 位元的 Linux 下面，以上程式編譯後若沒有特殊處理，執行結果如下:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># gcc -o large32 large.c
# ./large32
large.log: 2147483647 bytes
ERROR: SIGXFSZ (25) signal received!
ERROR: File too large [errno:27]</pre></div></div>

<p>在寫第 2147483648 byte 的時候，程式會收到 signal <a href=http://en.wikipedia.org/wiki/SIGXFSZ target=_blank>SIGXFSZ</a>，同時 write() 會回傳 -1 錯誤，errno 則為 27 (File too large)。更甚者，如果程式沒有像上面一樣去處理 SIGXFSZ 的話，內定的 signal handler 甚至會造成程式停止執行並產生 core dump</p>
<p>接下來，我們在編譯同一個程式的時候加入 -D_FILE_OFFSET_BITS=64 再試看看:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># gcc -D_FILE_OFFSET_BITS=64 -o large64 large.c
# ./large64
large.log: 2147483647 bytes
large.log: 2147483648 bytes</pre></div></div>

<p>果然順利突破 2GB 的限制了!</p>
<p>而同樣的程式在 32 位元的 FreeBSD 下面，不論有沒有加這個定義，跑起來都是正確的</p>
<p>不過處理這些大檔案的時候，除了編譯程式時的參數不同外，有些函數的使用上也要作一些調整，例如 fseek() 與 ftell() 這兩個原本使用到 long integer 當作 offset 的函數:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> fseek<span style="color: #009900;">&#40;</span>FILE <span style="color: #339933;">*</span>stream<span style="color: #339933;">,</span> <span style="color: #993333;">long</span> offset<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> whence<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">long</span> ftell<span style="color: #009900;">&#40;</span>FILE <span style="color: #339933;">*</span>stream<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>只要系統是 32 位元，即使是在 FreeBSD 下面，都需要改為使用 off_t 的版本:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> fseeko<span style="color: #009900;">&#40;</span>FILE <span style="color: #339933;">*</span>stream<span style="color: #339933;">,</span> off_t offset<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> whence<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
off_t ftello<span style="color: #009900;">&#40;</span>FILE <span style="color: #339933;">*</span>stream<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>在 Linux 下面，如果 _FILE_OFFSET_BITS 定義為 64，則 off_t 這個型態會自動轉成 64 位元的大小（在 FreeBSD 上面，off_t 本來就是 64 位元的大小)</p>
<p>每種系統支援大於 2GB 的檔案讀寫所需要的編譯選項都會有一些差異，即使是同樣是 Linux 也會因為 32 位元或 64 位元而有不同。有一個簡單的方法可以判斷，就是利用 glibc 提供的 getconf 來取得編譯(compile)以及連結(linking)時所需的參數:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># getconf LFS_CFLAGS
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
# getconf LFS_LDFLAGS 
&nbsp;
#</pre></div></div>

<p>上面是在 32 位元的 Redhat Linux 上面跑出來的結果，代表的是在這個系統上，若要讓程式支援 2GB 的檔案讀寫，編譯(compile)時需要加上 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 這兩個參數，連結(linking)時則不用加任何參數</p>
<p>參考資料:</p>
<ul>
<li><a href=http://www.suse.de/~aj/linux_lfs.html target=_blank>Large File Support in Linux</a>
<li><a href=http://en.wikipedia.org/wiki/Large_file_support target=_blank>LFS: Large File Support</a> (Wikipedia)
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2008/04/18/84/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Change the core dump file name in Linux and FreeBSD</title>
		<link>http://blog.urdada.net/2008/01/02/72/</link>
		<comments>http://blog.urdada.net/2008/01/02/72/#comments</comments>
		<pubDate>Wed, 02 Jan 2008 05:57:02 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2008/01/02/72/</guid>
		<description><![CDATA[Following the previous notes about enabling core dump, here's a note about changing the filename of core dump. In Linux (since Linux 2.6 and 2.4.21) you can change the core dump filename from the file /proc/sys/kernel/core_pattern %% A single % character %p PID of dumped process %u real UID of dumped process %g real GID [...]]]></description>
			<content:encoded><![CDATA[<p>Following the <a href=http://blog.urdada.net/2007/12/31/71/ target=_blank>previous notes</a> about enabling core dump, here's a note about changing the filename of core dump.</p>
<p>In Linux (since Linux 2.6 and 2.4.21)<br />
you can change the core dump filename from the file /proc/sys/kernel/core_pattern</p>
<pre class=mono>
         %%  A single % character
         %p  PID of dumped process
         %u  real UID of dumped process
         %g  real GID of dumped process
         %s  number of signal causing dump
         %t  time of dump (seconds since 0:00h, 1 Jan 1970)
         %h  hostname (same as 'nodename' returned by uname(2))
         %e  executable filename
</pre>
<p>Linux have a default core filename pattern of "core".<br />
Alternatively, if /proc/sys/kernel/core_uses_pid contains a non-zero value, then the core dump file name will include a suffix .PID (process id), ex: core.PID</p>
<p>In FreeBSD, sysctl variable "kern.corefile" controls the filename of core dump.</p>
<pre class=mono>
Any sequence of %N in this filename template will be replaced by
the process name, %P by the processes PID, and %U by the UID.
</pre>
<p>FreeBSD have a default core filename pattern of "%N.core"</p>
<p>You can include path in the filename pattern both in Linux and FreeBSD.<br />
This make it possible to put core dump file in a separated directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2008/01/02/72/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable core dump in Linux and FreeBSD</title>
		<link>http://blog.urdada.net/2007/12/31/71/</link>
		<comments>http://blog.urdada.net/2007/12/31/71/#comments</comments>
		<pubDate>Mon, 31 Dec 2007 00:46:59 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2007/12/31/71/</guid>
		<description><![CDATA[Just a note. You can enable core dump by: [bash] edit /etc/profile ulimit -c unlimited [csh/tcsh] edit /etc/csh.cshrc limit coredumpsize unlimited You can disable core dump by: [bash] edit /etc/profile ulimit -c 0 [csh/tcsh] edit /etc/csh.cshrc limit coredumpsize 0 On FreeBSD, you also need to check the setting of kern.coredump: # sysctl -a &#124;grep kern.coredump [...]]]></description>
			<content:encoded><![CDATA[<p>Just a note.</p>
<p>You can enable <a href=http://en.wikipedia.org/wiki/Core_dump target=_blank>core dump</a> by:</p>
<p>[bash] edit /etc/profile</p>
<pre class=mono>
ulimit -c unlimited
</pre>
<p>[csh/tcsh] edit /etc/csh.cshrc</p>
<pre class=mono>
limit coredumpsize unlimited
</pre>
<p>You can disable <a href=http://en.wikipedia.org/wiki/Core_dump target=_blank>core dump</a> by:</p>
<p>[bash] edit /etc/profile</p>
<pre class=mono>
ulimit -c 0
</pre>
<p>[csh/tcsh] edit /etc/csh.cshrc</p>
<pre class=mono>
limit coredumpsize 0
</pre>
<p>On FreeBSD, you also need to check the setting of kern.coredump:</p>
<pre class=mono>
# sysctl -a |grep kern.coredump
kern.coredump: 0
# sysctl kern.coredump=1
kern.coredump: 0 -> 1
# sysctl -a | grep kern.coredump
kern.coredump: 1
</pre>
<p>You can enforce this setting in /etc/sysctl.conf</p>
<p>[2008/01/01] Thanks for the <a href=http://blog.gslin.org/archives/2007/12/31/1400/ target=_blank>complement</a> from <a href=http://blog.gslin.org/ target=_blank>gslin</a>, kern.sugid_coredump controls the core dump for setuid/setgid process in FreeBSD.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2007/12/31/71/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>消失的硬碟空間</title>
		<link>http://blog.urdada.net/2007/11/20/65/</link>
		<comments>http://blog.urdada.net/2007/11/20/65/#comments</comments>
		<pubDate>Mon, 19 Nov 2007 17:02:32 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>
		<category><![CDATA[程式語言]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[fstat]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[rotation]]></category>
		<category><![CDATA[storage]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2007/11/20/65/</guid>
		<description><![CDATA[話說某一天，一位同事發現某個在 UNIX 上用 C 寫的程式，跑一陣子後似乎會吃掉很多硬碟空間，吃掉的硬碟空間用 du 去算卻跟 df 的結果差異很大，而且把 process 停掉後，空間竟然又自動恢復正常了 最後，用 fstat 去仔細分析，終於找到原因： 已經開啟的檔案，即使開啟中被強制砍掉(unlink)，對原 file descriptor 持續寫入的部份仍會繼續佔用硬碟空間，寫得越多，佔用的空間也越多 實務上最常遇到這種狀況的就是 log rotation，尤其是 rotation 後的舊 LOG 是壓縮過的情況。因為經過 gzip 壓縮過後，原始的 LOG 會被刪除，只留下 XXX.gz。這個時候如果沒有人通知原來寫 LOG 的程式要重新開啟一次 LOG (重新寫一個檔案)，就會導致程式在不知情狀況下繼續寫 LOG，然後空間就莫名其妙被用掉了！ 例如 FreeBSD 下專門作 log rotation 的 newsyslog 設定檔 (newsyslog.conf) 就有個欄位可以設定在 log rotation 後送一個 signal 給 process，而 apache (httpd) 就接受 SIGUSR1 [...]]]></description>
			<content:encoded><![CDATA[<p>話說某一天，一位同事發現某個在 UNIX 上用 C 寫的程式，跑一陣子後似乎會吃掉很多硬碟空間，吃掉的硬碟空間用 du 去算卻跟 df 的結果差異很大，而且把 process 停掉後，空間竟然又自動恢復正常了</p>
<p>最後，用 fstat 去仔細分析，終於找到原因：</p>
<blockquote><p><strong>已經開啟的檔案，即使開啟中被強制砍掉(unlink)，對原 file descriptor 持續寫入的部份仍會繼續佔用硬碟空間，寫得越多，佔用的空間也越多</strong></p></blockquote>
<p>實務上最常遇到這種狀況的就是 log rotation，尤其是 rotation 後的舊 LOG 是壓縮過的情況。因為經過 gzip 壓縮過後，原始的 LOG 會被刪除，只留下 XXX.gz。這個時候如果沒有人通知原來寫 LOG 的程式要重新開啟一次 LOG (重新寫一個檔案)，就會導致程式在不知情狀況下繼續寫 LOG，然後空間就莫名其妙被用掉了！</p>
<p>例如 <a href=http://www.freebsd.org/ target=_blank>FreeBSD</a> 下專門作 log rotation 的 <a href=http://www.freebsd.org/cgi/man.cgi?query=newsyslog&#038;sektion=8 target=_blank>newsyslog</a> 設定檔 (<a href=http://www.freebsd.org/cgi/man.cgi?query=newsyslog.conf&#038;sektion=5&#038;apropos=0&#038;manpath=FreeBSD+6.2-RELEASE target=_blank>newsyslog.conf</a>) 就有個欄位可以設定在 log rotation 後送一個 signal 給 process，而 apache (httpd) 就接受 SIGUSR1 來當作重新開啟 LOG 檔案的訊號（事實上對 apache 而言是 graceful restart）。很多人以為這只是為了讓 LOG 能繼續寫不會漏掉，但其實更重要的是：如果不這麼作，你的硬碟可能很快就爆掉啦...</p>
<p>我們可以寫個簡單的程式來測試一下這種狀況：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;fcntl.h&gt;</span>
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
        <span style="color: #993333;">int</span>     fd<span style="color: #339933;">,</span> i<span style="color: #339933;">;</span>
        <span style="color: #993333;">char</span>    cmd<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">32</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> buf<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        memset<span style="color: #009900;">&#40;</span> buf<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1024</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        snprintf<span style="color: #009900;">&#40;</span>cmd<span style="color: #339933;">,</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>cmd<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;df .&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;==&gt; open file for write and delete it ...<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        fd <span style="color: #339933;">=</span> open<span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">&quot;test-file.log&quot;</span><span style="color: #339933;">,</span> O_CREAT<span style="color: #339933;">|</span>O_WRONLY<span style="color: #339933;">|</span>O_TRUNC <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        unlink<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;test-file.log&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        system<span style="color: #009900;">&#40;</span>cmd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>==&gt; write 100MB to file ...<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span> i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">1000</span><span style="color: #339933;">*</span><span style="color: #0000dd;">100</span> <span style="color: #339933;">;</span> i<span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span>
                write<span style="color: #009900;">&#40;</span> fd<span style="color: #339933;">,</span> buf<span style="color: #339933;">,</span> <span style="color: #0000dd;">1024</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        system<span style="color: #009900;">&#40;</span>cmd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>==&gt; close file ...<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        close<span style="color: #009900;">&#40;</span>fd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        system<span style="color: #009900;">&#40;</span>cmd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>首先，這個小程式會先開啟一個檔案，然後馬上砍掉它（但先不關閉檔案），接下來執行 "df ." 來查看目前硬碟用量。第二步驟是寫入100MB的垃圾資料到這個已開啟的檔案(file descriptor)中，然後再執行 "df ." 來取得硬碟用量。最後關閉檔案後，再執行一次 "df ."。執行結果如下：</p>
<pre class=mono>
==> open file for write and delete it ...
Filesystem  1K-blocks     Used     Avail Capacity  Mounted on
/dev/ad8s1d 144520482 <u>28011428</u> 104947416    21%    /home

==> write 100MB to file ...
Filesystem  1K-blocks     Used     Avail Capacity  Mounted on
/dev/ad8s1d 144520482 <u>28111508</u> 104847336    21%    /home

==> close file ...
Filesystem  1K-blocks     Used     Avail Capacity  Mounted on
/dev/ad8s1d 144520482 <u>28011428</u> 104947416    21%    /home
</pre>
<p>我們可以看到程式寫了100MB之後，空間真的被佔掉了，即使我們已經刪除這個檔案，且從目錄的檔案列表中無法直接看到這個檔案了。而當被開啟的檔案關掉後，這些空間也立即被釋放回來了</p>
<p>接下來我們把程式中的 df 改成 fstat，可以更清楚看到狀況</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="c" style="font-family:monospace;">        snprintf<span style="color: #009900;">&#40;</span>cmd<span style="color: #339933;">,</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>cmd<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;fstat -f -p %d .&quot;</span><span style="color: #339933;">,</span> getpid<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>這是最後的結果：</p>
<pre class=mono>
==> open file for write and delete it ...
USER     CMD     PID   FD MOUNT     INUM MODE         SZ|DV R/W
cdsheen  a.out 91475   wd /home 12694528 drwxr-xr-x    2048  r
cdsheen  a.out 91475 text /home 12694672 -rwxr-xr-x    7910  r
cdsheen  a.out 91475    3 /home 12694673 ----r-x--x       0  w

==> write 100MB to file ...
USER     CMD     PID   FD MOUNT     INUM MODE         SZ|DV R/W
cdsheen  a.out 91475   wd /home 12694528 drwxr-xr-x    2048  r
cdsheen  a.out 91475 text /home 12694672 -rwxr-xr-x    7910  r
cdsheen  a.out 91475    3 /home 12694673 ----r-x--x  <u>102400000</u>  w

==> close file ...
USER     CMD     PID   FD MOUNT     INUM MODE         SZ|DV R/W
cdsheen  a.out 91475   wd /home 12694528 drwxr-xr-x    2048  r
cdsheen  a.out 91475 text /home 12694672 -rwxr-xr-x    7910  r
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2007/11/20/65/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenBSD 4.2 - 有官方安裝光碟了</title>
		<link>http://blog.urdada.net/2007/11/02/61/</link>
		<comments>http://blog.urdada.net/2007/11/02/61/#comments</comments>
		<pubDate>Fri, 02 Nov 2007 00:42:26 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2007/11/02/61/</guid>
		<description><![CDATA[OpenBSD 4.2 just released on Nov 1, 2007! 從這版開始，官方也提供幾個主要硬體的安裝光碟了， 不再像之前一樣需要自己辛苦地製作安裝光碟了 http://ftp.giga.net.tw/OS/OpenBSD/4.2/i386/install42.iso http://ftp.giga.net.tw/OS/OpenBSD/4.2/amd64/install42.iso http://ftp.giga.net.tw/OS/OpenBSD/4.2/macppc/install42.iso http://ftp.giga.net.tw/OS/OpenBSD/4.2/sparc/install42.iso http://ftp.giga.net.tw/OS/OpenBSD/4.2/sparc64/install42.iso 讓大家方便安裝之餘，也請大家有能力的話，多多贊助一下吧]]></description>
			<content:encoded><![CDATA[<p><a href=http://www.openbsd.org/42.html target=_blank>OpenBSD 4.2</a> just released on Nov 1, 2007!</p>
<p>從這版開始，官方也提供幾個主要硬體的安裝光碟了，<br />
不再像之前一樣需要自己辛苦地<a href=http://blog.urdada.net/2007/05/15/39/ target=_blank>製作安裝光碟</a>了</p>
<p><a href=http://ftp.giga.net.tw/OS/OpenBSD/4.2/i386/install42.iso>http://ftp.giga.net.tw/OS/OpenBSD/4.2/i386/install42.iso</a><br />
<a href=http://ftp.giga.net.tw/OS/OpenBSD/4.2/amd64/install42.iso>http://ftp.giga.net.tw/OS/OpenBSD/4.2/amd64/install42.iso</a><br />
<a href=http://ftp.giga.net.tw/OS/OpenBSD/4.2/macppc/install42.iso>http://ftp.giga.net.tw/OS/OpenBSD/4.2/macppc/install42.iso</a><br />
<a href=http://ftp.giga.net.tw/OS/OpenBSD/4.2/sparc/install42.iso>http://ftp.giga.net.tw/OS/OpenBSD/4.2/sparc/install42.iso</a><br />
<a href=http://ftp.giga.net.tw/OS/OpenBSD/4.2/sparc64/install42.iso>http://ftp.giga.net.tw/OS/OpenBSD/4.2/sparc64/install42.iso</a></p>
<p>讓大家方便安裝之餘，也請大家有能力的話，多多<a href=http://www.openbsd.org/donations.html target=_blank>贊助</a>一下吧<br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2007/11/02/61/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenBSD 4.1 - Unofficial ISO Image</title>
		<link>http://blog.urdada.net/2007/05/15/39/</link>
		<comments>http://blog.urdada.net/2007/05/15/39/#comments</comments>
		<pubDate>Tue, 15 May 2007 08:24:04 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2007/05/15/39/</guid>
		<description><![CDATA[OpenBSD 4.1 released! 關於 OpenBSD 4.1 的相關資訊請參考： http://www.openbsd.org/41.html 照例製作了兩份安裝光碟 (包含 i386 與 amd64 兩種平台)，想用的人可以到以下網址抓取 OpenBSD 4.1 Unofficial Images: http://ftp.giga.net.tw/#openbsd 這份光碟是從 OpenBSD 4.1-RELEASE 製作的… 也有用 VMware 裝過沒問題了 同樣的還是要聲明一點，以上可以下載的安裝光碟都不是 OpenBSD 官方的安裝光碟，官方的安裝光碟是要賣錢的，如果你想幫助 OpenBSD 的開發團隊，請考慮購買一份官方的安裝光碟，訂購的資訊請詳閱： http://www.openbsd.org/orders.html]]></description>
			<content:encoded><![CDATA[<p>OpenBSD 4.1 released!</p>
<p>關於 OpenBSD 4.1 的相關資訊請參考： <a href="http://www.openbsd.org/41.html" target="_blank">http://www.openbsd.org/41.html</a></p>
<p>照例製作了兩份安裝光碟 (包含 i386 與  amd64 兩種平台)，想用的人可以到以下網址抓取</p>
<p>OpenBSD 4.1 Unofficial Images: <a href="http://ftp.giga.net.tw/#openbsd" target="_blank">http://ftp.giga.net.tw/#openbsd</a></p>
<p>這份光碟是從  OpenBSD 4.1-RELEASE 製作的…  也有用 VMware 裝過沒問題了</p>
<p>同樣的還是要聲明一點，以上可以下載的安裝光碟都<strong>不</strong>是 OpenBSD  官方的安裝光碟，官方的安裝光碟是要賣錢的，如果你想幫助 OpenBSD  的開發團隊，請考慮購買一份官方的安裝光碟，訂購的資訊請詳閱：</p>
<p><a href="http://www.openbsd.org/orders.html" target="_blank">http://www.openbsd.org/orders.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2007/05/15/39/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OpenBSD 4.0 - Unofficial ISO Image</title>
		<link>http://blog.urdada.net/2006/11/02/5/</link>
		<comments>http://blog.urdada.net/2006/11/02/5/#comments</comments>
		<pubDate>Thu, 02 Nov 2006 12:35:17 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2006/11/02/5/</guid>
		<description><![CDATA[OpenBSD 4.0 released! 關於 OpenBSD 4.0 的相關資訊請參考： http://www.openbsd.org/40.html 昨天下午把檔案 mirror 回來後（ftp.giga.net.tw ～當然 packages 沒有全抓，硬碟空間不夠^^&#124;&#124;），就照例製作了兩份安裝光碟 (包含 i386 與 amd64 兩種平台)，想用的人可以到以下網址抓取 OpenBSD 4.0 Unofficial Images: http://ftp.giga.net.tw/#openbsd 這份光碟是從 OpenBSD 4.0-RELEASE 製作的... 昨天還嘗試用 VMware 裝過沒問題，或許應該把裝好的 VMware Image 也丟上來，可能會造福更多人... 同樣的還是要聲明一點，以上可以下載的安裝光碟都不是 OpenBSD 官方的安裝光碟，官方的安裝光碟是要賣錢的，如果你想幫助 OpenBSD 的開發團隊，請考慮購買一份官方的安裝光碟，訂購的資訊請詳閱： http://www.openbsd.org/orders.html 其實 OpenBSD 4.0 早在九月底十月初就 Ready 了，mirror 的時候就可以發現很多檔案的日期都是一個月前的，隔一個月才把 binary 放出來大概是希望留點時間可以製作官方光碟吧... 有能力的人（或者有辦法決定公司採購預算的人^^）可以考慮贊助個幾張光碟吧]]></description>
			<content:encoded><![CDATA[<p>OpenBSD 4.0 released!</p>
<p>關於 OpenBSD 4.0 的相關資訊請參考： <a href="http://www.openbsd.org/40.html" target="_blank">http://www.openbsd.org/40.html</a></p>
<p>昨天下午把檔案 mirror  回來後（ftp.giga.net.tw ～當然 packages 沒有全抓，硬碟空間不夠^^||），就照例製作了兩份安裝光碟 (包含 i386 與  amd64 兩種平台)，想用的人可以到以下網址抓取</p>
<p>OpenBSD 4.0 Unofficial Images: <a href="http://ftp.giga.net.tw/#openbsd">http://ftp.giga.net.tw/#openbsd</a></p>
<p>這份光碟是從  OpenBSD 4.0-RELEASE 製作的...<br />
昨天還嘗試用 VMware 裝過沒問題，或許應該把裝好的 VMware Image  也丟上來，可能會造福更多人...</p>
<p>同樣的還是要聲明一點，以上可以下載的安裝光碟都<strong>不</strong>是 OpenBSD  官方的安裝光碟，官方的安裝光碟是要賣錢的，如果你想幫助 OpenBSD  的開發團隊，請考慮購買一份官方的安裝光碟，訂購的資訊請詳閱：</p>
<p><a href="http://www.openbsd.org/orders.html" target="_blank">http://www.openbsd.org/orders.html</a></p>
<p>其實 OpenBSD 4.0  早在九月底十月初就 Ready 了，mirror 的時候就可以發現很多檔案的日期都是一個月前的，隔一個月才把 binary  放出來大概是希望留點時間可以製作官方光碟吧... 有能力的人（或者有辦法決定公司採購預算的人^^）可以考慮贊助個幾張光碟吧</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2006/11/02/5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>踩到 FreeBSD 6.1 的地雷...</title>
		<link>http://blog.urdada.net/2006/10/24/7/</link>
		<comments>http://blog.urdada.net/2006/10/24/7/#comments</comments>
		<pubDate>Tue, 24 Oct 2006 03:14:14 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2007/07/21/7/</guid>
		<description><![CDATA[昨天裝了台機器，由於有兩台相同容量的 18G 硬碟，此裝好之後順手替 root partition 加上了 Software RAID.... 沒想到一時疏忽，修改 fstab 時忘了加上 /mirror/ ... /dev/mirror/gm0s1b none swap sw 0 0 /dev/mirror/gm0s1a / ufs rw 1 1 所以重開機時開不起來了... 原本根據 這篇 的說明，只要在 mountroot&#62; prompt 下，重新指定 root partition 位置就可以進去修正了... 但是，沒想到好像踩到 FreeBSD 6.1 的地雷了： kern/98910: [kbd] keyboard not working at mountroot prompt on IBM T42P 也就是 mountroot&#62; 下鍵盤不能動了.... 我用的是研華的伺服器，問題跟上面這個 PR [...]]]></description>
			<content:encoded><![CDATA[<p>昨天裝了台機器，由於有兩台相同容量的 18G 硬碟，此裝好之後順手替 root partition 加上了 <a href="http://blog.urdada.net/2006/02/16/8/" target="_blank">Software RAID</a>....</p>
<p>沒想到一時疏忽，修改 fstab 時忘了加上 /mirror/ ...</p>
<p><code>/dev/<font color="red">mirror</font>/gm0s1b    none    swap  sw  0  0<br />
/dev/<font color="red">mirror</font>/gm0s1a    /       ufs   rw  1  1</code></p>
<p>所以重開機時開不起來了...<br />
原本根據 <a href="http://www.onlamp.com/lpt/a/6309" target="_blank">這篇</a> 的說明，只要在 mountroot&gt; prompt 下，重新指定 root partition  位置就可以進去修正了...</p>
<p>但是，沒想到好像踩到 FreeBSD 6.1 的地雷了：<br />
<a href="http://www.freebsd.org/cgi/query-pr.cgi?pr=98910" target="_blank">kern/98910: [kbd] keyboard not working at mountroot prompt on IBM  T42P</a></p>
<p>也就是 mountroot&gt; 下鍵盤不能動了.... 我用的是研華的伺服器，問題跟上面這個 PR  一模一樣...</p>
<p>偏偏我這台機器的光碟和軟碟又都壞了.... 只好很苦命的再把機器搬出機櫃來拆開，外接光碟重新修正了事....</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2006/10/24/7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeBSD Software RAID-1 (gmirror)</title>
		<link>http://blog.urdada.net/2006/02/16/8/</link>
		<comments>http://blog.urdada.net/2006/02/16/8/#comments</comments>
		<pubDate>Thu, 16 Feb 2006 07:27:43 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2006/02/16/8/</guid>
		<description><![CDATA[手邊某台伺服器的 root 硬碟太小了（只有 8GB），然後上面又丟了很多重要的東西，所以一直想把它給換成大一點的，剛好手邊有一些換下來的 18GB 硬碟備品，就決定來換一下，並玩玩 Software RAID-1 (Mirror) 首先是把系統碟先換到比較大顆的硬碟，步驟請參考： FreeBSD Handbook: How do I move my system over to my huge new disk? 接下來就要玩玩 Software RAID-1 (Mirror) 了 過去 FreeBSD 下面 Software RAID 的作法大多使用 vinum，但 vinum 的用法比較複雜，而且似乎只能適用新的分割區，無法對原有的硬碟直接建立一份 Mirror。 GEOM Mirror (gmirror) 是一種從 FreeBSD 5.3 開始支援的新 Software RAID-1，尤其適用於系統碟 (root partition)。 關於 FreeBSD 下面幾種 Disk Mirroring [...]]]></description>
			<content:encoded><![CDATA[<p>手邊某台伺服器的 root 硬碟太小了（只有 8GB），然後上面又丟了很多重要的東西，所以一直想把它給換成大一點的，剛好手邊有一些換下來的 18GB  硬碟備品，就決定來換一下，並玩玩 Software RAID-1  (Mirror)</p>
<p>首先是把系統碟先換到比較大顆的硬碟，步驟請參考：</p>
<p>FreeBSD Handbook: <a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/disks.html#NEW-HUGE-DISK" target="_blank">How do I move my system over to my huge new disk?</a></p>
<p>接下來就要玩玩 Software RAID-1 (Mirror) 了</p>
<p>過去 FreeBSD 下面 Software RAID  的作法大多使用 <a href="http://www.freebsddiary.org/vinum.php" target="_blank">vinum</a>，但 vinum 的用法比較複雜，而且似乎只能適用新的分割區，無法對原有的硬碟直接建立一份  Mirror。</p>
<p>GEOM Mirror (<a href="http://www.freebsd.org/cgi/man.cgi?query=gmirror" target="_blank">gmirror</a>) 是一種從 <strong>FreeBSD 5.3</strong> 開始支援的新 Software  RAID-1，尤其適用於系統碟 (root partition)。</p>
<p>關於 FreeBSD 下面幾種 Disk Mirroring  的作法，可參考：</p>
<p><a href="http://people.freebsd.org/%7Erse/mirror/" target="_blank">FreeBSD System Disk Mirroring - How to establish a RAID-1 for the  system partitions</a></p>
<p>詳細的作法可參考這篇文章：</p>
<p>ONLamp.com: <a href="http://www.onlamp.com/lpt/a/6309" target="_blank">Using Software RAID-1 with  FreeBSD</a></p>
<p>對舊硬碟設定一下，然後重開機後，把新硬碟加上去，再稍微設定一下，十分鐘內就搞定了！</p>
<p>最方便的是，使用  GEOM Mirror 建立的系統碟在系統內部並不會有特殊設定檔，所有的設定是直接放在硬碟最後一個磁區的 metadata 內，而且使用  gmirror RAID-1 的系統碟可以隨時切換用任何一顆開機，不會有任何問題</p>
<p>除了 <a href="http://www.freebsd.org/cgi/man.cgi?query=gmirror" target="_blank">gmirror</a> 提供 RAID-1 之外，同樣採用 GEOM 架構的程式還有 <a href="http://www.freebsd.org/cgi/man.cgi?query=gstripe" target="_blank">gstripe</a> (RAID-0) 及 <a href="http://www.freebsd.org/cgi/man.cgi?query=graid3" target="_blank">graid3</a>  (RAID-3)，有興趣的人可以玩看看...</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2006/02/16/8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在 Dell PE 2850 上面安裝 FreeBSD 6.0</title>
		<link>http://blog.urdada.net/2005/11/21/43/</link>
		<comments>http://blog.urdada.net/2005/11/21/43/#comments</comments>
		<pubDate>Mon, 21 Nov 2005 08:30:48 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>
		<category><![CDATA[硬體]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2005/11/21/43/</guid>
		<description><![CDATA[公司最近進了一些 Dell PowerEdge 2850 的伺服器... 今天第一次嚐試在 Dell PowerEdge 2850 上面安裝 FreeBSD 6.0 安裝過程並沒有甚麼問題，但是安裝完成、並重新開機之後，發現 console 的鍵盤竟然不能動了！ 同樣的情況似乎也存在於 FreeBSD 5.3 及 FreeBSD 5.4 的樣子（不確定，有人說 FreeBSD 5.3 沒這問題） 經過一番搜尋，發覺是因為這台機器上面有一張 "Dell Remote Access Card (DRAC)"，這個裝置會被系統辨識成一個 USB Keyboard，所以導致開完機之後，正常的 PS/2 鍵盤反而不能動了！ 解決方式如下： 先以 Single User Mode 進入系統 在命令列模式下，先執行下列命令： # fsck -y / # mount -u / 然後編輯 /etc/devd.conf，把對於 USB Keyboard 的支援暫時拿掉，也就是把下面幾行開頭加上 [...]]]></description>
			<content:encoded><![CDATA[<p> 公司最近進了一些 Dell  <a href="http://www1.us.dell.com/content/products/productdetails.aspx/pedge_2850?c=us&amp;cs=28&amp;l=en&amp;s=dfb" target="_blank">PowerEdge 2850</a> 的伺服器...</p>
<p>今天第一次嚐試在 Dell PowerEdge 2850 上面安裝  <a href="http://www.freebsd.org/releases/6.0R/announce.html" target="_blank">FreeBSD 6.0</a></p>
<p>安裝過程並沒有甚麼問題，但是安裝完成、並重新開機之後，發現 console 的鍵盤竟然不能動了！</p>
<p>同樣的情況似乎也存在於 <a href="http://www.freebsd.org/releases/5.3R/announce.html" target="_blank">FreeBSD 5.3</a> 及 <a href="http://www.freebsd.org/releases/5.4R/announce.html" target="_blank">FreeBSD 5.4</a> 的樣子（不確定，有人說 FreeBSD 5.3 沒這問題）</p>
<p>經過一番搜尋，發覺是因為這台機器上面有一張 "Dell Remote Access Card  (<a href="http://www1.us.dell.com/content/topics/global.aspx/power/en/ps2q02_bell?c=us&amp;cs=08&amp;l=en&amp;s=bsdr" target="_blank">DRAC</a>)"，這個裝置會被系統辨識成一個 USB Keyboard，所以導致開完機之後，正常的 PS/2 鍵盤反而不能動了！</p>
<p>解決方式如下：</p>
<ol>
<li>先以 <strong>Single User Mode</strong> 進入系統</li>
<li>在命令列模式下，先執行下列命令：
<pre class="tiny"># fsck -y  /
# mount -u  /</pre>
</li>
<li>然後編輯 <strong>/etc/devd.conf</strong>，把對於 USB Keyboard 的支援暫時拿掉，也就是把下面幾行開頭加上 #
<pre># When a USB keyboard arrives, attach it as the console keyboard ...
#attach 100 {
#       device-name "ukbd0";
#       action "kbdcontrol -k /dev/ukbd0 &lt; /dev/console ...
#};
#detach 100 {
#       device-name "ukbd0";
#       action "kbdcontrol -k /dev/kbd0 &lt; /dev/console";
#};</pre>
</li>
<li>然後輸入 <strong>exit</strong> 離開 Single User Mode 之後，就可以順利進入系統，而且 console 鍵盤也可以正常運作，下次開機也不會有問題！</li>
</ol>
<p>目前看起來，Dell PE-2850 使用 FreeBSD 6.0 當作業系統，除了上面這個 console 鍵盤問題之外，還沒遇到其他問題，系統也還算穩定</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2005/11/21/43/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeBSD 6.0-RELEASE</title>
		<link>http://blog.urdada.net/2005/11/03/44/</link>
		<comments>http://blog.urdada.net/2005/11/03/44/#comments</comments>
		<pubDate>Thu, 03 Nov 2005 02:59:00 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2005/11/03/44/</guid>
		<description><![CDATA[最近 BSD 家族真忙，先是 OpenBSD 3.8 發佈，然後是 NetBSD 2.1，接著 FreeBSD 6.0 又準備要發表了... 官方還沒正式宣佈，也沒得下載，不過 CVS 中已經可以取得 RELENG_6_0_0_RELEASE 了 先把手邊那台機器更新了... FreeBSD flX 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Thu Nov 3 10:15:06 CST 2005 root@flX:/usr/obj/usr/src/sys/flX amd64 然後我的 ASUS A8N-SLI (nForce4) 主機板內建的 Gigabit 網路卡 (nve)，終於可以運作了： nve0: flags=8802&#60;BROADCAST,SIMPLEX,MULTICAST&#62; mtu 1500 ether 00:11:d8:aa:03:7c media: Ethernet autoselect (none) status: no carrier]]></description>
			<content:encoded><![CDATA[<p>最近 BSD 家族真忙，先是 <a href="http://www.openbsd.org/38.html" target="_blank">OpenBSD 3.8</a>  發佈，然後是 <a href="http://www.netbsd.org/Releases/formal-2.0/NetBSD-2.1.html" target="_blank">NetBSD 2.1</a>，接著 FreeBSD 6.0 又準備要發表了...</p>
<p>官方還沒正式宣佈，也沒得下載，不過 CVS 中已經可以取得<strong> RELENG_6_0_0_RELEASE</strong> 了</p>
<p>先把手邊那台機器更新了...</p>
<pre>FreeBSD flX 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Thu Nov  3 10:15:06 CST 2005
     root@flX:/usr/obj/usr/src/sys/flX  amd64</pre>
<p>然後我的 ASUS A8N-SLI (nForce4) 主機板內建的 Gigabit 網路卡  (<a href="http://www.freebsd.org/cgi/man.cgi?query=nve&amp;sektion=4&amp;manpath=FreeBSD+6.0-RELEASE" target="_blank">nve</a>)，終於可以運作了：</p>
<pre>nve0: flags=8802&lt;BROADCAST,SIMPLEX,MULTICAST&gt; mtu 1500
        ether 00:11:d8:aa:03:7c
        media: Ethernet autoselect (none)
        status: no carrier</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2005/11/03/44/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>終於把 NetBSD 2.0.2 裝起來了!</title>
		<link>http://blog.urdada.net/2005/04/21/9/</link>
		<comments>http://blog.urdada.net/2005/04/21/9/#comments</comments>
		<pubDate>Thu, 21 Apr 2005 11:48:55 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2005/04/21/9/</guid>
		<description><![CDATA[經過兩天的努力，終於還是把 NetBSD 2.0.2 裝起來了! 其實本來先測 FreeBSD 5.4-RC3，但是似乎與 ASUS A8N-SLI 主機板 + AMD64 CPU 不太合，而且 sysinstall 竟然抓不太到 SATA 硬碟... 所以最後還是決定玩看看 NetBSD 好了 安裝過程還算順利，就我的感覺，NetBSD 的安裝介面比 FreeBSD 簡單明瞭，第一次接觸的人比較不容易搞混，FreeBSD 的 sysinstall 選項稍微多了一點，新手有時會不知從哪下手! 裝起來後，設定四顆 200G 的 SATA 硬碟費了一些時間，主要是發現 NetBSD 抓到的硬碟順序竟然跟主機 BIOS 的硬碟順序不同... 這一點實在是很奇怪... 開關機不下數十次的反覆測試後終於搞清楚問題，設定好的系統差點被我自己 format 掉... NetBSD 使用的是 pkgsrc 系統，大致是跟 FreeBSD ports 很像，只是 pkgsrc 是裝在 /usr/pkg/ 下面，source 則在 /usr/pkgsrc/ 下面，安裝軟體一樣是 [...]]]></description>
			<content:encoded><![CDATA[<p>經過兩天的努力，終於還是把 <a href="http://www.netbsd.org/Releases/formal-2.0/NetBSD-2.0.2.html">NetBSD  2.0.2</a> 裝起來了!</p>
<p>其實本來先測 <a href="http://www.freebsd.org/releases/5.4R/schedule.html">FreeBSD  5.4-RC3</a>，但是似乎與 ASUS A8N-SLI 主機板 + AMD64 CPU 不太合，而且 <a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/using-sysinstall.html">sysinstall</a>  竟然抓不太到 SATA 硬碟...  所以最後還是決定玩看看 <a href="http://www.netbsd.org/">NetBSD</a>  好了</p>
<p><a href="http://www.netbsd.org/guide/en/chap-exinst.html">安裝過程</a>還算順利，就我的感覺，<a href="http://www.netbsd.org/">NetBSD</a> 的安裝介面比 <a href="http://www.freebsd.org/">FreeBSD</a> 簡單明瞭，第一次接觸的人比較不容易搞混，<a href="http://www.freebsd.org/">FreeBSD</a> 的 <a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/using-sysinstall.html">sysinstall</a>  選項稍微多了一點，新手有時會不知從哪下手!</p>
<p>裝起來後，設定四顆 200G 的 SATA 硬碟費了一些時間，主要是發現 <a href="http://www.netbsd.org/">NetBSD</a> 抓到的硬碟順序竟然跟主機  BIOS 的硬碟順序不同... 這一點實在是很奇怪...   開關機不下數十次的反覆測試後終於搞清楚問題，設定好的系統差點被我自己 format  掉...</p>
<p><a href="http://www.netbsd.org/">NetBSD</a> 使用的是 <a href="http://pkgsrc.org/">pkgsrc</a> 系統，大致是跟 <a href="http://www.freebsd.org/ports/index.html">FreeBSD ports</a> 很像，只是 <a href="http://pkgsrc.org/">pkgsrc</a> 是裝在 /usr/pkg/ 下面，source 則在 /usr/pkgsrc/  下面，安裝軟體一樣是 make install 就好了...   不過使用上還是有點不習慣~~</p>
<p><a href="http://pkgsrc.org/">pkgsrc</a> 的軟體數目還沒有 <a href="http://www.freebsd.org/ports/index.html">FreeBSD ports</a>  多，不過支援的作業系統很多：</p>
<table summary="Platforms supported by pkgsrc" border="1">
<tr>
<td><strong>Platform</strong></td>
<td><strong><font size="2">Date Support Added</font></strong></td>
</tr>
<tr>
<td><a href="http://www.netbsd.org/" target="_top">NetBSD</a></td>
<td align="center">Aug 1997</td>
</tr>
<tr>
<td><a href="http://wwws.sun.com/software/solaris/" target="_top">Solaris</a></td>
<td align="center">Mar 1999</td>
</tr>
<tr>
<td><a href="http://www.kernel.org/" target="_top">Linux</a></td>
<td align="center">Jun 1999</td>
</tr>
<tr>
<td><a href="http://developer.apple.com/darwin/" target="_top">Darwin</a> (<a href="http://developer.apple.com/macosx/" target="_top">Mac OS X</a>)</td>
<td align="center">Oct 2001</td>
</tr>
<tr>
<td><a href="http://www.freebsd.org/" target="_top">FreeBSD</a></td>
<td align="center">Nov 2002</td>
</tr>
<tr>
<td><a href="http://www.openbsd.org/" target="_top">OpenBSD</a></td>
<td align="center">Nov 2002</td>
</tr>
<tr>
<td><a href="http://www.sgi.com/software/irix/" target="_top">IRIX</a></td>
<td align="center">Dec 2002</td>
</tr>
<tr>
<td>BSD/OS</td>
<td align="center">Dec 2003</td>
</tr>
<tr>
<td><a href="http://www-1.ibm.com/servers/aix/" target="_top">AIX</a></td>
<td align="center">Dec 2003</td>
</tr>
<tr>
<td><a href="http://www.microsoft.com/windows/sfu/" target="_top">Interix</a></td>
<td align="center">Mar 2004</td>
</tr>
<tr>
<td><a href="http://www.dragonflybsd.org/" target="_top">DragonFlyBSD</a></td>
<td align="center">Oct 2004</td>
</tr>
<tr>
<td><a href="http://www.tru64.org//" target="_top">OSF/1</a></td>
<td align="center">Nov 2004</td>
</tr>
</table>
<p>看來 <a href="http://pkgsrc.org/">pkgsrc</a> 的目標應該是希望有一天能統一江湖...</p>
<p>至於 NetBSD  系統本身的效能部分，則還沒有時間測試</p>
<p>不過這台機器是拿來當備份機的，所以可能也測不出什麼吧~</p>
<p>想玩的人可以到  <a href="http://ftp.giga.net.tw/#netbsd">GIGA FTP</a> 依據你的硬體平台把 ISO  檔下載回去燒成光碟安裝..<br />
最新版本是 NetBSD 2.0.2</p>
<p>CVS 部分，更新目前似乎都是直接對國外，國內好像找不到比較正式的  mirror..<br />
改天有空在 <a href="http://ftp.giga.net.tw/">GIGA</a> 這邊也弄一份好了...</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2005/04/21/9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>忘記 FreeBSD root 密碼...</title>
		<link>http://blog.urdada.net/2005/03/25/10/</link>
		<comments>http://blog.urdada.net/2005/03/25/10/#comments</comments>
		<pubDate>Fri, 25 Mar 2005 03:10:55 +0000</pubDate>
		<dc:creator>dada</dc:creator>
				<category><![CDATA[作業系統]]></category>

		<guid isPermaLink="false">http://blog.urdada.net/2005/03/25/10/</guid>
		<description><![CDATA[有人糊塗到忘了密碼了，FreeBSD 回復密碼的步驟如下: boot -s # fsck -p # mount -a -t ufs # swapon -a # passwd -l # exit]]></description>
			<content:encoded><![CDATA[<p>有人糊塗到忘了密碼了，FreeBSD 回復密碼的步驟如下:</p>
<p>boot -s<br />
# fsck -p<br />
# mount -a -t ufs<br />
# swapon -a<br />
# passwd -l<br />
# exit</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.urdada.net/2005/03/25/10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

