FreeNAS on Alix1d

Illustration

I always had a thing for file servers. Usually, I would just take some old machine, throw few hard drives inside and consider it done. However, as I got married, noise of computers became issue. I was just something I didn’t notice before - all my “servers” were noisy like hell. In order to keep wife happy, I decided to invest a little into small machine without any fans. My final decision fell onto PC Engine’s alix1d system board with box1c. While this is not most powerful machine, I considered it’s 500 MHz CPU and 256 MB of RAM enough for a task at hand. I just slammed small 2.5" hard drive inside of box and it was ready to serve.

My first idea was to install Windows Home Server, but there were two problems with it - MSDN subscription didn’t cover it at the time and it’s system requirements (1 GHz processor / 512 MB of memory) were too high for this machine to handle. After some testing, my initial installation was done with Windows Server 2003 and I had it going for quite a while (more than a year actually). However, Windows were not lively on this machine (probably has something to do with slow processor and not enough memory). Since that machine was used only to share files, my though were on giving it a little boost by installing Windows XP on it.

At that time I was preparing setup for one Hyper-V server and in order to do file sharing I decided on FreeNAS. This free solution was quite good for NAS tasks at hand especially because it could fit inside of 128 MB of RAM. That way, I would give it enough to work with and impact on other Hyper-V machines would be minimal. It took me a while to notice that it could be solution for my problem also.

Since my machine has support for Compact Flash, I decided to install FreeNAS on it. With Windows 2003 on hard drive, this would also mean that my original installation will be left intact and a backup solution in case of any problems.

I decided on version 0.7 RC1 which was latest version that I already tested to work in Hyper-V so that gave me confidence to try it on real machine. I was surprised with CD booting process that was painfully slow and after a while it would just stop at:

Using device=/dev/fd0 fstype=msdos to store configuration.

It would stay there no matter how long you wait. Upon pressing Ctrl+Alt+Del it would complain about parsing errors in config.xml and go into shutdown. My first thought was that there is some error on CD. However, same thing repeated with other CD’s with different versions. Only than it occurred to me that I should run it in safe mode.

Once I selected safe mode, CD install was still slow, but it worked. However same issue occurred with booting process on installed version. Only difference was that it was left hanging at:

Starting devd.

Safe mode still helped but since this machine was to be left unattended, it wasn’t really a solution.

Next step was to disable things in BIOS one-by-one and culprit was found in ACPI power management. Once that was turned off, booting process went without a hitch.

I have it installed for a month now and I must say I am satisfied. Temperature of hard drive went from 50°C to 40°C just because of using flash media as system drive and having data drive sleep most of time. While level of comfort is little bit different (scripting in tcsh vs. programming in C#) and, although sometime I miss my remote desktop, this little guy does it’s duties well.

Boarding Time

Illustration

I am always puzzled with airplane boarding times. On each step of a way you are warned that this is essential for timing. Then you come to the gate and wait. And wait.

Since this delay happens so often, one could expect airliners to move boarding time a little. But, of course, boarding time for aircraft with 50 seats and for one with 100 is completely the same.

In this era of computers, is it so hard to check old boarding data and optimize process a little?

P.S. Here I must note one single exception - Malév. That Hungarian airliner is always boarding on time. Why other cannot do the same?

HRESULT

HRESULT (a.k.a. SCODE) is one of data types you will see when playing with COM objects.

Although data type is called result handle, it is not handle to anything. While this may seem like nitpicking, there is one very important difference in case of 64-bit systems. This value is always 32 bits in length (UInt32) while true handle would be either 32 or 64 bits (IntPtr).

Another thing that may strike as unexpected is that result of successful operation is not necessarily 0 as you may expect from your Windows API experience. This value has total of seven sub-types but in reality only three are used.

Severity

If only check whether operation was successful is needed, you can just see state of first bit (31) (SEVERITY_SUCCESS or SEVERITY_ERROR). If that bit is cleared, you are fine. In case of trouble, that bit is set:

bool IsSuccess(uint error) {
    return (error & 0x80000000) != 0x80000000;
}

If you have successful operation, you usually don’t care about other two fields. They are usually only handy when error occurs.

Facility

Second field is facility code that occupies bits from 16 to 26, so some bit-magic is needed:

ushort GetFacilityCode(uint error) {
    return (ushort)((error & 0x07FF0000) >> 16);
}

If you get facility with number less than or equal to 8, you are pretty sure that it originated from Windows. If you have SEVERITY_ERROR and facility value is 0 (FACILITY_NULL), developer was too lazy to assign facility code.

Error code

Third field is most useful one. Bits from 0 to 15 give you real error code:

ushort GetErrorCode(uint error) {
    return (ushort)(error & 0x0000FFFF);
}

In case of errors that originated somewhere in Windows API (and that is a lot of them) this will give you System error code (e.g. ERROR_FILE_NOT_FOUND). Even if error originated from some custom source, you can be almost sure that they reused it for same purpose. From this code you can pretty much deduce where problem lies.

Enjoying Physics

Illustration

Richard Feynman is well known bongo drum player who happened also to be a great theoretical physicist. His areas of work included quantum mechanics and electrodynamics.

Thing that separates him from great deal of big names in Physics is his passion for explaining complex things in simple manner.

Microsoft Research collected some his lectures (The Messenger Series given at Cornell University) in Tuva project. These lectures are definitely something everybody should take a look at.

Lectures are:

  • Law of Gravitation
  • The Relation of Mathematics and Physics
  • The Great Conservation Principle
  • Symmetry in Physical Law
  • The Distinction of Past and Future
  • Probability and Uncertainty - The Quantum Mechanical View of Nature
  • Seeking New Laws

VHD Attach 1.00 (Beta)

Illustration

I wrote quite a lot about virtual disk support in Windows 7. I even gave some C# code on how to use it. Single thing that I haven’t done is to actually make complete program with it. That is changed now.

Idea for this program is quite similar to VhdMount. Difference here is that this program uses native virtual disk support brought to you with Windows 7.

Since I hated necessity of going through Disk Management each time I want to perform attach (a.k.a. mount), there is also right-click support for .vhd files and for already mounted drives. Just select detach on any virtual drive’s context menu and program will find itself which file that is.

Illustration

While this program is not completed yet, I see no reason why you should not test it and check whether you like it.

Download it here.