tag:blogger.com,1999:blog-58445736894711949512024-03-24T08:10:14.882+01:00Hack Something TonightThis blog is dedicated to do it yourself projects and related electronic and programming development.Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.comBlogger31125tag:blogger.com,1999:blog-5844573689471194951.post-8600663673485878162011-07-05T19:26:00.007+02:002011-07-05T19:26:00.254+02:00Seagate Dockstar - Accessible serial and JTAG port<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl_37XlgwBwWvcS9BQPLTQBCQNtjr8G4GLmALiieRNV6d3nzjNPZZihbzKB4YSM6kVRy2PqWvcogW7J1N5pyKrgxz-jReSM8SLd9KzO1i7LJ5Z_fWHL0662yNgeJsvi-kASENfWXmPQj_i/s1600/DockStar_pin_headers.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl_37XlgwBwWvcS9BQPLTQBCQNtjr8G4GLmALiieRNV6d3nzjNPZZihbzKB4YSM6kVRy2PqWvcogW7J1N5pyKrgxz-jReSM8SLd9KzO1i7LJ5Z_fWHL0662yNgeJsvi-kASENfWXmPQj_i/s200/DockStar_pin_headers.jpg" width="105" /></a>Even though usually the Dockstar is accessible <a href="http://hacksomethingtonight.blogspot.com/2011/03/seagate-dockstar-regain-ssh-access.html">via ssh</a> or web interface with <a href="https://openwrt.org/">OpenWRT</a>, sometimes the onboard pin header <a href="http://hacksomethingtonight.blogspot.com/2011/03/seagate-dockstar-regain-ssh-access.html">comes handy</a> either for using the serial console or for <a href="http://www.plugapps.com/forum/viewtopic.php?f=18&t=195">resurrecting a bricked device</a> with JTAG. Therefore it is useful to have the pin header accessible even when the casing is closed. This is not an easy task to make in a nice way due to the clean and elegant look of the device. Previously <a href="http://www.yourwarrantyisvoid.com/2010/07/21/seagate-dockstar-add-an-accessible-serial-port/">this has been done</a> by others with connecting only the serial port pins above one USB port, but I managed with all of the 10 pins as shown below. Be sure to have some 2 row 2.0 mm pitch receptors and headers before beginning this hack!</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Also note that <i><b>the warranty for the device will be void</b></i> after such modification, therefore only do it if you 100% sure what you are doing!</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifqkfvexXaNMzseMNc-ZM2N3xYR-67paveqBA0o8WafivvlAGHjm-CTQL2WCv5541frA3YKlRPalSo0mt6-l1mztB_UPZQCd0B9Zc-ARVKzzQ59i3CWHXUMgnBiYpMmLsSD2tWbNngn-ki/s1600/DockStar_inner_cable.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifqkfvexXaNMzseMNc-ZM2N3xYR-67paveqBA0o8WafivvlAGHjm-CTQL2WCv5541frA3YKlRPalSo0mt6-l1mztB_UPZQCd0B9Zc-ARVKzzQ59i3CWHXUMgnBiYpMmLsSD2tWbNngn-ki/s200/DockStar_inner_cable.jpg" width="200" /></a></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLqSY3cLPc_PkgvUn0ABscC2pyeTIs_-voqBYaNKZO-gP8w3TUgPh4-JXCz_Ky68KV1SU6NcKgRiCrnHfhRXBPe6G0PHzVIpftQwwvhbadI2bef_ssOIOH68JURRSjAQAAaQu2RKl4tJ3f/s1600/DockStar_pin_header_out.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="178" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLqSY3cLPc_PkgvUn0ABscC2pyeTIs_-voqBYaNKZO-gP8w3TUgPh4-JXCz_Ky68KV1SU6NcKgRiCrnHfhRXBPe6G0PHzVIpftQwwvhbadI2bef_ssOIOH68JURRSjAQAAaQu2RKl4tJ3f/s200/DockStar_pin_header_out.jpg" width="200" /></a>First, I soldered a 10-wire ribbon cable between a 2x5 and a 2x7 receptor (both 2 mm pitch). The latter is important to be 2x7, as it will hold itself mechanically with the first and last unoccupied row (see picture on the right). The wire should not be longer than 8 cm, and should be connected in 90 degree to the 2x5 receptor. The point is that by connecting all the corresponding pins, all pins will be accessible from outside with the same wiring scheme as on the onboard header! It is also a good idea to have pin#1 marked with some paint (I used silver marker here). </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPeOVNUM6OjQpnuh54iqHucK7I-UiJw7TmeF3Grjq66jV1RR6C1EzrY5zxQe9cw81HLhCdzKNn6wG73h-dS6Kk8sMP75HUbK2ea8w4y4UkKVrUjKuYcK7zgavf9sfvgKbqnFDFEgsVsQPm/s1600/DockStar_upper_cover.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPeOVNUM6OjQpnuh54iqHucK7I-UiJw7TmeF3Grjq66jV1RR6C1EzrY5zxQe9cw81HLhCdzKNn6wG73h-dS6Kk8sMP75HUbK2ea8w4y4UkKVrUjKuYcK7zgavf9sfvgKbqnFDFEgsVsQPm/s200/DockStar_upper_cover.jpg" width="200" /></a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">As there are some openings on the upper casing, one of them has to be made a little bit bigger, so that the connector will fit in. In my opinion, these holes are merely for design and are not necessary for proper ventilation. Therefore it is appropriate to have them used for our purposes, as this will make virtually no damage on the elegant look of the device. </span></div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUcNyM_lxGj24oRl_g2bsFYMksbbzSJDj2_4K7F1Mj3mlbpnWgtfLcpH0-09D96G47sESZUBRejl6OslA7R_PX73q6ZzoSme5PNZbifoACyTawhb6_cFdbhK6KmUTs07hyG7SftGdcorxk/s1600/DockStar_shielding_cut.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdbuMMH_ITaQGCizrwLN5nhq6wcIXy8FvwAyicdHWrxhPUTwFMgJ1AWI68Ddm6fntqKvDo5G-9b-W18W2PJ0Z1VD86Bt9QrTlt6e4aaqS6Nziem7IsBV5SQOLn7uYbWsiD2s4skJqUCefJ/s1600/DockStar_hole_cut.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdbuMMH_ITaQGCizrwLN5nhq6wcIXy8FvwAyicdHWrxhPUTwFMgJ1AWI68Ddm6fntqKvDo5G-9b-W18W2PJ0Z1VD86Bt9QrTlt6e4aaqS6Nziem7IsBV5SQOLn7uYbWsiD2s4skJqUCefJ/s320/DockStar_hole_cut.jpg" width="320" /></a><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUcNyM_lxGj24oRl_g2bsFYMksbbzSJDj2_4K7F1Mj3mlbpnWgtfLcpH0-09D96G47sESZUBRejl6OslA7R_PX73q6ZzoSme5PNZbifoACyTawhb6_cFdbhK6KmUTs07hyG7SftGdcorxk/s320/DockStar_shielding_cut.jpg" width="320" /></div>
<br />
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">First the upper casing has to be removed, as shown in <a href="http://hacksomethingtonight.blogspot.com/2011/03/seagate-dockstar-teardown.html">my earlier post</a>. Then the metal shielding has to be cut and removed to some extent as shown in the photo on the left. As it is apparent, I chose the side with the reset button, where there is enough space for an additional connector. The unnecessary plastic can easily be removed with a small rasp. First, remove the plastic between the two ventilation holes. Then an additional 3 mm has to be removed from the top as well in order to have the connector fitted above the PCB. It should be checked with both the connector and PCB in place if they indeed fit and if the casing can be closed. If so, then the glue the connector to its place. For this purpose I used a two component epoxy, but other glues that are strong enough can be used as well. </span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhABzdcnC5PwQtcP1G2Y-FuiXEIWu2VC7u9HPiM3UNe98KgReGX9DZ8RUxIT20A5cQGjrFlStH6wgTQWxXVc1GW85VwhGCNDe6vgZ2x1taN1a1c20DWtMq7ShvCzD9IlCo__gT6vY5ajGHN/s1600/DockStar_connector_glued.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhABzdcnC5PwQtcP1G2Y-FuiXEIWu2VC7u9HPiM3UNe98KgReGX9DZ8RUxIT20A5cQGjrFlStH6wgTQWxXVc1GW85VwhGCNDe6vgZ2x1taN1a1c20DWtMq7ShvCzD9IlCo__gT6vY5ajGHN/s320/DockStar_connector_glued.jpg" width="320" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjp2b0zp27GasQaewlPtxA9RGVngQOxwMi-SmxfYGMGWwQot6SrNmVmZOhS0RTx9tigdCvZ8-WEQ_B4LyU_wR7291GgsByLFxFLhekk4rU_X0PQDFVi7VkUljOtIWNG857DPBi2FS6w4MjH/s1600/DockStar_inner_cable_glued.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjp2b0zp27GasQaewlPtxA9RGVngQOxwMi-SmxfYGMGWwQot6SrNmVmZOhS0RTx9tigdCvZ8-WEQ_B4LyU_wR7291GgsByLFxFLhekk4rU_X0PQDFVi7VkUljOtIWNG857DPBi2FS6w4MjH/s320/DockStar_inner_cable_glued.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjp2b0zp27GasQaewlPtxA9RGVngQOxwMi-SmxfYGMGWwQot6SrNmVmZOhS0RTx9tigdCvZ8-WEQ_B4LyU_wR7291GgsByLFxFLhekk4rU_X0PQDFVi7VkUljOtIWNG857DPBi2FS6w4MjH/s1600/DockStar_inner_cable_glued.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><i><b>Be extremely careful</b></i>
however as the glue can go into the holes of the receptor rendering it
unusable afterwards! Here the additional two rows of the connector (one
at the top and one at the bottom) provides additional strength so that
it will not break out. Then the only thing remains is to attach the
other end to the PCB, carefully close the casing and test the serial or
JTAG connection!</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUFv6YW70PxMdYIPtylj1xBaZ3L-oQYERju4O4BVwZ46XsCkd2ux_yCXzTxrPEt1t1MI5uQlpfSoQ6kS9TMxzpPm79l4XtA_Us7j3OyaZ2cC4LN2IjphSGgRYn1eDN6K50FjcJT2LizPCG/s1600/DockStar_assembled.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUFv6YW70PxMdYIPtylj1xBaZ3L-oQYERju4O4BVwZ46XsCkd2ux_yCXzTxrPEt1t1MI5uQlpfSoQ6kS9TMxzpPm79l4XtA_Us7j3OyaZ2cC4LN2IjphSGgRYn1eDN6K50FjcJT2LizPCG/s320/DockStar_assembled.jpg" width="320" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEja-_UlBMVVrsU9kAfDmkTkiA77fvJCGE3JlT4OGaTYm0VXalElxK4HGM2hWE38kqP8wrwLGXmc1Pu-7-1JDk-waoq6SfMmpbIfmjSAAqLiBZCs3kY1LxadiiF_voBT8-gMX8NuFzvg6VqZ/s1600/DockStar_inner_cable_connected.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEja-_UlBMVVrsU9kAfDmkTkiA77fvJCGE3JlT4OGaTYm0VXalElxK4HGM2hWE38kqP8wrwLGXmc1Pu-7-1JDk-waoq6SfMmpbIfmjSAAqLiBZCs3kY1LxadiiF_voBT8-gMX8NuFzvg6VqZ/s320/DockStar_inner_cable_connected.jpg" width="320" /></a></div>
</div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com4tag:blogger.com,1999:blog-5844573689471194951.post-11907257176313266212011-07-02T13:35:00.000+02:002011-07-02T13:35:36.505+02:00Kernel BUG at kernel/timer.c:681 and broken ext4<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
I just ran into a mysterious issue with a <a href="http://www.virtualbox.org/">Virtualbox</a> virtual machine running linux kernel 2.6.37-rc1 (although this might not be kernel specific). After a power outage, reboot always ended with a kernel panic with the following message (among a rather long screen dump):</div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
Clocksource tsc unstable (delta = 784015673 ns)</div>
<div style="font-family: "Courier New",Courier,monospace;">
---[ end trace a732f57055898f20 ]---</div>
<div style="font-family: "Courier New",Courier,monospace;">
Switching to clocksource acpi_pm</div>
<div style="font-family: "Courier New",Courier,monospace;">
Kernel panic - not syncing: Attempted to kill init!</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
[...]</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
kernel BUG at kernel/timer.c:681!</div>
<div style="font-family: "Courier New",Courier,monospace;">
invalid opcode: 0000 [#1]</div>
<div style="font-family: "Courier New",Courier,monospace;">
last sysfs file:</div>
<div style="font-family: "Courier New",Courier,monospace;">
CPU0</div>
<div style="font-family: "Courier New",Courier,monospace;">
Modules linked in:</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
[...]</div>
<br />
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">First, I found </span><a href="http://serverfault.com/questions/47768/clocksource-tsc-unstable" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">many</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> </span><a href="http://ubuntuforums.org/showthread.php?t=1040026" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">forum</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> </span><a href="http://www.linuxquestions.org/questions/linux-software-2/clocksource-tsc-unstable-delta-%3D-75444992-ns-800325/" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">posts</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> stating that tsc clocksource has to be replaced with acpi_pm (or something else) already in GRUB, but this didn't help. Then I figured that in recovery mode, having fsck to repair the root filesystem, puts it back to normal. So: even though it does not seem to be related, a broken filesystem can cause the kernel panic above!</span></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-3274554721265124372011-04-19T22:36:00.001+02:002011-05-09T17:17:49.840+02:00Invisible mouse pointer in Debian Squeeze (Debian 6) - Resolved!<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Previously, <a href="http://hacksomethingtonight.blogspot.com/2011/04/invisible-mouse-pointer-in-debian.html">I wrote</a> about a rather serious bug in Debian 6, which prevented the mouse pointer to appear in any X session. However, upon a sleep or hibernation and recovery the pointer came back. As now I wanted to use the laptop which was affected by this issue, I had to look into the solution as well, as there is nothing on how to resolve this on the bugtracker page. Luckily enough I found a rather good point on <a href="http://www.debian.org/releases/stable/errata">another page</a>. The main point is that <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620857">according to the bugtracker</a>, the Intel video driver is already fixed in the proposed update 2.6.32-32 but it cannot be moved to the mainline. For x86, however, it works just fine so that we can install it. To do so, add two lines to the end of the /etc/apt/sources.list file:</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
deb http://ftp.us.debian.org/debian squeeze-proposed-updates main contrib non-free</div>
<div style="font-family: "Courier New",Courier,monospace;">
deb-src http://ftp.us.debian.org/debian squeeze-proposed-updates main
contrib non-free</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
The domain name can be replaced to match the earlier entries in sources.list. Then as root, simply issue:</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
root@gxa01:~# apt-get update</div>
<div style="font-family: "Courier New",Courier,monospace;">
root@gxa01:~# apt-get upgrade</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">The upgradable packages will be shown and most likely some additional packages such as libc, and apt itself will be upgraded. Then reboot, and enjoy your system with a mouse :) </span></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com2tag:blogger.com,1999:blog-5844573689471194951.post-85262033079951106892011-04-05T21:22:00.002+02:002011-04-19T22:39:07.928+02:00Invisible mouse pointer in Debian Squeeze (Debian 6)<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
I just updated Debian 6 on my computer and have no mouse pointer since then. <a href="http://www.linuxquestions.org/questions/linux-newbie-8/invisible-mouse-cursor-after-updating-debian-squeeze-871208/">Apparently</a> the latest kernel update to 2.6.32.5 <a href="http://forums.debian.net/viewtopic.php?f=6&t=61447">reintroduces a bug</a> that <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=619019">has already been resolved</a>. Many Intel VGA chips are affected, mostly on Centrino and Core platform including the i855GM that my laptop have.</div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
root@gxa01:~# uname -a<br />
Linux gxa01 2.6.32-5-686 #1 SMP Tue Mar 8 21:36:00 UTC 2011 i686 GNU/Linux</div>
<span style="font-family: "Courier New",Courier,monospace;">root@gxa01:~# lspci | grep VGA</span><br />
<span style="font-family: "Courier New",Courier,monospace;">00:02.0 VGA compatible controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)</span><br />
<br />
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Temporary resolution is to put the system into suspend/hibernation after which the pointer reappears. One can also upgrade/downgrade the system, as other kernel versions are reported to work. Anyway the best would be the Debian guys to fix the mainline kernel ;)</span><br />
<br />
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Update: Solution is <a href="http://hacksomethingtonight.blogspot.com/2011/04/invisible-mouse-pointer-in-debian_19.html">here</a>. </span></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-38720641663024411942011-03-23T23:56:00.000+01:002011-03-23T23:56:30.155+01:00Seagate Dockstar - Regain ssh access<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
In my previous <a href="http://hacksomethingtonight.blogspot.com/2011/03/seagate-dockstar-teardown.html">post </a>I mentioned that a newly purchased Dockstar tends to "phone home" and by making automated firmware upgrade, forbids ssh login with the default credentials root/stxadmin. In order no to make this happen, one can dedicate a separated subnet or even a distinguished switch to the Dockstar which is of course cumbersome in home environments where spare switches do not lay around everywhere.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
In this post I first show how to regain ssh access without registering to the Pogoplug web service. Then we will permanently switch off the cloud service responsible for the nasty behavior (I should have done this in the first place). The first part requires some soldering as right now we only have the serial interface. This means that if you just bought the Dockstar, you better jump to the second part of this post and ensure the ssh access. This comes handy as well if you plan to change the factory default firmware afterward.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<b>Serial console</b></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
As embedded boards do not necessary have any video output, a serial connection almost always exists mainly for debugging. Such basic access might come handy if all hell gets loose, and e. g. network connection becomes broken. On the Dockstar <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0u9eFQBkOWqvUha2ufMgjbdGRyEa3q3dG787i7yZuOLBp0AWSHnk1tJ8sILlDyPtnPwhuLhnZamA-GnIAikqC6Nx_hI_Lj_rC7DbaLI_pKUPesPNNhOPJruyRIXV_dhnbK90eIQ-RT-f4/s200/Dockstar_PCB_top.JPG">we find</a> a 2x5 pin header on which we find the <a href="http://www.plugapps.com/forum/viewtopic.php?f=18&t=195">JTAG and serial connection</a>. Here, the important pins are 8 (RxD), 9 (TxD) and 10 (GND). If you are not familiar with this naming scheme, I suggest reading this <a href="http://en.wikipedia.org/wiki/RS-232">Wikipedia article</a>.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1LLclq2T9TfIennODkDIQhOytZaIZRkBOmTIWvOwSjEQOCb84ZVL10P5UuoewpewSZuLrzoyExPZPnCVExXY3Yp5ooKzvBAGVaQ2yEx_JvlhuUtm3C2XsuLzmwOSkO9UQY2y8wQJxnxnM/s1600/putty_dockstar_settings.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="305" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1LLclq2T9TfIennODkDIQhOytZaIZRkBOmTIWvOwSjEQOCb84ZVL10P5UuoewpewSZuLrzoyExPZPnCVExXY3Yp5ooKzvBAGVaQ2yEx_JvlhuUtm3C2XsuLzmwOSkO9UQY2y8wQJxnxnM/s320/putty_dockstar_settings.png" width="320" /></a>Important: the Dockstar serial port voltage levels are 0 to 3.3V, while RS-232 uses -12V to 12V which most likely will damage the board. Therefore never hook the Dockstar serial out to a PC RS-232 port! It is more versatile (and with the extinction of hardware RS-232 ports eventually necessary) to use a USB-serial converter. I used a <a href="http://www.ftdichip.com/Products/ICs/FT232R.htm">FTDI FT232RL</a> based board, however it is easier to use the data cable of some cell phones. There have been success reports with <a href="http://ahsoftware.de/dockstar/#backup">Siemens C55</a> and <a href="http://www.yourwarrantyisvoid.com/2010/07/21/seagate-dockstar-add-an-accessible-serial-port/">Nokia</a> cables. The later is easier to develop, as most the USB-serial converter is already designed, but as I had the FTDI board, I stuck with that one. As for design considerations, there is an interesting concept in the second part of <a href="http://www.yourwarrantyisvoid.com/2010/07/21/seagate-dockstar-add-an-accessible-serial-port/">this post</a> to close the upper cover of the Dockstar with the serial port remaining accessible. It would also be interesting to build the USB-serial electronics inside and connect it the top mini USB plug.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Now, we can either directly solder the corresponding lines or make a converter cable. It is important to hook up the lines in a crossed fashion: Dockstar RxD -- converter TxD and vice versa. GND is GND as always. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI-wL6oxnhVF1pqJGzVNfPwwLn9UFbLxwVv9fr-iwJtq4WyfiwaiaZpwj5PK9OeBRhk6ri_1DV5bm0Gvy78H16e43RjoP8q6gxuJ2eiChf4h6GCg6UbJpm4_Tly75ZLDReiOI1ioE5H0AY/s1600/putty_dockstar_boot.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="196" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI-wL6oxnhVF1pqJGzVNfPwwLn9UFbLxwVv9fr-iwJtq4WyfiwaiaZpwj5PK9OeBRhk6ri_1DV5bm0Gvy78H16e43RjoP8q6gxuJ2eiChf4h6GCg6UbJpm4_Tly75ZLDReiOI1ioE5H0AY/s320/putty_dockstar_boot.png" width="320" /></a></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Now it is time to test the connection: open you favorite serial console program, such as putty, or Windows's built-in HyperTerminal. The serial port settings are 115200 baud, 8 data bits, no parity, 1 stop bit. If everything goes well, you will see Dockstar booting on the console after a power on. If this is not the case, check the connection, and the USB-serial converter settings.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<b>Restarting ssh service</b></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Dockstar uses <a href="http://matt.ucc.asn.au/dropbear/dropbear.html">Dropbear</a> as ssh server, which is a lightweight server and client combined application. For further understanding it is important to know, that startup scripts are located in <span style="font-family: "Courier New",Courier,monospace;">/etc/init.d</span>. More specifically, <span style="font-family: "Courier New",Courier,monospace;">rcS</span> is being executed each time the device boots up. The other scripts in this directory are responsible for the services running on Dockstar. We are particularly interested in <span style="font-family: "Courier New",Courier,monospace;">hbmgr.sh</span> and <span style="font-family: "Courier New",Courier,monospace;">dropbear.sh</span>. The following lines can be executed via the serial console:</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
-sh-3.2# cd /etc/init.d</div>
<div style="font-family: "Courier New",Courier,monospace;">
-sh-3.2# ls -1</div>
<div style="font-family: "Courier New",Courier,monospace;">
db</div>
<div style="font-family: "Courier New",Courier,monospace;">
dropbear.sh</div>
<div style="font-family: "Courier New",Courier,monospace;">
hbmgr.sh</div>
<div style="font-family: "Courier New",Courier,monospace;">
rcS</div>
<div style="font-family: "Courier New",Courier,monospace;">
udhcpc_ra0.sh</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<span style="font-family: "Courier New",Courier,monospace;">hbmgr.sh</span> is the cloud service startup script causing all the pain while <span style="font-family: "Courier New",Courier,monospace;">dropbear.sh</span> is the ssh startup script. Now we need to alter <span style="font-family: "Courier New",Courier,monospace;">rcS</span> to contain the later while removing the first one. In order to make this possible, we have to remount the root filesystem:</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
-sh-3.2# mount -o rw,remount /</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
And then editing <span style="font-family: "Courier New",Courier,monospace;">rcS</span> with a text editor such as vi. For vi, there are <a href="http://www.eng.hawaii.edu/Tutor/vi.html">many</a> <a href="http://www.cs.fsu.edu/general/vimanual.html">good</a> <a href="http://acms.ucsd.edu/info/vi_tutorial.shtml">manuals</a> on the internet, here I only want to add that the vi on Dockstar starts up in command mode, therefore first we need to press 'i' in order to actually type in the file.</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
-sh-3.2# vi rcS</div>
<div style="font-family: "Courier New",Courier,monospace;">
</div>
<div style="font-family: "Courier New",Courier,monospace;">
#! /bin/sh<br /><br />mount -t proc none /proc<br />mount -t sysfs none /sys<br />mount -t devpts none /dev/pts<br />mount -t tmpfs none /tmp<br />mount -t usbfs none /proc/bus/usb<br />mkdir /tmp/var<br /><br />echo "/tmp/core_%e_%t" > /proc/sys/kernel/core_pattern<br /><br />hostname Pogoplug<br /><br />ifconfig lo 127.0.0.1<br />ifconfig eth0 169.254.37.133<br />udhcpc -b `hostname`<br /><br />#telnetd<br />/etc/init.d/db<br />ntpd -g<br />#comment out the following line</div>
<div style="font-family: "Courier New",Courier,monospace;">
#/etc/init.d/hbmgr.sh start<br />#add the following line<br />/etc/init.d/dropbear.sh start<br /><br />#/bin/mount -a </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
When finished, press ESC and then save with typing <span style="font-family: "Courier New",Courier,monospace;">":wq"</span>. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Now it is time to reboot:</div>
<div style="font-family: "Courier New",Courier,monospace;">
-sh-3.2# /sbin/reboot</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
and now Dockstar can be reached via ssh with the default root/stxadmin login which I suggest to change with the <span style="font-family: "Courier New",Courier,monospace;">passwd</span> command. As the cloud service engine was switched off, this will remain the case, so it is now safe to leave the Dockstar plugged on the network. An interesting side effect of the above procedure is that the LED will remain yellow even though the LAN link is up. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Further investigation of hbmgr.sh reveals interesting pieces of information such as lines like <span style="font-family: "Courier New",Courier,monospace;">"modprobe rt3070sta"</span>. I have no idea why this </span><a href="http://www.ralinktech.com/" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Ralink</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> wireless </span><a href="http://www.ralinktech.com/product.php?s=23" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">chipset</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> is included here...</span></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com1tag:blogger.com,1999:blog-5844573689471194951.post-82815882497524025792011-03-09T00:45:00.001+01:002011-03-23T23:58:43.847+01:00Seagate Dockstar - Teardown<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2Vsm3Y7PYGKL1EG3g8l8_vkAPcES9VO3QTaB5O8w0OyRMCxiDAqmUMJXMLLcHzVZ6QFrO18G7IJzIbYLdkYQELFrjwQiausqsyLa7bewCoi1FAcvS7GcpH_EHpMZkiP9Gu4fxdaBqTHJ2/s1600/dockstar_case.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2Vsm3Y7PYGKL1EG3g8l8_vkAPcES9VO3QTaB5O8w0OyRMCxiDAqmUMJXMLLcHzVZ6QFrO18G7IJzIbYLdkYQELFrjwQiausqsyLa7bewCoi1FAcvS7GcpH_EHpMZkiP9Gu4fxdaBqTHJ2/s200/dockstar_case.jpg" width="200" /></a></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
I ordered a <a href="http://www.seagate.com/www/en-us/products/network_storage/freeagent_dockstar/">Seagate Dockstar</a> on ebay as a playground for some experimenting with <a href="http://www.openwrt.org/">OpenWrt</a>. This device is particularly well-equipped compared to similar ARM-based NAS/routers with its 128MB DDR2 SDRAM and 256MB Flash. Sadly though, the original purpose of the Dockstar seems badly established: your local NAS can only be managed through a web interface on <a href="http://dockstar.pogoplug.com/">dockstar.pogoplug.com</a>, with local management support completely missing. I am not really happy with this option as I do not believe that it is safe at all. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Nevertheless the hardware is a state-of-the-art ARM-based board equipped with 4 USB 2.0 ports and gigabit Ethernet interface and strong enough to even support standard linux distributions. <a href="http://www.rudiswiki.de/wiki/DockStarDebian">Debian</a> and <a href="http://ahsoftware.de/dockstar/">Gentoo</a> have already been successfully installed. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
The box itself is nicely designed, the board is in a modern-look minimalistic box. The miniUSB port on the fits in some Seagate's external harddrives, however some third party boxes can be used, too, it takes only a ruler to figure it out.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<b>Important!</b></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Before going any further: NEVER ever connect the Dockstar to a network with public internet access. According to many reports it tends to "phone home", that is making automated software updates. This is a problem because the ssh access gets disabled and only serial console remains. This actually happened to me so consider this issue confirmed! Preventive measures include either a separate switch or subnet dedicated to the device or manually disabling routing to Dockstar on the gateway.<br />
Update: I managed to resolve the problem, ssh access is regained. For details, jump <a href="http://hacksomethingtonight.blogspot.com/2011/03/seagate-dockstar-regain-ssh-access.html">here</a>.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicEERmeBr6OYpZp79z-1ef_nqT5Qpg4k5xoZdL26mk8DWNJU_fW8Q7djC4yMov_F0aQbi4rInBy4IXWOpVxR7gxjlrNc3fG2QwtYGBXcQrG08e_TwHQPFLXu5jfo4z4zEJVrsOUc31fqz3/s1600/dockstar_inside.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicEERmeBr6OYpZp79z-1ef_nqT5Qpg4k5xoZdL26mk8DWNJU_fW8Q7djC4yMov_F0aQbi4rInBy4IXWOpVxR7gxjlrNc3fG2QwtYGBXcQrG08e_TwHQPFLXu5jfo4z4zEJVrsOUc31fqz3/s200/dockstar_inside.jpg" width="200" /></a><b>An inside look </b></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Anyway, let's look inside! The top part of the casing holds with eight claws (two each side). After popping it off, the connector of the top mini USB port has to be removed, and the entire PCB becomes accessible. Below there are the main circuits on the two sides of the PCB that I pinpointed and figured out their purpose. For everyone who likes to visualize things, I have also spotted them on the high-res PCB photos.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<b>Top layer:</b></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0u9eFQBkOWqvUha2ufMgjbdGRyEa3q3dG787i7yZuOLBp0AWSHnk1tJ8sILlDyPtnPwhuLhnZamA-GnIAikqC6Nx_hI_Lj_rC7DbaLI_pKUPesPNNhOPJruyRIXV_dhnbK90eIQ-RT-f4/s1600/Dockstar_PCB_top.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0u9eFQBkOWqvUha2ufMgjbdGRyEa3q3dG787i7yZuOLBp0AWSHnk1tJ8sILlDyPtnPwhuLhnZamA-GnIAikqC6Nx_hI_Lj_rC7DbaLI_pKUPesPNNhOPJruyRIXV_dhnbK90eIQ-RT-f4/s200/Dockstar_PCB_top.JPG" width="200" /></a></div>
<ul style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<li>Marvell <a href="http://www.marvell.com/products/processors/embedded/kirkwood/">Kirkwood</a> 88F6281 ARM926 compatible SoC;</li>
<li>Nanya <a href="http://www.nanya.com/NanyaAdmin/GetFiles.ashx?ID=485">NT5TU64M16DG-AC</a> 128MB DDR2 SDRAM; </li>
<li>Two Marvell dual switching power supply circuits.</li>
</ul>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
On this layer we also find the dual LED, the reset button and the UART/JTAG service header. The supply input is a standard single pin connector with the center pin positive and the shield negative. The factory provided external power supply brick outputs 12V 2A. The serial/JTAG header pitch is 2.0mm, a rarely used standard, however available at most distributors.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2J4-0qqXKlOot5y2EBjFVsJdHC3HhuxLfddz_k5CBO3A2RnNeyIdU096kpeqzw1Zkjq1_nYrE2gUekLpyK7cC9BHW-bBK-5PB0XAWkGp8oLDSxLxw6llK09LZmuFA4WhiRXrzD1sxyogK/s1600/Dockstar_PCB_bottom.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2J4-0qqXKlOot5y2EBjFVsJdHC3HhuxLfddz_k5CBO3A2RnNeyIdU096kpeqzw1Zkjq1_nYrE2gUekLpyK7cC9BHW-bBK-5PB0XAWkGp8oLDSxLxw6llK09LZmuFA4WhiRXrzD1sxyogK/s200/Dockstar_PCB_bottom.JPG" width="200" /></a><b>Bottom layer:</b></div>
<ul style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<li>Marvell Alaska <a href="http://www.marvell.com/products/.../Marvell_Alaska_88E1116R_001.pdf">88E1116R</a> Gigabit Ethernet PHY; </li>
<li>Micron 29F2G08AAD 256MB Flash;</li>
<li>Genesys <a href="http://www.genesyslogic.com/_en/product_01_1.php?id=42">GL850G</a> 4way USB 2.0 hub;</li>
<li>Atmel AT24C02B I2C EEPROM;</li>
<li>Monolithic MP8708 switching power supply;</li>
<li>Marvell 88PG8227 dual switching power supply.</li>
</ul>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com2tag:blogger.com,1999:blog-5844573689471194951.post-15554536527770192992011-02-20T13:31:00.000+01:002011-02-20T13:31:18.102+01:00Vintage hard drives - Seagate ST-251<div style="text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
As the storage capacity of the hard disk drives emerges with no apparent limit (all hail <a href="http://en.wikipedia.org/wiki/Moore%27s_law#Other_formulations_and_similar_laws">Moore's law</a>), old disks get obsolete no matter how ground-breaking they were a couple of years ago. I decided to collect some of the old hard disk drives here so that at least their memory would be conserved. The only selection rule for showing an old HDD I had is that I have to have that one somewhere at home :) so my choices will <b>not</b> be equalized in any sense, including technology, manufacturer and so on.</div>
<br />
<div style="text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEvRk86t1p-nKyXFs1M05H23aRJW2yhOrcoS2KSSJ6V59tUmnq-U9KQClpakdaxCIEEEvGJXIXTLk2C64d-Hw21JV-hsXOCfQE_N_0N7At334j7mYpYBfq-1qLms-ZhOdeDrwP5eQ_LaZI/s1600/ST251_front.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="140" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEvRk86t1p-nKyXFs1M05H23aRJW2yhOrcoS2KSSJ6V59tUmnq-U9KQClpakdaxCIEEEvGJXIXTLk2C64d-Hw21JV-hsXOCfQE_N_0N7At334j7mYpYBfq-1qLms-ZhOdeDrwP5eQ_LaZI/s200/ST251_front.JPG" width="200" /></a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">The first one I found is a </span><a href="http://www.seagate.com/www/en-us/" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Seagate</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> ST-251 from 1994. Using </span><a href="http://en.wikipedia.org/wiki/Modified_Frequency_Modulation" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">MFM coding</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">, this device was capable of a fantastic 40MB storage space using 6 heads on 3 plates. The maximum transfer rate is 625KB/s with its ST-412 MFM controller. It is an interesting fact that Seagate keeps a good record of its old products, even such an old device is on their webpage </span><a href="http://www.seagate.com/ww/v/index.jsp?vgnextoid=7466c6ea20fbd010VgnVCM100000dd04090aRCRD&locale=en-US&reqPage=Legacy#" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">here</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">.</span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
These 5.25" units with their massive metallic case indeed represent some sort of everlasting elegance :) </div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiM0BA0TY1iD88SkBF_hRQYBlclHzsFIqo6X4aoNLhvpGj95fcV2KO3gNxBseoyUe1jdi6njcQJ_s0VbQA7lsUCipwy8XSOqz5L3k7tgXygd9g0QVkad9siCpnHp81hiEqdb5PEksii5cBe/s1600/ST251_electronics_down.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiM0BA0TY1iD88SkBF_hRQYBlclHzsFIqo6X4aoNLhvpGj95fcV2KO3gNxBseoyUe1jdi6njcQJ_s0VbQA7lsUCipwy8XSOqz5L3k7tgXygd9g0QVkad9siCpnHp81hiEqdb5PEksii5cBe/s320/ST251_electronics_down.JPG" width="320" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5uLoZvCTqPAzyB2AD73CALfrljiy5Aruue69yMA7zJaR2HPWaPbdlazbu4d4WnSSdWs7HEXOcFf3W4ij48KViVaSNNqMnnF7MLnNITLSx-cX2mOHHhj_becTLIxR_uz38if7r-KuKWHnN/s1600/ST251_electronics_up.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5uLoZvCTqPAzyB2AD73CALfrljiy5Aruue69yMA7zJaR2HPWaPbdlazbu4d4WnSSdWs7HEXOcFf3W4ij48KViVaSNNqMnnF7MLnNITLSx-cX2mOHHhj_becTLIxR_uz38if7r-KuKWHnN/s320/ST251_electronics_up.JPG" width="320" /></a></div>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Even though the electronics of the hard drive was restricted to the most basic functionality (and the rest was done by the control card) it seems quite complex: many application-specific ICs and lots of miscellaneous circuit elements can be spotted.</div>
<br />
<div style="text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0XmygKH1dda57vku-T4Ngmo91BGr6nom5apUYki-SE33_Uqf8ZbMBZjFkyMmmiFeTCtCEyzKcoTTkGKapNX-AbkGAORfkemmIpd2zj7UoMEr4hG92wGnh-PkB-AvusJAiiEmqOHathQBM/s1600/ST251_interface.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0XmygKH1dda57vku-T4Ngmo91BGr6nom5apUYki-SE33_Uqf8ZbMBZjFkyMmmiFeTCtCEyzKcoTTkGKapNX-AbkGAORfkemmIpd2zj7UoMEr4hG92wGnh-PkB-AvusJAiiEmqOHathQBM/s200/ST251_interface.JPG" width="200" /></a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">The PCB connector itself is a long time extinct part: on the left, the 34 pol connector is allocated for the MFM control signals, whereas the 20 pol on the right is for the MFM data R/W signals. The jumpers in the middle are dedicated to set the address of the drive, making it possible to chain up to 4 drives in a computer. Note that the power connector is already the standard PATA 4 pin connector supplying 5V/12V. An interesting consequence of the separate control card is that the bad sectors found during factory testing are printed on the case of the drive with the corresponding </span><a href="http://en.wikipedia.org/wiki/Cylinder-head-sector" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">C/H/S</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> values. Nowadays such maps are stored by the HDD electronics.</span></div>
<div style="text-align: justify;">
<br /></div>
<br />
<div style="text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQv8bcNzKJ-zfz7fOzSFjbEn18w2HjGDmvjIyYLYRf7z1RJiNjEqtPXX17_Ie4hK6XCBcetGNbUgp2cPEISSSbrosGfTDV0wxLvbzPSouZniuZThgx6x6XOPHupoPB_-p5ovvQz1n3Ns5H/s1600/ST251_error_map.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="93" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQv8bcNzKJ-zfz7fOzSFjbEn18w2HjGDmvjIyYLYRf7z1RJiNjEqtPXX17_Ie4hK6XCBcetGNbUgp2cPEISSSbrosGfTDV0wxLvbzPSouZniuZThgx6x6XOPHupoPB_-p5ovvQz1n3Ns5H/s320/ST251_error_map.JPG" width="320" /></a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">After removing the PCB, we get a good sight to the two motors. The one in the middle spins the plates at 3600 rpm and is most likely a </span><a href="http://en.wikipedia.org/wiki/Brushless_DC_electric_motor" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">brushless 3 phase motor</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">. The other one in the corner is a </span><a href="http://en.wikipedia.org/wiki/Stepper_motor" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">stepper motor</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> and moves the R/W heads above the plates. While steppers have eventually been replaced by more compact and lightweight solutions, the plate spinner motors are essentially the same even nowadays (they might be a bit smaller though). </span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVzgEX_OW4ENthbzhdguG-lqSZO7HMg5Jt7CQd0LUklTZBVp6AqtWjR7_FMvLqcpC5DgAHhAZ-bkHStkmluGvJaymwsfRqeUjI_pWRX4SvVOIG7hEehNnKzmnOKsMuVvGgbpFGj5PwYocx/s1600/ST251_motors.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVzgEX_OW4ENthbzhdguG-lqSZO7HMg5Jt7CQd0LUklTZBVp6AqtWjR7_FMvLqcpC5DgAHhAZ-bkHStkmluGvJaymwsfRqeUjI_pWRX4SvVOIG7hEehNnKzmnOKsMuVvGgbpFGj5PwYocx/s320/ST251_motors.JPG" width="320" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1fVtjFK7lJqyFXn-9jqomBLgbeYz52IGdeAHRAgPYYeCF-2RiNKA9fsYinszJHsBbqjUJn6SIjKXW5MZo-TDxS8dbTREVp_PBM0oEgvpw_bIBo5zw5Y6FTYR0ltljYUwdJl-tTYx6JP88/s1600/ST251_stepper_inside.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1fVtjFK7lJqyFXn-9jqomBLgbeYz52IGdeAHRAgPYYeCF-2RiNKA9fsYinszJHsBbqjUJn6SIjKXW5MZo-TDxS8dbTREVp_PBM0oEgvpw_bIBo5zw5Y6FTYR0ltljYUwdJl-tTYx6JP88/s320/ST251_stepper_inside.JPG" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtqSPYRHLUDwzF-5BYSLXaO5WKVdNa45rjYeglIvLTnozgIhgZGJ9FCztcsmr8FBIzsN49oqt0aBtUUMHFTAxc07X_Tn8WTcZbZdwpr30rmwVjPueGd8_rIJbHPDhxeToE7gwhcSuzVRtP/s1600/ST251_inside.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtqSPYRHLUDwzF-5BYSLXaO5WKVdNa45rjYeglIvLTnozgIhgZGJ9FCztcsmr8FBIzsN49oqt0aBtUUMHFTAxc07X_Tn8WTcZbZdwpr30rmwVjPueGd8_rIJbHPDhxeToE7gwhcSuzVRtP/s320/ST251_inside.JPG" width="320" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoo3od4oMntW6vOaPk10xGXlfMQB1fYOSnov-rmn_OiDVM0rKZQcrnBU1rSGM5jo2lSpqx46B1jBz1Fxbnlknlws0OvHOfDFee7mcj5WsH7kSbFlHpG5uCnbJjSkqo2Md_gxGxgbisg-mb/s1600/ST251_head.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoo3od4oMntW6vOaPk10xGXlfMQB1fYOSnov-rmn_OiDVM0rKZQcrnBU1rSGM5jo2lSpqx46B1jBz1Fxbnlknlws0OvHOfDFee7mcj5WsH7kSbFlHpG5uCnbJjSkqo2Md_gxGxgbisg-mb/s320/ST251_head.JPG" width="320" /></a></div>
<div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
These old and robust devices did not really follow today's trend of being low-power and silent. According to the data sheet, it consumes up to 12W and has a characteristic head-bang noise when starting up which is a result of the head calibration process in order to find track0. As a conclusion watch the video I made with the clean area cover removed so that we can see what is going on.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />
<object height="405" width="500"><param name="movie" value="http://www.youtube.com/v/vTu-1dLegzI?fs=1&hl=en_US&rel=0&border=1">
</param>
<param name="allowFullScreen" value="true">
</param>
<param name="allowscriptaccess" value="always">
</param>
<embed src="http://www.youtube.com/v/vTu-1dLegzI?fs=1&hl=en_US&rel=0&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="405"></embed></object>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com4tag:blogger.com,1999:blog-5844573689471194951.post-31787351807675311532011-02-12T15:55:00.000+01:002011-02-12T15:55:54.816+01:00MRTG lang=C why and howto<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
In my previous <a href="http://hacksomethingtonight.blogspot.com/2010/11/lm-sensors-in-net-snmp.html">post</a> on MRTG, I showed how to plot various sensor and network traffic readings so that they can be easily visualized.
In modern systems one can however run into another problem: in UTF-8 enviroments, MRTG starts to complain: </div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
~#:echo $LANG </div>
<div style="font-family: "Courier New",Courier,monospace;">
en_us.UTF-8 </div>
<div style="font-family: "Courier New",Courier,monospace;">
~#:mrtg </div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
ERROR: Mrtg will most likely not work propperly when the environment
<br /> variable LANG is set to UTF-8. Please run mrtg in an
environment
<br /> where this is not the case:
<br />
<br /> env LANG=C /usr/bin/mrtg </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
So we shall use the command line given above. However, simply setting <span style="font-family: "Courier New",Courier,monospace;">LANG=C</span> turns out not be enough, and we get further error messages with <a href="http://hacksomethingtonight.blogspot.com/2010/02/wd-mybook-hacks-mrtg.html">previously working</a> mrtg.cfg file such as follows: </div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
~#:env LANG=C /bin/mrtg /etc/mrtg/mrtg.cfg --logging /var/log/mrtg.log </div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
...</div>
<div style="font-family: "Courier New",Courier,monospace;">
2010-11-26 16:05:22 -- SNMPGET Problem for hrSystemUptime.0 sysName on public@localhost<br /> at /bin/mrtg line 658<br />2010-11-26 16:05:22 -- 2010-11-26 16:05:12: ERROR: Target[localhost.cpu0][_IN_] ' $target->[1]{$mode} ' did not eval into defined data<br />2010-11-26 16:05:22 -- 2010-11-26 16:05:12: ERROR: Target[localhost.cpu0][_OUT_] ' $target->[1]{$mode} ' did not eval into defined data<br />2010-11-26 16:05:32 -- SNMP Error: </div>
<span style="font-family: "Courier New",Courier,monospace;">no response received </span><br />
<br />
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">The problem turns out to be that the textual SNMP targets do not work anymore, and the </span><a href="http://en.wikipedia.org/wiki/Object_identifier" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">numeric OIDs</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> such as .1.3.6.1.2.1.25.3.3.1.2.768 have to be put in mrtg.cfg. Not only this is inconvenient, the proper numeric values have to be found as well. In order to do so, the </span><a href="http://www.net-snmp.org/tutorial/tutorial-5/commands/snmptranslate.html" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">snmptranslate</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> tool can be used:</span></div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
~#: snmptranslate HOST-RESOURCES-MIB::hrProcessorLoad.768 -On</div>
<div style="font-family: "Courier New",Courier,monospace;">
.1.3.6.1.2.1.25.3.3.1.2.768</div>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Here the main point is the -On switch, which translates the name of the OID to the corresponding numerical value. All textual targets in mrtg.cfg must be replaced using the output of this tool. This includes the previously <a href="http://hacksomethingtonight.blogspot.com/2010/11/lm-sensors-in-net-snmp.html">discussed</a> <a href="http://www.lm-sensors.org/">lm-sensors</a> outputs as well. Here is an example for CPU usage: </div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
# commented old one</div>
<div style="font-family: "Courier New",Courier,monospace;">
#Target[localhost.cpu0]: hrProcessorLoad.768&hrProcessorLoad.768:public@localhost<br />#new one follows</div>
<div style="font-family: "Courier New",Courier,monospace;">
Target[localhost.cpu0]:.1.3.6.1.2.1.25.3.3.1.2.768&.1.3.6.1.2.1.25.3.3.1.2.768:public@localhost </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">and then MRTG works again!</span>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-36351602984939408262010-12-07T23:51:00.000+01:002010-12-07T23:51:19.681+01:00Headless-only Virtualbox<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<a href="http://www.virtualbox.org/">Virtualbox</a> is a versatile <a href="http://www.virtualbox.org/wiki/Virtualization">virtualization</a> solution. That is, many <a href="http://en.wikipedia.org/wiki/Virtual_machine">virtual machines</a> can be hosted on a single physical computer. This software is <a href="http://www.virtualbox.org/wiki/Guest_OSes">well supported</a> under Linux, download and installation instructions for the binary package can be found <a href="http://www.virtualbox.org/wiki/Linux_Downloads">here</a>. Interestingly, although virtualization comes especially handy in server environments, Virtualbox demands most of the X-Windows system to be installed as a package dependency, even though command line operation and Remote Display (VRDP) as output device is <a href="http://www.virtualbox.org/manual/ch07.html#id2743437">supported</a> in <a href="http://www.virtualbox.org/manual/ch07.html#id2743893">headless mode</a> meaning that the graphic output of the guest operating system can be viewed with a <a href="http://www.virtualbox.org/manual/ch07.html#rdp-viewers">RDP software</a> such as Windows' built-in <a href="http://www.microsoft.com/windowsxp/downloads/tools/rdclientdl.mspx">Remote Desktop Connection</a>.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Luckily enough, such package dependencies can be circumvented, saving the system several hundreds of MBs of unnecessary packages at the expense of loosing all local graphic capabilities. But if you do not plan to install and use X anyways, then this will not be a problem.<br />
The steps below are based on forum posts <a href="http://forums.virtualbox.org/viewtopic.php?f=4&t=23682">here</a> and <a href="http://forums.virtualbox.org/viewtopic.php?t=11633">here</a>. I however had to update those instructions to be useful for the current <a href="http://www.virtualbox.org/wiki/Changelog#ChangelogforVirtualBox3.2">version 3.2</a>. As usual, a Debian-based distribution is assumed, yet the adaption should be straightforward to other distributions as well.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Download the appropiate package from <a href="http://www.virtualbox.org/wiki/Linux_Downloads">here</a> and save it to ~/virtualbox/virtualbox.deb. Then:</div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
#: cd virtualbox</div>
<div style="font-family: "Courier New",Courier,monospace;">
#: dpkg --extract virtualbox.deb original</div>
<div style="font-family: "Courier New",Courier,monospace;">
#: dpkg --control virtualbox.deb original/DEBIAN</div>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Now we have the extracted package along with the dependency information in <span style="font-family: "Courier New",Courier,monospace;">original/DEBIAN/control.</span> </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
First we delete unnecessary files and dirs from the package:</div>
<br />
<div style="font-family: "Courier New",Courier,monospace; text-align: left;">
#: rm -rf usr/lib/virtualbox/sdk usr/lib/virtualbox/VirtualBox
usr/lib/virtualbox/VirtualBox.so usr/lib/virtualbox/VBoxSDL usr/lib/virtualbox/VBoxSDL.so usr/bin/VirtualBox usr/bin/VirtualBox.so usr/bin/VBoxSDL usr/lib/virtualbox/libQtGuiVBox.so.4</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Now, resolving the dependency issue, the content of the original/DEBIAN/control has to be altered. The important part here is the part starting with "Depends:" where plenty of packages reside. For command line operation, only the following are necessary:</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br />
<div style="font-family: "Courier New",Courier,monospace;">
Depends: libc6 (>= 2.6), libcurl3-gnutls (>= 7.16.2-1), libgcc1 (>= 1:4.1.1), libssl0.9.8 (>= 0.9.8m-1), libstdc++6 (>= 4.4.0), libxml2 (>= 2.7.4), psmisc, adduser</div>
</div>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Save the file, and the package is ready to be repacked and installed:</div>
<div style="font-family: "Courier New",Courier,monospace;">
#: dpkg --build ~/virtualbox/original ~/virtualbox/repacked.deb</div>
<div style="font-family: "Courier New",Courier,monospace;">
#: dpkg --install ~/virtualbox/repacked.deb</div>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Note that after such a reconfiguration only <a href="http://www.virtualbox.org/manual/ch07.html#vboxheadless">VBoxHeadless</a> can be used to start the virtual machines, and they can be configured using the <a href="http://www.virtualbox.org/manual/ch08.html#id2746695">VBoxManage</a> command line tool.</div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-83492537416478365202010-11-29T09:25:00.001+01:002010-11-29T09:25:00.115+01:00Lm-sensors in net-snmp<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Readout of integrated motherboard sensors was already a topic here, for <a href="http://hacksomethingtonight.blogspot.com/2010/06/via-epia-homeserver-project-on-board.html">VIA Epia boards</a> and for <a href="http://hacksomethingtonight.blogspot.com/2010/02/wd-mybook-hacks-temperature-readings.html">WD Mybook World Edition</a> as well. Such data is good to have visualized, so plotting it using <a href="http://oss.oetiker.ch/mrtg/">MRTG</a> <a href="http://hacksomethingtonight.blogspot.com/2010/02/wd-mybook-hacks-mrtg.html">was discussed</a> too. This tool and its fundamental, <a href="http://www.net-snmp.org/">net-snmp</a> was designed to visualize network traffic data, so for sensor readings, an external script had to be constructed, which was quite inconvenient. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
There is however a better way, briefly mentioned by <a href="http://www.lm-sensors.org/wiki/Download">lm-sensors.org</a>, for which net-snmp has to be installed from source (download <a href="http://www.net-snmp.org/download.html">here</a>, install instructions <a href="http://www.net-snmp.org/docs/INSTALL.html">here</a>) and has to be configured with the following options:</div>
<div style="font-family: "Courier New",Courier,monospace;">
~$: cd net-snmp</div>
<div style="font-family: "Courier New",Courier,monospace;">
~$: ./configure --with-mib-modules="ucd-snmp/lmsensorsMib" --with-ldflags="-lsensors" </div>
<div style="font-family: "Courier New",Courier,monospace;">
~$: make</div>
<div style="font-family: "Courier New",Courier,monospace;">
~$: sudo make install</div>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
If installation was successful, lm-sensor readouts can be accessed via snmp, the same way as if they were polled by the command-line sensors tool:</div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
~#: sensors</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
coretemp-isa-0000<br />
Adapter: ISA adapter<br />
Core 0: +33.0 °C (high = +78.0 °C, crit = +100.0 °C) <br />
<br />
coretemp-isa-0001<br />
Adapter: ISA adapter<br />
Core 1: +32.0 °C (high = +78.0 °C, crit = +100.0 °C) </div>
<div style="font-family: "Courier New",Courier,monospace;">
</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br />
~#: snmpwalk -v 2c -c public localhost Sensors</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
LM-SENSORS-MIB::lmTempSensorsIndex.1 = INTEGER: 1<br />
LM-SENSORS-MIB::lmTempSensorsIndex.2 = INTEGER: 2<br />
LM-SENSORS-MIB::lmTempSensorsDevice.1 = STRING: Core 0<br />
LM-SENSORS-MIB::lmTempSensorsDevice.2 = STRING: Core 1<br />
LM-SENSORS-MIB::lmTempSensorsValue.1 = Gauge32: 33000<br />
LM-SENSORS-MIB::lmTempSensorsValue.2 = Gauge32: 32000 </div>
<br />
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Sadly, only CPU core temperatures can be read out for ICH8/ICH9 chipsets </span><a href="http://lm-sensors.org/wiki/Devices" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">at the moment</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">, still it is now way easier to integrate lm-sensor readings to net-snmp based logging and plotting tools such as MRTG.</span></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com1tag:blogger.com,1999:blog-5844573689471194951.post-42740201473933059832010-11-28T21:06:00.000+01:002010-11-28T21:06:07.656+01:00Chocolate Fondue: Emergency Edition<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Well, winter has come, and so has the cold weather, therefore a nice hot <a href="http://en.wikipedia.org/wiki/Fondue#Chocolate">chocolate fondue</a> could save life. This fondue set consists of three small glasses, one small ceramic bowl, one top of cookie box, and two candles (one for support and one for melting the chocolate chips).</div>
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0RmtmRQxjxnfikZcLU74ptb4e72e2-2uTPXcIgUVVYYYlUZseP0j1LfQE1VSMVw1FbxKB6H6bszpHO3TkgVsZFxMgwc0UcznWs0u89yl-JKA5syDNGyIAko96G3tA1t5vwztMNu1R_2cB/s1600/fondu_side.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0RmtmRQxjxnfikZcLU74ptb4e72e2-2uTPXcIgUVVYYYlUZseP0j1LfQE1VSMVw1FbxKB6H6bszpHO3TkgVsZFxMgwc0UcznWs0u89yl-JKA5syDNGyIAko96G3tA1t5vwztMNu1R_2cB/s320/fondu_side.jpg" width="320" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3APba1c_LLbO0cgyFjEzynhL34Q29jBx7upDgR21oVOCdcPeKgWx5S-H3HQCq8NSAq5voOMYxHU15JdSSVig_2zDcFXxy8seL1BSArWa4duoESkrXE5XEHG8EFBSYTd25ihtPiiUki6W7/s1600/fondu_top.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3APba1c_LLbO0cgyFjEzynhL34Q29jBx7upDgR21oVOCdcPeKgWx5S-H3HQCq8NSAq5voOMYxHU15JdSSVig_2zDcFXxy8seL1BSArWa4duoESkrXE5XEHG8EFBSYTd25ihtPiiUki6W7/s320/fondu_top.jpg" width="320" /></a></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3APba1c_LLbO0cgyFjEzynhL34Q29jBx7upDgR21oVOCdcPeKgWx5S-H3HQCq8NSAq5voOMYxHU15JdSSVig_2zDcFXxy8seL1BSArWa4duoESkrXE5XEHG8EFBSYTd25ihtPiiUki6W7/s1600/fondu_top.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>
<br />Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-53624889030064991872010-09-07T12:47:00.000+02:002010-09-07T12:47:56.683+02:00Just a short note from Rome<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgekj8se_hPD3ABbJXhBZehKVSW5c4i-3OF7ze0xCc7TJuwJbHAlKGfaXeRStLHK2sJF57ReCUeXJhEBAfbJHQ0sNPzoUYFRy78ZiT4QX_GYeH5yZKhSJCFuo7r4mapQu7eartfVMtvziKg/s1600/OS2.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgekj8se_hPD3ABbJXhBZehKVSW5c4i-3OF7ze0xCc7TJuwJbHAlKGfaXeRStLHK2sJF57ReCUeXJhEBAfbJHQ0sNPzoUYFRy78ZiT4QX_GYeH5yZKhSJCFuo7r4mapQu7eartfVMtvziKg/s200/OS2.png" width="200" /></a></div>
Apparently the ticket vending machines of <a href="http://www.ferroviedellostato.it/">Trenitalia</a> (Italian railway company) still run on <a href="http://en.wikipedia.org/wiki/OS/2">OS/2</a> Warp 4. I just saw one of them rebooting :cool:</div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-86328676265672325742010-08-28T19:16:00.001+02:002010-08-28T19:17:22.266+02:00HP 5036A Microprocessor Lab<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgns_sCxsYqdnV4Mx0mdcXX8UfwJ2xrqD55UxBPOaRj6j1hA1sJM64ePWCU9SBmEWVaVwM3LvqaPRQcv4gHYTNoi1g7K851JYVAXfz0IAFMXJnpQQeb2KfcbzzqWX6fOOLgx3Y0eQdoMoU3/s1600/5036A_briefcase.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgns_sCxsYqdnV4Mx0mdcXX8UfwJ2xrqD55UxBPOaRj6j1hA1sJM64ePWCU9SBmEWVaVwM3LvqaPRQcv4gHYTNoi1g7K851JYVAXfz0IAFMXJnpQQeb2KfcbzzqWX6fOOLgx3Y0eQdoMoU3/s320/5036A_briefcase.jpg" /></a>I just got this machine possessed. It is a microprocessor demonstration board based on the <a href="http://en.wikipedia.org/wiki/8085">Intel 8085 CPU</a> meaning that it was built for educational use and to demonstrate the capabilities of Intel's early 8 bit CPUs. According to a very <a href="http://www.old-computers.com/museum/photos.asp?t=1&c=1067&st=1">few</a> <a href="http://www.computermuseumgroningen.nl/hp/hp5036a.html">information</a> on the web it was produced from 1978 through the early 80's by <a href="http://en.wikipedia.org/wiki/HP">Hewlett-Packard</a>.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<b>First impressions:</b></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
The nice leather briefcase makes the appearance really elegant, something that is missed from new and modern equipment. Also, push buttons are built for eternity, no lifetime by design.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiakZPoq8q39Fo6CPMjBEtt4BWd-rtOwJxtZ13KwRa9R04JLWeVe5OqOjtp3ieavyYpt_hVQW0z6wo13GkR9WoR1qKAww9_M0zsayC_q1RwQvsewMj5VoFJNmSRHG7Z8YwFGxTd5xT5giSn/s1600/5036A_buttons.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="170" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiakZPoq8q39Fo6CPMjBEtt4BWd-rtOwJxtZ13KwRa9R04JLWeVe5OqOjtp3ieavyYpt_hVQW0z6wo13GkR9WoR1qKAww9_M0zsayC_q1RwQvsewMj5VoFJNmSRHG7Z8YwFGxTd5xT5giSn/s200/5036A_buttons.jpg" width="200" /></a></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<b>Technical data:</b></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhclDE5oRFQCRAXAqQhp7VHgLDgG1XlYlzAxEoEm94KJ-iPZ0kUPV5H8mg_ReKxN9rPd7UqQ0bEZJn6FRqF2whgeDWd9bgnLqAnK1Fk8zlK_KAyFOQMZPBcBx44caYl6y4X8jJw2Ijyuzh6/s1600/5036A_board.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="294" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhclDE5oRFQCRAXAqQhp7VHgLDgG1XlYlzAxEoEm94KJ-iPZ0kUPV5H8mg_ReKxN9rPd7UqQ0bEZJn6FRqF2whgeDWd9bgnLqAnK1Fk8zlK_KAyFOQMZPBcBx44caYl6y4X8jJw2Ijyuzh6/s320/5036A_board.jpg" width="320" /></a></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<i>Manufacturer:</i> <a href="http://en.wikipedia.org/wiki/HP">Hewlett-Packard</a>;</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<i>CPU:</i> <a href="http://www.nec.com/">NEC</a> <a href="http://www.cpu-world.com/CPUs/8085/NEC-D8085AC.html">D8085AC</a> (Intel 8085 compatible);</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<i>CPU clock:</i> 2 MHz using external 4 MHz crystal;</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<i>ROM:</i> 2 KB external SY2316 (mapped from 0x0000 to 0x07FF);</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<i>RAM:</i> 1 KB external 2xSY2114 (mapped from 0x0800 to 0x0BFF);</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<i>Keyboard:</i> built-in hexadecimal keyboard plus additional function keys; </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<i>Display:</i> 6 digit LED display;</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<i>I/O:</i> one 8 bit port with LED indicators and DIP switches;</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
On-board speaker;</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Additional jumpers are provided to simulate circuit failures. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Note: Regarding to the ROM and RAM chips, I could only recover the manufacturer called <a href="http://en.wikipedia.org/wiki/Synertek">Synertek</a>, which was founded in 1973, bought by Honeywell in 1979, and finally closed off in 1985. Some photo on their products can be found <a href="http://www.chipdb.org/cat-synertek-1048.htm?page=1">here</a>.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<b>Operation:</b></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Upon a successful boot, the message "uLAb UP" is visible on the LED displays. Storing new programs in the RAM is possible using the push button interface. These among built-in code can be run by simply pressing "Fetch Address", setting the appropriate memory address and pressing "Run". Single line execution is also possible. This is a notable example for a compact yet powerful user interface from times before LCD/TFT displays.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
In order to ease learning, several built-in demos are accessible. Notable examples are:</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
the Rocket Launcher demo on address 0x05F9;</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Display test with moving pattern on address 0x055A; </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Random Tone Generator on address 0x053E;</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Stopwatch on address 0x0662.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<object width="500" height="405"><param name="movie" value="http://www.youtube.com/v/5knLTCZVaYo?fs=1&hl=en_US&rel=0&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/5knLTCZVaYo?fs=1&hl=en_US&rel=0&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="405"></embed></object>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
The documentation is in fact fascinating: a 450 page book entitled Practical Microprocessor is included in the briefcase. This is not only a tutorial but a complete documentation including ROM listing, schematics and some brief datasheets as well. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-wKtIxJZc1of0JS7zzes9JdO-fOnEH0RJ3RQ71An7r0Wt0FXWcW3oJY4vY04pxvIZXY2VaZ31pb6JcwxvuUsg5e281IYbXjVPFa9mJ-igqLWxck7lB-u4tpPZ-TGdp9ids17MyrLAVDFR/s1600/Practical_Microprocessors_inside.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-wKtIxJZc1of0JS7zzes9JdO-fOnEH0RJ3RQ71An7r0Wt0FXWcW3oJY4vY04pxvIZXY2VaZ31pb6JcwxvuUsg5e281IYbXjVPFa9mJ-igqLWxck7lB-u4tpPZ-TGdp9ids17MyrLAVDFR/s320/Practical_Microprocessors_inside.jpg" /></a></div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoyqm83iaSfZ-lBy6WKUp3n1sj8fdCl8YfyI6P6UEnxBERh1_KsCwCU7rhlv2luGowH9fPpu5Br-2ts59X31ie-DK1c0XkMhbc0Jf_wEZIQREP0mMpmaM6x0yyv1W1otJT0RBzEyB0Btl-/s1600/Practical_Microprocessors_cover.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoyqm83iaSfZ-lBy6WKUp3n1sj8fdCl8YfyI6P6UEnxBERh1_KsCwCU7rhlv2luGowH9fPpu5Br-2ts59X31ie-DK1c0XkMhbc0Jf_wEZIQREP0mMpmaM6x0yyv1W1otJT0RBzEyB0Btl-/s320/Practical_Microprocessors_cover.jpg" /></a><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com1tag:blogger.com,1999:blog-5844573689471194951.post-1163574994993353272010-07-21T23:55:00.000+02:002010-07-21T23:55:55.169+02:00VIA Epia Homeserver Project - HDD Power Saving<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">The power consumption of a hard disk cannot be neglected in a system designed to be of low consumption. For the operating system, a </span><a href="http://en.wikipedia.org/wiki/Flash_memory" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">flash</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> based drive (</span><a href="http://en.wikipedia.org/wiki/Solid-state_drive" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">SSD</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> or </span><a href="http://en.wikipedia.org/wiki/CompactFlash" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">CF disk</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">) is a good solution, yet for high volume storage this is usually not affordable. Recently, hard disk drives in the terrabyte range especially designed to be power efficient have been announced such as </span><a href="http://www.wdc.com/en/" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Western Digital's</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> </span><a href="http://www.blogger.com/goog_514445300" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Greenpower</a><a href="http://www.wdc.com/en/products/Products.asp?DriveID=336" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> series</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> or the </span><a href="http://www.samsung.com/global/business/hdd/productmodel.do?group=72&type=94&subtype=98&model_cd=440&tab=fea&ppmi=1087" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Ecogreen drives</a> of <a href="http://www.samsung.com/global/business/hdd/index.html" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Samsung</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">. Their offer is a substantial decrease of power consumption (up to 40% claimed) at the expense of somewhat slower operation. This is achieved for instance by spinning only at 5400rpm instead of 7200rpm, which is still reasonable for media storage or backup and even for office applications</span>. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
This tutorial is on setting up a Samsung Ecogreen HD154UI drive in my Via Epia <a href="http://hacksomethingtonight.blogspot.com/2010/05/via-epia-homeserver-project-ingredients.html">homeserver</a>. The goal was to make use of the power saving features that the drive has to offer using the native linux tool <a href="http://sourceforge.net/projects/hdparm/">hdparm</a>. </div>
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">This is a very powerful (and therefore dangerous!) program that can read or set many parameters of PATA or SATA drives in order to tune performance, power consumption, or even hot swap disks. As of the writing of this tutorial, I use hdparm v8.9, note that syntax might change later on. It is also important that the proper driver for the PATA and SATA chipset is either compiled in the kernel or loaded as a module.</span></div>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
All functionality of hdparm is available through command line, yet it is better to use /etc/hdparm.conf to adjust parameters, as it will make those effective after each system boot. Mine looks like this:</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<span style="font-family: "Courier New",Courier,monospace;">/dev/sda {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> dma = on</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> interrupt_unmask = on</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> mult_sect_io = 16</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> write_cache = on</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> transfer_mode = 70</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> io32_support = 1</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> apm = 1</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> spindown_time = 60</span><br />
<span style="font-family: "Courier New",Courier,monospace;">} </span><br />
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
with dma = on meaning DMA instead of PIO (this is the default anyway). Interrupt_unmask = on allowing the system to process multiple IRQs at the same time. mult_sect_io = 16 determines the number of simultaneously transferred blocks (safe to set it to its maximum value). Write_cache = on tells the system to cache write operations. This might be dangerous if a power-cut occurs, yet usually is a good idea to set. Transfer_mode = 70 sets UDMA6. Other UDMA, DMA, PIO settings can be found <a href="http://www.gentoo-wiki.info/Hdparm#Xfer_mode_.28PIO.2FSDMA.2FMDMA.2FUDMA.29_-X">here</a>. io32_support = 1 is quite straightforward and should be set as well. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
The rest are the power saving parameters: apm = X sets how aggressively the drive would enter power saving modes with 1 equals the lowest consumption and 255 means no power saving and maximum performance. Note that X being equal to 128 or above, no spindown is allowed. As I use my disk mostly for storage, I chose the lowest power setting, X=1. Spindown_time sets the length of inactivity before the drive spins down in 5 sec units, so that 60 means 5 minutes timeout. If you experience that you have to wait often to the drive to spin up, consider setting this parameter higher. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
It is very <b>important</b> to note that not only disk I/O but any disk operation including <a href="http://hacksomethingtonight.blogspot.com/2009/12/wd-mybook-hacks-smart.html">checking
drive health status</a> using <a href="http://sourceforge.net/apps/trac/smartmontools/wiki">smartmontools</a> will cause the drive to spin up<a href="http://sourceforge.net/apps/trac/smartmontools/wiki"></a>. This means that periodic checking of drive health or <a href="http://hacksomethingtonight.blogspot.com/2010/02/wd-mybook-hacks-mrtg.html">temperature</a> will render this setting essentially useless. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
If hdparm.conf is set up correctly, the new parameters will be effective upon the next boot and can be checked:</div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
~#: hdparm -i /dev/sda</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<span style="font-family: "Courier New",Courier,monospace;">/dev/sda:</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> Model=SAMSUNG HD154UI , FwRev=1AG01118, SerialNo=S1XWJ1KZ300133 </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Config={ Fixed }</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> RawCHS=16383/16/63, TrkSize=34902, SectSize=554, ECCbytes=4</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> BuffType=DualPortCache, BuffSize=32767kB, MaxMultSect=16, MultSect=?16?</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=18446744072344861488</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> PIO modes: pio0 pio1 pio2 pio3 pio4 </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> DMA modes: mdma0 mdma1 mdma2 </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> AdvancedPM=yes: unknown setting WriteCache=enabled</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Drive conforms to: unknown: ATA/ATAPI-3,4,5,6,7</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> * signifies the current active mode </span><br />
<br />
<br />Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-32348278206601796462010-07-20T18:29:00.000+02:002010-07-20T18:29:23.765+02:00VIA Epia Homeserver Project - CPU Frequency Scaling<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Even though the VIA Epia platform is designed to be very power efficient out of the box, it can be made even better. One tool to do this is the CPU frequency scaling that is supported by both recent linux kernels and the Eden CPU. Specifically, the processor of the EN12000EG board runs at 1200MHz by default, but can go down to as low as 400MHz, resulting not only in reduced power consumption, but decreased heating as well. This especially comes handy for fanless systems, eventually resulting in lower die temperature and longer life span</span>. </div>
<br />
<i style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><b>System setup</b></i><br />
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
In order to utilize this feature the following kernel modules have to compiled (=Y), or installed as module (=M):</div>
<div style="font-family: "Courier New",Courier,monospace;">
X86 CPU: CONFIG_X86_CPU=y </div>
<div style="font-family: "Courier New",Courier,monospace;">
VIA C7 CPU: CONFIG_MVIAC7=y</div>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
ACPI: (not sure if these are necessary, yet they won't hurt...)</div>
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_ACPI=y </div>
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_ACPI_PROCESSOR=y </div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_X86_PCC_CPUFREQ=y</div>
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_X86_ACPI_CPUFREQ=y </div>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
(Note: <span style="font-family: "Courier New",Courier,monospace;"># CONFIG_X86_E_POWERSAVER</span> is not set because it is considered to be dangerous as no hardware limits are taken into account while tuning the CPU clock. However, I did not find any remarks nor observations on this driver).</div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_CPU_FREQ=y</div>
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_CPU_FREQ_TABLE=y</div>
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_CPU_FREQ_STAT=y</div>
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_CPU_FREQ_STAT_DETAILS=y</div>
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE=y</div>
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y</div>
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_CPU_FREQ_GOV_POWERSAVE=y</div>
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_CPU_FREQ_GOV_USERSPACE=y</div>
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_CPU_FREQ_GOV_ONDEMAND=y</div>
<div style="font-family: "Courier New",Courier,monospace;">
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
The options above sets the Governors that can be used later on. As you can see, there are five alternatives, Performance, Powersave, Userspace, Ondemand and Conservative.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
The character of each governors are the following:</div>
<ul style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<li> Performance: simply sets the highest available CPU frequency. Usually this is the default in stock kernels.</li>
<li>Powersave: sets the lowest available frequency no matter what the system load is.</li>
<li>Userspace: the CPU clock can be set manually thorugh the /sys interface</li>
<li>Ondemand: switches between the highest and lowest frequency according to the system load. The corresponding thresholds can be set via the the /sys interface. </li>
<li>Conservative: such as above, although it can set intermediate frequency values as well. The trade-off is higher latency. </li>
</ul>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
The default governor is quite straightforward to set, here I chose Conservative. In this tutorial, only this governor is discussed in detail, however, most of the arguments are straightforward to use for the others as well.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<i><b>Test results</b></i></div>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Upon booting with the new kernel and/or loading the corresponding modules, the influence of the governor is already visible (remember, Conservative governor is set):</div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
#: cat /proc/cpuinfo</div>
<div style="font-family: "Courier New",Courier,monospace;">
processor : 0</div>
<div style="font-family: "Courier New",Courier,monospace;">
vendor_id : CentaurHauls</div>
<div style="font-family: "Courier New",Courier,monospace;">
cpu family : 6</div>
<div style="font-family: "Courier New",Courier,monospace;">
model : 10</div>
<div style="font-family: "Courier New",Courier,monospace;">
model name : VIA Esther processor 1200MHz</div>
<div style="font-family: "Courier New",Courier,monospace;">
stepping : 9</div>
<div style="font-family: "Courier New",Courier,monospace;">
cpu MHz : 400.000</div>
<div style="font-family: "Courier New",Courier,monospace;">
cache size : 128 KB</div>
<div style="font-family: "Courier New",Courier,monospace;">
fdiv_bug : no</div>
<div style="font-family: "Courier New",Courier,monospace;">
hlt_bug : no</div>
<div style="font-family: "Courier New",Courier,monospace;">
f00f_bug : no</div>
<div style="font-family: "Courier New",Courier,monospace;">
coma_bug : no</div>
<div style="font-family: "Courier New",Courier,monospace;">
fpu : yes</div>
<div style="font-family: "Courier New",Courier,monospace;">
fpu_exception : yes</div>
<div style="font-family: "Courier New",Courier,monospace;">
cpuid level : 1</div>
<div style="font-family: "Courier New",Courier,monospace;">
wp : yes</div>
<div style="font-family: "Courier New",Courier,monospace;">
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge cmov pat clflush acpi mmx fxsr sse sse2 tm nx pni est tm2 rng rng_en ace ace_en ace2 ace2_en phe phe_en pmm pmm_en</div>
<div style="font-family: "Courier New",Courier,monospace;">
bogomips : 797.99</div>
<div style="font-family: "Courier New",Courier,monospace;">
clflush size : 64</div>
<div style="font-family: "Courier New",Courier,monospace;">
cache_alignment : 64</div>
<div style="font-family: "Courier New",Courier,monospace;">
address sizes : 36 bits physical, 32 bits virtual</div>
<div style="font-family: "Courier New",Courier,monospace;">
power management:</div>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
showing that the CPU clock is set to 400MHz. If, however, some CPU intensive process is started (compiling kernel or some application is a good check :)) then increased demand results in increased clock frequency:</div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
#: cat /proc/cpuinfo</div>
<div style="font-family: "Courier New",Courier,monospace;">
processor : 0</div>
<div style="font-family: "Courier New",Courier,monospace;">
vendor_id : CentaurHauls</div>
<div style="font-family: "Courier New",Courier,monospace;">
cpu family : 6</div>
<div style="font-family: "Courier New",Courier,monospace;">
model : 10</div>
<div style="font-family: "Courier New",Courier,monospace;">
model name : VIA Esther processor 1200MHz</div>
<div style="font-family: "Courier New",Courier,monospace;">
stepping : 9</div>
<div style="font-family: "Courier New",Courier,monospace;">
cpu MHz : 1200.000</div>
<div style="font-family: "Courier New",Courier,monospace;">
cache size : 128 KB</div>
<div style="font-family: "Courier New",Courier,monospace;">
fdiv_bug : no</div>
<div style="font-family: "Courier New",Courier,monospace;">
hlt_bug : no</div>
<div style="font-family: "Courier New",Courier,monospace;">
f00f_bug : no</div>
<div style="font-family: "Courier New",Courier,monospace;">
coma_bug : no</div>
<div style="font-family: "Courier New",Courier,monospace;">
fpu : yes</div>
<div style="font-family: "Courier New",Courier,monospace;">
fpu_exception : yes</div>
<div style="font-family: "Courier New",Courier,monospace;">
cpuid level : 1</div>
<div style="font-family: "Courier New",Courier,monospace;">
wp : yes</div>
<div style="font-family: "Courier New",Courier,monospace;">
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge cmov
pat clflush acpi mmx fxsr sse sse2 tm nx pni est tm2 rng rng_en ace
ace_en ace2 ace2_en phe phe_en pmm pmm_en</div>
<div style="font-family: "Courier New",Courier,monospace;">
bogomips : 2393.89</div>
<div style="font-family: "Courier New",Courier,monospace;">
clflush size : 64</div>
<div style="font-family: "Courier New",Courier,monospace;">
cache_alignment : 64</div>
<div style="font-family: "Courier New",Courier,monospace;">
address sizes : 36 bits physical, 32 bits virtual</div>
<div style="font-family: "Courier New",Courier,monospace;">
power management:</div>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Detailed statistics is available via the /sys interface:</div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
#: cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state</div>
<div style="font-family: "Courier New",Courier,monospace;">
1200000 38445</div>
<div style="font-family: "Courier New",Courier,monospace;">
400000 42604408</div>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
which tells us both the available frequency values (in kHz) and the corresponding time that the CPU spent in that state in 10ms.</div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
#: cat /sys/devices/system/cpu/cpu0/cpufreq/stats/trans_table</div>
<div style="font-family: "Courier New",Courier,monospace;">
From : To</div>
<div style="font-family: "Courier New",Courier,monospace;">
: 1200000 400000 </div>
<div style="font-family: "Courier New",Courier,monospace;">
1200000: 0 51 </div>
<div style="font-family: "Courier New",Courier,monospace;">
400000: 50 0 </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
This command provides a nice <a href="http://en.wikipedia.org/wiki/Matrix_%28mathematics%29">matrix</a> in which the starting and end frequency for each transition is observed. Note that as the system boots up using the higher value, the difference of one means that now the clock is equal to the lower value. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
The current frequency can be obtained as above by interrogating <span style="font-family: "Courier New",Courier,monospace;">/proc/cpuinfo</span>, however <span style="font-family: "Courier New",Courier,monospace;">/sys</span> tells it as well:</div>
<br />
<div style="font-family: "Courier New",Courier,monospace;">
#: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq</div>
<div style="font-family: "Courier New",Courier,monospace;">
400000</div>
<br />
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">The operation of this governor can be tuned via the nodes in <span style="font-family: "Courier New",Courier,monospace;">/sys/devices/system/cpu/cpu0/cpufreq/conservative</span> (followed by their default values): </span></div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
down_threshold (20)</div>
<div style="font-family: "Courier New",Courier,monospace;">
freq_step (5)</div>
<div style="font-family: "Courier New",Courier,monospace;">
ignore_nice_load (0)</div>
<div style="font-family: "Courier New",Courier,monospace;">
sampling_down_factor (1)</div>
<div style="font-family: "Courier New",Courier,monospace;">
sampling_rate (200000)</div>
<div style="font-family: "Courier New",Courier,monospace;">
sampling_rate_max (4294967295)</div>
<div style="font-family: "Courier New",Courier,monospace;">
sampling_rate_min (200000)</div>
<span style="font-family: "Courier New",Courier,monospace;">up_threshold (80)</span><br />
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
I however advise to be <b>careful</b> tampering with them. As each clock transition takes time the penalty can be serious performance degrade if the system is set to change frequency too often. On the other hand, increasing power consumption and heating is the result of too soft settings. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<i><b>Conclusions</b></i></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Using the Conservative governor is a reasonable improvement for my VIA Epia box, as the system now spends most of its time (over 99%!) in 400MHz instead of 1200MHz. In theory, however, some degradation of performance is associated with tuning the CPU frequency (as the clock transition takes time to occur), this was not observable for my system. </div>
<br />
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Sadly enough, the governor was not able to tune the CPU clock continuously, it rather switched between the highest and lowest available values. Because of this, the Conservative and Ondemand governors essentially equivalent on this system. I am not sure if using <span style="font-family: "Courier New",Courier,monospace;">CONFIG_X86_E_POWERSAVER</span> instead of the default ACPI cpufreq driver solve this problem, this is to be tested. </span></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-60712033132651245692010-06-12T18:07:00.007+02:002010-07-21T23:57:16.475+02:00VIA Epia Homeserver Project - On-board Sensor Readings<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
The scope of this post is to make use of the onboard voltage and temperature sensors that can be useful to avoid dangerous operating conditions such as overheating. </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
In order to make them work, compiling a recent kernel was necessary so I first obtained the latest version from <a href="http://www.kernel.org/">kernel.org </a>(2.6.34 as of today). </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
On EN12000EG, the following hardware supports built-in sensors:</div>
<ul style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
<li>Temperature sensor in <a href="http://www.via.com.tw/en/products/processors/eden/">VIA Eden CPU</a>;</li>
<li>Winbond W83697 SuperIO chip featuring power supply voltage and temperature readings. Link to datasheet is <a href="http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/w83697hf.pdf">here</a>.</li>
</ul>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
The following kernel options have to be set (followed by the actual name of the option in the <span style="font-family: "Courier New",Courier,monospace;">.config</span> file):</div>
<ul>
<li><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">ISA support:</span> <span style="font-family: "Courier New",Courier,monospace;">CONFIG_ISA=y </span></li>
<li> <span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">hardware monitoring support:</span><span style="font-family: "Courier New",Courier,monospace;"> CONFIG_HWMON=y </span></li>
<li><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">VID support:</span> <span style="font-family: "Courier New",Courier,monospace;">CONFIG_HWMON_VID=y </span></li>
<li><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">VIA CPU temp sensor support:</span> <span style="font-family: "Courier New",Courier,monospace;">CONFIG_SENSORS_VIA_CPUTEMP=y </span></li>
<li><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Winbond driver:</span> <span style="font-family: "Courier New",Courier,monospace;">CONFIG_SENSORS_W83627HF=y</span></li>
<li><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">the ACPI drivers:</span><span style="font-family: "Courier New",Courier,monospace;"> </span><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">CONFIG_THERMAL=y</span> and <span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">CONFIG_THERMAL_HWMON=y </span></li>
</ul>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Note: these can be compiled as modules as well, in which case <span style="font-family: "Courier New",Courier,monospace;">OPTION=m</span> will be in the <span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">at the corresponding line</span></span>.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Next, obtain latest <a href="http://www.lm-sensors.org/">lm-sensors</a> (as of today, it is 3.1.2). Manual for compiling and installing is together with the source, it worked without any problem. Then the sensors can be detected with the sensors-detect tool.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
</div>
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">If the options above were compiled as modules, then the following two lines should be add to </span><span style="font-family: "Courier New",Courier,monospace;">/etc/modules.conf:</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
w83627hf</div>
<div style="font-family: "Courier New",Courier,monospace;">
via_cputemp</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
which will cause the kernel to load these modules on startup.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
We are almost ready, however because of recent changes in the kernel architecture (specific version is 2.6.31), some sensors cannot be read because the ACPI code claims the corresponding resources. More information and discussion on the topic is <a href="http://www.lm-sensors.org/wiki/FAQ/Chapter3#Mysensorshavestoppedworkinginkernel2.6.31">here</a>. The point is, that if we try to load the module for the Winbond chip:</div>
<div style="font-family: "Courier New",Courier,monospace;">
# modprobe w83627hf</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
we get a <span style="font-family: "Courier New",Courier,monospace;">"FATAL: [...] Device or resource busy"</span> error message.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
The solution is considered to be dangerous, however, I did not notice any problem (yet :)): The option <span style="font-family: "Courier New",Courier,monospace;">"acpi_enforce_resources=lax"</span> has to be add to the kernel command line upon boot. For grub, this means that the default item in <span style="font-family: "Courier New",Courier,monospace;">/boot/grub/menu.lst</span> will look something like:</div>
<div style="font-family: "Courier New",Courier,monospace;">
</div>
<div style="font-family: "Courier New",Courier,monospace;">
title Debian GNU/Linux, kernel 2.6.34 for VIA C7 and lm-sensors
root (hd0,0)
kernel /boot/vmlinuz-2.6.34 root=/dev/sdb1 ro acpi_enforce_resources=lax</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Now the modules should be able to load, and raw sensor values should read using</div>
<div style="font-family: "Courier New",Courier,monospace;">
$ sensors</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Yet, the actual voltage readings need to be calculated using the scheme provided in <span style="font-family: "Courier New",Courier,monospace;">/etc/sensors3.conf</span> and running <span style="font-family: "Courier New",Courier,monospace;">sensors -s</span> (as root!) to get the proper readings afterwards.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
It is interesting, that for older versions of lm-sensors, the Winbond chip was included in the config file, but it is removed from the latest one. No problem, one can just copy it back:</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br />
<li>chip "w83697hf-*"</li>
</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br />
<li># no in1 on this chip. </li>
<li> label in0 "VCore" </li>
<li> label in2 "+3.3V"</li>
<li> label in3 "+5V"</li>
<li> label in4 "+12V"</li>
<li> label in5 "-12V"</li>
<li> label in6 "-5V"</li>
<li> label in7 "V5SB"</li>
<li> label in8 "VBat"</li>
</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br />
<li></li>
</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br />
<li> compute in3 ((6.8/10)+1)*@ , @/((6.8/10)+1)</li>
<li> compute in4 ((28/10)+1)*@ , @/((28/10)+1)</li>
<li> compute in5 (5.14 * @) - 14.91 , (@ + 14.91) / 5.14</li>
<li> compute in6 (3.14 * @) - 7.71 , (@ + 7.71) / 3.14</li>
<li> compute in7 ((6.8/10)+1)*@ , @/((6.8/10)+1)
</li>
</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br />
<li></li>
</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br />
<li># 697HF does not have VID inputs so you MUST set your core</li>
<li># voltage limits below. Currently set for 1.8V core.</li>
<li># vvv</li>
<li></li>
<li> set in0_min 0.6</li>
<li> set in0_max 1.2</li>
<li></li>
<li> set in2_min 3.3 * 0.95</li>
<li> set in2_max 3.3 * 1.05</li>
<li> set in3_min 5.0 * 0.95</li>
<li> set in3_max 5.0 * 1.05</li>
<li> set in4_min 12 * 0.90</li>
<li> set in4_max 12 * 1.10</li>
<li> set in5_max -12 * 0.90</li>
<li> set in5_min -12 * 1.10</li>
<li> set in6_max -5 * 0.95</li>
<li> set in6_min -5 * 1.05</li>
<li> set in7_min 5 * 0.90</li>
<li> set in7_max 5 * 1.10</li>
<li> set in8_min 3.0 * 0.80</li>
<li> set in8_max 3.0 * 1.20</li>
</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br />
<li># ignore temp2</li>
</div>
<br />
<li></li>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
The rest of the sample config file can even be removed, it makes no use. I also modified the limits of the line in7 as the standby 5V (5VSB) reading is known to scatter more than the others, so +/- 10% is more appropriate.</div>
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Note: I am aware that now the lm-sensor policy is that platform-specific configuration is supposed to be in <span style="font-family: "Courier New",Courier,monospace;">/etc/sensors.d</span>, yet I believe that this way is easier. Moreover, I am not aware of any database that could be used for this purpose, and I have no idea what triggered this change of functionality. </span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Another issue is that I cannot set the limits nor the type of temperature sensors, so lines in the config file like:</div>
<div style="font-family: "Courier New",Courier,monospace;">
set temp1 1 </div>
<div style="font-family: "Courier New",Courier,monospace;">
set set temp1_over 80</div>
<div style="font-family: "Courier New",Courier,monospace;">
set temp1_hyst 75</div>
<div style="text-align: justify;">
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">will result in something like: </span></div>
<div style="font-family: "Courier New",Courier,monospace;">
# sensors -s</div>
<div style="font-family: "Courier New",Courier,monospace;">
Error: File /etc/sensors3.conf, line 95: Unknown feature name
w83697hf-isa-0290: No such subfeature known </div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Not only the limits but the sensor type cannot be set as well, therefore the second temperature sensor (temp2) always reads false values below even room temperature. I am not aware of the resolution of this issue, but I will update the post as soon as I find the proper solution.</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Omitting the invalid lines, now we get the actual readings:</div>
<div style="font-family: "Courier New",Courier,monospace;">
# sensors -s</div>
<div style="font-family: "Courier New",Courier,monospace;">
$ sensors</div>
<div style="font-family: "Courier New",Courier,monospace;">
</div>
<div style="font-family: "Courier New",Courier,monospace;">acpitz-virtual-0
</div>
<div style="font-family: "Courier New",Courier,monospace;">Adapter: Virtual device
</div>
<div style="font-family: "Courier New",Courier,monospace;">temp1: +15.5°C (crit = +120.0°C)
</div>
<li></li>
<div style="font-family: "Courier New",Courier,monospace;">w83697hf-isa-0290
</div>
<div style="font-family: "Courier New",Courier,monospace;">Adapter: ISA adapter
</div>
<div style="font-family: "Courier New",Courier,monospace;">VCore: +0.83 V (min = +0.59 V, max = +1.20 V)
</div>
<div style="font-family: "Courier New",Courier,monospace;">+3.3V: +3.31 V (min = +3.14 V, max = +3.47 V)
</div>
<div style="font-family: "Courier New",Courier,monospace;">+5V: +5.11 V (min = +4.76 V, max = +5.24 V)
</div>
<div style="font-family: "Courier New",Courier,monospace;">+12V: +12.34 V (min = +10.82 V, max = +13.19 V)
</div>
<div style="font-family: "Courier New",Courier,monospace;">-12V: -14.83 V (min = -13.18 V, max = -10.80 V) ALARM
</div>
<div style="font-family: "Courier New",Courier,monospace;">-5V: -7.66 V (min = -5.25 V, max = -4.75 V) ALARM
</div>
<div style="font-family: "Courier New",Courier,monospace;">V5SB: +5.46 V (min = +4.49 V, max = +5.51 V)
</div>
<div style="font-family: "Courier New",Courier,monospace;">VBat: +3.22 V (min = +2.40 V, max = +3.60 V)
</div>
<div style="font-family: "Courier New",Courier,monospace;">fan1: 0 RPM (min = -1 RPM, div = 4) ALARM
</div>
<div style="font-family: "Courier New",Courier,monospace;">fan2: 0 RPM (min = 2109 RPM, div = 4) ALARM
</div>
<div style="font-family: "Courier New",Courier,monospace;">temp1: +55.0°C (high = +12.0°C, hyst = +2.0°C) ALARM sensor = transistor
</div>
<div style="font-family: "Courier New",Courier,monospace;">temp2: +15.5°C (high = +120.0°C, hyst = +115.0°C) sensor = diode</div><div style="font-family: "Courier New",Courier,monospace;">
</div><div style="font-family: "Courier New",Courier,monospace;">beep_enable:enabled
</div>
<div style="font-family: "Courier New",Courier,monospace;">via_cputemp-isa-0000
</div>
<div style="font-family: "Courier New",Courier,monospace;">Adapter: ISA adapter
</div>
<div style="font-family: "Courier New",Courier,monospace;">Core 0: +50.0°C
</div>
<li></li>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
Note that temp2 and the ACPI virtual device has the same reading, both wrong. For temp2 the quick and dirty solution is to simply ignore it by uncommenting the following line in sensors3.conf:</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
<span style="font-family: "Courier New",Courier,monospace;">ignore temp2 </span></div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">
The rest however works now, so the only thing to do is to make sure that sensors -s is run on every boot of the system. A simple shell script shall do the trick:</div>
<div style="font-family: "Courier New",Courier,monospace;">
#! /bin/sh </div>
<span style="font-family: "Courier New",Courier,monospace;">SENSORS=/usr/local/bin/sensors</span>
<span style="font-family: "Courier New",Courier,monospace;">#just initializing lm-sensors </span>
<span style="font-family: "Courier New",Courier,monospace;"></span><span style="font-family: "Courier New",Courier,monospace;">$SENSORS --version</span>
<span style="font-family: "Courier New",Courier,monospace;">$SENSORS -s</span>
<span style="font-family: "Courier New",Courier,monospace;">$SENSORS</span>
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
</div>
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">
Save it as <span style="font-family: "Courier New",Courier,monospace;">Sensors.sh</span> in <span style="font-family: "Courier New",Courier,monospace;">/etc/init.d</span> then chmod it to be executable and link it <span style="font-family: "Courier New",Courier,monospace;">/etc/rc2.d/S40sensors:</span></div>
<div style="font-family: "Courier New",Courier,monospace;">
# chmod a+x Sensors.sh</div>
<span style="font-family: "Courier New",Courier,monospace;"> # ln -s /etc/init.d/Sensors.sh /etc/rc2.d/S40sensors</span>
<br />
<div style="text-align: justify;">
<span style="font-family: "Courier New",Courier,monospace;">Still, there are remaining issues with the lm-sensors that need to be resolved. For instance, the <span style="font-family: "Courier New",Courier,monospace;">temp2</span> and </span><span style="font-family: "Courier New",Courier,monospace;">acpitz-virtual-0</span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> readings are both wrong, and you cannot even get rid of the second one! At least there is not option to disable it through <span style="font-family: "Courier New",Courier,monospace;">/etc/sensors3.conf</span> most likely, the corresponding kernel module needs to be unloaded. Also, the spurious <span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">readings of the <span style="font-family: "Courier New",Courier,monospace;">-12V</span>, <span style="font-family: "Courier New",Courier,monospace;">-5V</span> lines might not be the real things as most likely they not even used by the motherboard. It also worth mentioning that </span></span><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">the new kernel policy of claiming all ACPI related resources resulting in the device drivers not to work anymore might need to be reconsidered, as this is a definite loss of functionality as well, resulting in additional hacking being necessary.</span></span></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-74810700549720036092010-05-23T15:46:00.025+02:002010-06-12T20:33:56.411+02:00VIA Epia Homeserver Project - Installing Linux<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><i><b>Upgrading the BIOS </b></i></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><i><b><br />
</b></i></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">This is optional: I however believe that it is better be safe than sorry :) The latest BIOS for EN12000EG is V1.09 available for <a href="http://www.via.com.tw/en/products/embedded/ProductDetail.jsp?productLine=1&id=399&tabs=1">download</a> in the Downloads tab. The bad news is that the BIOS flash tool demands DOS. Because of this, I briefly plugged a CD drive to the system and installed <a href="http://www.freedos.org/">FreeDOS </a>on the CF drive. I burned the flash tool and BIOS binary after this, and copied it to CF disk. Note that the latter is necessary as the flash tool does not run from read-only media such as a CD. It is also important to make sure that the motherboard would not be unplugged from the mains during the flashing process!</div><div style="text-align: justify;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><i><b>Preparing the install</b></i></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">If the BIOS update is not necessary, one can install the system without using a CD/DVD drive, only a usb stick is to be used. <i><b></b></i></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">As we anyhow build a server, we shall use <a href="http://www.debian.org/">Debian</a> :)</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">There is a good <a href="http://www.debian.org/releases/stable/i386/ch04s03.html.en">howto</a> on debian.org on installing from usb sticks. The main points are the following:</div><ul style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><li>You need to download two disk images: One for making the usb stick bootable (using <a href="http://syslinux.zytor.com/wiki/index.php/The_Syslinux_Project">syslinux</a>). This can be obtained <a href="http://ftp.nl.debian.org/debian/dists/lenny/main/installer-i386/current/images/hd-media/">here</a> (only boot.img.gz is needed). The second one will be the actual installer, for which we use the netinst image meaning that most of the packages will be downloaded from the internet during install. Iso image is available <a href="http://www.debian.org/CD/netinst/#netinst-stable">here</a> (choose i386). </li>
<li> The boot image needs to be extracted and written to the flash drive. The device needs to be at least 256MB in size. No matter if it is larger, because the resulting partition will be of this size. The operation can be done via <a href="http://en.wikipedia.org/wiki/Dd_%28Unix%29">dd</a>, which is available for windows <a href="http://www.chrysocome.net/dd">as well</a> by simply issuing in the command line:<br />
<span style="font-family: "Courier New",Courier,monospace;">dd if=boot.img of=flash_drive</span> <br />
with <span style="font-family: "Courier New",Courier,monospace;">flash_drive</span> being <span style="font-family: "Courier New",Courier,monospace;">/dev/sdX</span> on linux and <span style="font-family: "Courier New",Courier,monospace;">\\?\Device\HarddiskY\Partition0</span> on windows. Note that <span style="font-family: "Courier New",Courier,monospace;">X=[a,b,c...]</span> or <span style="font-family: "Courier New",Courier,monospace;">Y=[1,2,3...]</span> for the flash drive that needs to be written. It is <b>important</b> to double-check the actual path before destroying data on another device by mistake! For the windows version this can be done via <span style="font-family: "Courier New",Courier,monospace;">dd --list</span> which lists all available devices with description. If boot.img is in another directory, then its path needs to be changed as well.<br />
</li>
<li>Replug the flash drive and copy the netinst iso image to flash drive, preferably to the root directory. Note that the iso file should not be extracted, but simply copied, as the installer will mount the image itself.</li>
</ul><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">The bootable flash drive is now ready, the only thing to do is to make sure that a wired internet connection is available so additional packages can be downloaded during install. The preferred way is to use an empty LAN port on a router and to use DHCP.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><i><b>Booting from the flash drive</b></i></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">In principle this should be simple, yet I found it quite hard to make the motherboard boot from USB flash drive even after reading some earlier <a href="http://breakthesystem.org/2007/booting-from-usb-on-a-via-epia-m-board/">manuals</a> on the topic.<i><b> </b></i>For me, the following steps worked with V1.09 BIOS:</div><ul style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><li>Set the first boot device to be USB-ZIP in BIOS. </li>
<li>Switch off the computer and <b>unplug</b> its mains. </li>
<li>Remove all IDE or SATA hard disks, and USB keyboard and mice so that only the USB stick remains.</li>
<li>Replug the computer and switch it on.</li>
<li>At this point it will boot from the flash drive (most likely), but obviously there is nothing to install to :)</li>
<li>Switch off the computer and replug everything that is necessary.</li>
<li>Start install :)</li>
</ul><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">So, in a nutshell, it is necessary to have one power cycle with only the flash drive plugged in. The funny thing is that a mere reboot is not enough, one has to unplug and replug the power supply.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><i><b>And finally, install</b></i></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">Mostly, one can go with the default options. As I used a 4GB CF card as /<span style="font-family: "Courier New",Courier,monospace;">dev/hda</span>, I formatted 3.75 GB to be the root filesystem (using <a href="http://en.wikipedia.org/wiki/Ext3">ext3</a>), and the rest to be swap. Note that it is indeed not recommended to use any flash drive for swapping, yet my experience is that for the intended kind of operation it is rather seldom used, but sometimes it can be useful. As CF contains internal wear leveling algorithm, mainline filesystems, such as ext3 can be used for the system. The only thing that has to be taken care of is to <i>switch off</i> the atime attribute using <b>noatime</b> mount option (this can be done during partitioning). The default atime causes write to the hard drive for each read operation as it updates the last access time for the files. This is useful for certain applications such as backup and mailing tools, but causes a great deal of unnecessary writing operation.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">The rest goes quite straightforward, I chose to install only the option <i>Standard System</i> in order to customize packages later on.<br />
<br />
<i><b>Good-to-have packages</b></i><br />
<br />
Apart from the default packages that come with the default install, the following ones might be useful as well:<br />
<ul><li><i><b> </b></i><span style="font-family: "Courier New",Courier,monospace;">bzip2, less, mc</span><i style="font-family: "Courier New",Courier,monospace;"><b>, </b></i><span style="font-family: "Courier New",Courier,monospace;">ssh-server</span> for convenient use :)</li>
<li> <span style="font-family: "Courier New",Courier,monospace;">make, gcc, libncurses</span><span style="font-family: "Courier New",Courier,monospace;">5-dev</span><span style="font-family: "Courier New",Courier,monospace;">, </span><span style="font-family: "Courier New",Courier,monospace;">automake</span><span style="font-family: "Courier New",Courier,monospace;">, psmisc </span><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">to make kernel compiling and installing source packages possible;</span></li>
<li><span style="font-family: "Courier New",Courier,monospace;">ddclient <span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">to make the box accessible via its domain name with a <a href="http://www.dyndns.com/">dyndns.com</a> account</span></span>;</li>
<li><span style="font-family: "Courier New",Courier,monospace;">iptables</span> for firewalling and/or routing: this is installed by default, although I prefer to have the latest stable version from <a href="http://www.netfilter.org/">http://www.netfilter.org/</a></li>
<li><span style="font-family: "Courier New",Courier,monospace;"><a href="http://www.lm-sensors.org/">lm-sensors</a> <span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">to read on-board temperature and voltage sensor outputs. It was not straightforward to make it work, so I will write about the details in a separate post.</span></span></li>
<li><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> <span style="font-family: "Courier New",Courier,monospace;">samba server</span> from samba.org. Here again make sense to compile from source and setup separately as the version in the debian stable repository is quite old.</span></span></li>
<li><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="font-family: "Courier New",Courier,monospace;">Enhanced ctorrent <span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">a nice command-line based torrent client, might be useful as well. Obtained from <a href="http://www.rahul.net/dholmes/ctorrent/">here</a>. </span></span></span></span> </li>
</ul><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Packages in the first three bulletpoints can simply be optained by apt-get install<packagename>, the rest however are downloaded from other sources and might need some hacking to make them work. </packagename></span><br />
</span><br />
<br />
<i><b><br />
</b></i></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-16657861401907132862010-05-20T22:23:00.005+02:002010-06-05T13:29:53.663+02:00VIA Epia Homeserver Project - Ingredients<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">I recently decided to put together a small linux box to be a media- and fileserver and router and to be a good playground as well :) My goal is to have a box which is small, quiet and has a low power consumption and not to be forgotten, cheap. From now on, I will write about how to put it together from the bare scratch. </div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">Let's see the ingredients for this project:</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><i><b>Motherboard:</b></i></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">I chose <a href="http://www.via.com.tw/en/products/embedded/ProductSeries.jsp?serialNo=2">VIA Epia</a> series because of its good availability and because of having a very good power consumption figure. Note that if you plan to play HD movies <i>directly</i> then this is most likely not your platform (better pick something based on Intel's Atom), yet for a router / file server box it is a good trade-off. For a router we need two physical ethernet interface and for high capacity storage SATA connectors. This is what one has to bear in mind when picking the actual device.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">I chose <a href="http://www.via.com.tw/en/products/embedded/ProductDetail.jsp?productLine=1&id=399&tabs=1">EN12000EG</a> because..., well it was a good deal on ebay :) Yet, it has two onboard SATA connectors, and one can add an additional ethernet interface via its PCI slot which is what I exactly did by putting a <a href="http://www.realtek.com.tw/products/productsView.aspx?Langid=1&PNid=13&PFid=4&Level=5&Conn=4&ProdID=8">RTL8169</a>-based gigabit ethernet card in. The motherboard is based on a <a href="http://en.wikipedia.org/wiki/VIA_Eden">VIA Eden</a> processor meaning that it is completely fanless which is an important point as well.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">Regarding to the memory: One 256MB 533MHz DDR2 one would do it, as we will not need anything that consumes a great deal of system memory. It has to be noted however that the onboard VGA takes 64MB out of the value above.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">It is a good thing that the motherboard is well documented, all documentation is available at <a href="http://www.via.com.tw/en/products/embedded/ProductDetail.jsp?productLine=1&id=399&tabs=1">VIA</a>.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><i><b>System hard disk:</b></i></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">For<i> </i>this purpose, I will use a 4GB <a href="http://en.wikipedia.org/wiki/CF_card">CF card</a>, which is enough for the bare system. To hook this up to the main board, a CF to IDE converter is necessary, which is in the 1 USD range on ebay. Note that it is a good idea to buy a dual CF converter (so that one will be the master and one will be the slave device) for optional temporary storage for for instance torrent, as the main hard disk can be still turned off and does not consume any power. </div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><i><b>Main hard disk:</b></i></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">This will be a <a href="http://www.samsung.com/global/business/hdd/productmodel.do?group=72&type=94&subtype=98&model_cd=512&ppmi=1219">Samsung EcoGreen</a> drive as we do not need <i>really</i> fast random seek, rather a low power and reasonable sized storage. Anyhow, the box should be designed so that it turns off the hard drive whenever possible.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><i><b>Case:</b></i></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="text-align: justify;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">For some reason, cases designed for mini-ITX motherboards are rather expensive. Because of this, I choose a mini-ATX /ITX case, <a href="http://www.google.hu/images?hl=hu&q=Codegen+MX31-A2">Codegen's MX-31-A2</a>. The only drawback is that the built-in power supply is designed to be capable of 300W output so that it is expected to have very low efficiency for low power systems. This is to be measured later so that I can decide whether it is necessary to replace it.</span></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com1tag:blogger.com,1999:blog-5844573689471194951.post-60652354844924126622010-04-14T22:50:00.007+02:002010-05-05T21:52:24.875+02:00USB Isolator by Analog Devices<div class="separator" style="clear: both; text-align: center;"></div><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">This is something that I was long awaited for. <a href="http://www.analog.com/">Analog Device</a>s introduced the first digital isolator for <a href="http://en.wikipedia.org/wiki/Usb">USB ports</a>, <a href="http://www.analog.com/en/interface/digital-isolators/adum4160/products/product.html">ADuM4160</a>, meaning that now complete decoupling is possible between USB host and device, including the ground common being separated. Why is it useful?</div><ul style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><li>The possibility for removing <a href="http://en.wikipedia.org/wiki/Ground_loop_%28electricity%29">ground loops</a> thus achieving lower noise levels which is handy for low noise instrumentation or high end audio electronics (in fact, it is especially useful for external sound cards plugged on USB);</li>
<li>Decoupling the device from the computer host might protect the computer if anything goes wrong in the device, i. e. high voltage level appears in the digital parts due to malfunction. </li>
</ul><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">The principle of operation is discussed <a href="http://www.analog.com/en/interface/digital-isolators/products/CU_over_iCoupler_Digital_Isolation/fca.html#tech">here</a>, the main point is that a CMOS-integrated transformer couples the output to the input. This is not that simple for USB however, as data flow has to be ensured in both directions, so additional logic circuit is necessary. </div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">There is one additional goal: to ensure power supply for bus-powered USB devices. For this purpose, I used <a href="http://www.analog.com/en/interface/digital-isolators/adum5000/products/product.html">ADuM5000</a>, which shares the same transformer coupling technique for transferring power to the decoupled part. Sadly enough, the efficiency is quite low, only around 33%. The maximum output is 100mA at 5V but this can be improved by hooking up these circuits in parallel as suggested by the datasheet. I used two devices in the scheme to make use the entire 500mA available on each port which leads to around 200mA maximum output which is still enough for a plenty of kinds of devices. </div><div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpWFgLgyRH3-gx7i2BFAWpJwSP8fK-uJK3YUkgM4lyH660_CjWAWKUUgS4M5jgkPsow4wylkbaQTSjB5upNx-YjFaaxHSi1lC5oU7iFwedWjJNKpk0fSmXJcgQO4P9W6KRxOKj64y1p7rF/s1600/USB_isolator_schematics.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpWFgLgyRH3-gx7i2BFAWpJwSP8fK-uJK3YUkgM4lyH660_CjWAWKUUgS4M5jgkPsow4wylkbaQTSjB5upNx-YjFaaxHSi1lC5oU7iFwedWjJNKpk0fSmXJcgQO4P9W6KRxOKj64y1p7rF/s320/USB_isolator_schematics.png" /></a></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">The schematics is quite straightforward, the most important thing is to decouple power supply pins with 100nF capacitors near the integrated circuit. The PCB is easy as well, a small two sided board is enough. The only guideline is to make sure that there are no nearby copper lines from the parts which could endanger the isolation for high voltages.</div><div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgp2VIrmex-x4sxiMQlSSWjF_YarqOpm6YEIGcw0PNHtTktqeulMf08FPwgmXAxi3Y6NABGO5C8pnhY0anfekzmja_YczQIz_WLhUODsGpD7emHCrQgHKzyvr3Mtft3TrrW_zbHwN2F9N2U/s1600/USB_isolator_pcb1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgp2VIrmex-x4sxiMQlSSWjF_YarqOpm6YEIGcw0PNHtTktqeulMf08FPwgmXAxi3Y6NABGO5C8pnhY0anfekzmja_YczQIz_WLhUODsGpD7emHCrQgHKzyvr3Mtft3TrrW_zbHwN2F9N2U/s320/USB_isolator_pcb1.jpg" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnUSgbDBpfD79-mjXis5aHqHp1KQjcPPb-BPn5LUmCJTrOQkj5jXGImsmoYo4eALm2B0uFzN9s_D9oFZKEPLStihtLZe1nZIKhw7H8qM-HtHPOrPWjQvmtb6_js63dD7bLjiGxCMBQiWfo/s1600/USB_isolator_pcb2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnUSgbDBpfD79-mjXis5aHqHp1KQjcPPb-BPn5LUmCJTrOQkj5jXGImsmoYo4eALm2B0uFzN9s_D9oFZKEPLStihtLZe1nZIKhw7H8qM-HtHPOrPWjQvmtb6_js63dD7bLjiGxCMBQiWfo/s320/USB_isolator_pcb2.jpg" /></a></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">I tested the circuit and it worked pretty well with my 1GB flash drive, and it made use of the 12Mb/s Full Speed bandwidth. There were other devices, including USB mice that ended up with a "USB device not recognized" error message upon plug-in. The reason I suspect is the power supply: USB devices can allocate up to 500mA on each port, which should prevent overloading the port. I assume if much more is used just after plugging in the device, the USB controller might inhibit the device in question. Here this could easily happen, as the power supply efficiency is only around 30% (factor of three!).</div><div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrM6Trch11oyFVWMrx4CT7QGrNXla3tUa_VmeJv3IAh_YAL4L4JhhK195frCSbD3XwbaBu7Ur9ECvxU40ZsK3S1L4mFpabPvMwHzzGZPkLYjYDAYVxdV0UlgR3LOJ-HDNNn4cbOjd-QCyv/s1600/USB_power.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrM6Trch11oyFVWMrx4CT7QGrNXla3tUa_VmeJv3IAh_YAL4L4JhhK195frCSbD3XwbaBu7Ur9ECvxU40ZsK3S1L4mFpabPvMwHzzGZPkLYjYDAYVxdV0UlgR3LOJ-HDNNn4cbOjd-QCyv/s320/USB_power.png" /></a></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">To check this, I used a self-powered USB hub between the isolator the device (i.e. mouse), and in this fashion, everything worked out for all devices I could test.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">There is, however another side effect of the low efficiency of the ADuM5000: if operated on the edge, they can heat up quite easily. I think this can be addressed by gluing some sort of heat sink on the top of the IC.Yet, the heat sink has to be isolated from everything as well!<br />
<br />
Update: I tested the board with a small piece of heat sink glued on the two ADuM5000s. I put some thermally conductive adhesive on the top of the ICs, installed the heat sink and glued it together with some two component epoxy which is also useful against accidental shorts and other problems with an unprotected PCB. I tested the device afterward and not it is stable no matter what the load is.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-3KG0BV8EOgGfHKYsYF1w6tTk1sqIfTvZZqqglYSxlvu6JiX24HR90CQxJFSxi87tGrZCDj755VecPWplQMfoW49T-38tBqhCPjJVKqrVpKMFK4f81HZOmy85o0I42kFiGNfD9hoh7Vsn/s1600/USB_isolator_pcb3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-3KG0BV8EOgGfHKYsYF1w6tTk1sqIfTvZZqqglYSxlvu6JiX24HR90CQxJFSxi87tGrZCDj755VecPWplQMfoW49T-38tBqhCPjJVKqrVpKMFK4f81HZOmy85o0I42kFiGNfD9hoh7Vsn/s320/USB_isolator_pcb3.jpg" /></a></div></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="text-align: justify;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">In conclusion, the circuit worked pretty well for me, the only improvement could be a better power supply, or a USB2.0 high speed device...</span><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> But still, this kind of portfolio is quite unique on the market.</span></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-33671697375582001422010-03-20T13:34:00.002+01:002010-03-20T13:40:47.974+01:00HP Notebook slow while plugged in<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">I recently encountered a quite strange behavior of my HP 6910p computer. It became extraordinary slow if hooked on the charger. By slow I mean that Windows booting up took more than half an hour (I tested this only once :) ) and afterwards Task Manager showed 100% CPU usage for both cores all the time, no matter if no userspace program was running. This itself could have been a simple Windows issue, but essentially the same happened for a Linux Live CD, and even worse: the BIOS menu was definitely slow to respond. However if I removed the charger (so that it ran on battery), everything went back to normal. </div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqzgezmbUtQL67d1U1UPhUb15hWNb1LoL2rdDajxYlNhuU6dPkTR7G_gxwgTK9YUPTH5ME3uwlLlSlCwaSWCaJo3qJRckuG9mV-dG2gtq_I_EYKYhYRyPHfbeyJvLIYzC-zTsjreJuzqFf/s1600-h/Power_Plug.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqzgezmbUtQL67d1U1UPhUb15hWNb1LoL2rdDajxYlNhuU6dPkTR7G_gxwgTK9YUPTH5ME3uwlLlSlCwaSWCaJo3qJRckuG9mV-dG2gtq_I_EYKYhYRyPHfbeyJvLIYzC-zTsjreJuzqFf/s320/Power_Plug.jpg" /></a>Realizing that this is a hardware problem I had it repaired under warranty (they replaced the motherboard), after which everything went normal for some days and then the issue reappeared. This happened during the weekend (obviously) so I had to do something. What I noticed was that by moving the cable of the charger sometimes it can be healed. So the resolution was simple: the wire is broken somewhere. But which wire? I have never noticed a power failure, meaning that only the third one in the middle can be the source of the problem. Yes, recent notebooks demand a charger with an additional line which might tell if the charger is a proper one or not. If this connection is not present then the power management of the notebook must fall back to some extra low profile rendering the CPUs slow and the computer essentially useless.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">So apart from saying a big thanks to HP I only could cut the wiring open and resolder this inner wire after which I applied a plenty of thin teflon tape to prevent it from either breaking or shorting to the other ones.</div><div style="text-align: justify;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Now everything is back to normal, the long-term solution however is buying a new power supply. </span></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com2tag:blogger.com,1999:blog-5844573689471194951.post-42211558062852392452010-02-19T23:09:00.004+01:002010-06-12T18:08:16.581+02:00WD MyBook Hacks - MRTG<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">This post is about using the versatile <a href="http://oss.oetiker.ch/mrtg/">MRTG</a> tool visualize usage data and health status of the storage device.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><b>Prerequisites</b></div><ul style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><li>Web server to see the plots over http. For this the built-in mini_httpd will do, but lighthttpd is good as well if installed already. I however advice to use the first if there is no other reason for using the second one so that the configuration of the server does not have to be altered.</li>
<li>Ipkg packages: cron, net-snmp and mrtg (also installs libgd and perl). The first is for periodic execution of the data acquisition, while net-snmp will collect the data which will be visualized by mrtg. Luckily again, these packages work out of the box, no compilation is required. For the usage of ipkg see my post on the <a href="http://hacksomethingtonight.blogspot.com/2009/12/wd-mybook-hacks-basics.html">basic setup</a>.</li>
<li>For cron and net-snmp to start on device startup, copy the contents of /<span style="font-family: "Courier New",Courier,monospace;">opt/etc/init.d</span> to<span style="font-family: "Courier New",Courier,monospace;"> /etc/init.d</span>.</li>
</ul><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><b>Setup MRTG</b></div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">This can be done by using the built-in tool cfgmaker, for which the usage reference can be found <a href="http://oss.oetiker.ch/mrtg/doc/cfgmaker.en.html">here</a>. The basic setup includes measuring the throughput of the ethernet interface:</div><br />
<span style="font-family: "Courier New",Courier,monospace;">#~: cfgmaker --global 'WorkDir: /proto/SxM_webui/mrtg' --global 'Options[_]: bits,growright' --output /opt/etc/mrtg.cfg public@localhost </span><br />
<br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">which sets up WorkDir where the graphic output and html files will be stored to be in the working directory of the html server. The config file will be stored at <span style="font-family: "Courier New",Courier,monospace;">/opt/etc/mrtg.cfg</span>.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">I realized however that usage of the cfgmaker tool is not displayed in case of an input error or issuing <span style="font-family: "Courier New",Courier,monospace;">--help</span>. It seems that the <span style="font-family: "Courier New",Courier,monospace;">/opt/lib/mrtg2/Pod/Usage.pm</span> file shipped with the package is broken and has to be replaced with the one found <a href="http://cpansearch.perl.org/src/MAREKR/Pod-Parser-1.38/lib/Pod/Usage.pm">here</a>.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">This basic config can be tested by issuing:</div><div style="font-family: "Courier New",Courier,monospace;">#~: mrtg /opt/etc/mrtg.cfg</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">at least twice and checking the result in the browser at http://IP_of_storage/mrtg/localhost_2.html (localhost_1 would be the loopback interface which is not plotted). The data can be collected automatically by adding the following line to <span style="font-family: "Courier New",Courier,monospace;">/opt/etc/crontab</span>:</div><span style="font-family: "Courier New",Courier,monospace;">*/5 * * * * root /opt/bin/mrtg /opt/etc/mrtg.cfg</span><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">and restarting the cron daemon:</div><div style="font-family: "Courier New",Courier,monospace;">#~: /etc/init.d/S10cron</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">This tells cron to run mrtg every 5 minutes. According to the mrtg manual it is not recommended to make it more frequent, and this value is usually good choice anyway.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">Eventually, graphs will be filled with data like this:</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKx6U0X7nj_BXdj6apxTSXrv_8syIBjdahCxNGBIrJ1wWRnoA1cjgs5dzFuoPmBsOyLj6PNTXBxDg-WCupGe5LfBaHjb9O0n-AWwrKIWONpZbm8JFp0PAsO0PX5AJD4aRswB4Wy_Cz_9nA/s1600-h/localhost_2-day.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="76" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKx6U0X7nj_BXdj6apxTSXrv_8syIBjdahCxNGBIrJ1wWRnoA1cjgs5dzFuoPmBsOyLj6PNTXBxDg-WCupGe5LfBaHjb9O0n-AWwrKIWONpZbm8JFp0PAsO0PX5AJD4aRswB4Wy_Cz_9nA/s400/localhost_2-day.PNG" width="400" /></a></div><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">This is good, but we can go even further: CPU load, memory and hard disk usage and <a href="http://hacksomethingtonight.blogspot.com/2010/02/wd-mybook-hacks-temperature-readings.html">temperature data</a> can be plotted as well. The first three data values can be collected by net-snmp, while for the last one we need to modify the script that I have posted <a href="http://hacksomethingtonight.blogspot.com/2010/02/wd-mybook-hacks-temperature-readings.html">already</a>:</div><br />
<div style="font-family: "Courier New",Courier,monospace;">#!/bin/sh</div><div style="font-family: "Courier New",Courier,monospace;">Y1=`cat /sys/module/thermAndFan/parameters/current_temp ` </div><div style="font-family: "Courier New",Courier,monospace;">C1='display(0);config("tilde","off");3865/(ln('<br />
C2=')+9.1411)-273.16'</div><div style="font-family: "Courier New",Courier,monospace;">/usr/sbin/smartctl -a -d ata /dev/sda | awk '/Temperature/ {print $10}'<br />
/opt/bin/calc $C1$Y1$C2 | awk 'NR==3 {print $1}' <br />
echo 0<br />
echo Temperature Data on Storage<br />
exit 0</div><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">The output of this script will consist of four lines that are needed by mrtg:</div><ol style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><li> "Input bytes" data: Here it will be the temperature of the hard disk;</li>
<li>"Output bytes" data: Here it will be the temperature of the system thermometer;</li>
<li>Uptime: we don't need this so set it to zero.</li>
<li>Text output: the name of the plots.</li>
</ol><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"> I saved this script to <span style="font-family: "Courier New",Courier,monospace;">/opt/etc/mrtg/tempscript1.sh</span> which we will need in the revised mrtg.cfg:</div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: xx-small;"><br />
</span></div><span style="font-size: xx-small;"><span style="font-family: "Courier New",Courier,monospace;"># Created by </span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"># /opt/bin/cfgmaker --global "WorkDir: /proto/SxM_webui/mrtg" --global "Options[_]: bits,growright" --output /opt/etc/mrtg.cfg public@localhost</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">EnableIPv6: no</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">WorkDir: /proto/SxM_webui/mrtg</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Options[_]: bits,growright</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">LoadMIBs: /opt/share/snmp/mibs/HOST-RESOURCES-MIB.txt</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">kilo[_]: 1024</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">XSize[_]: 600</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">RouterUpTime[_]: hrSystemUptime.0:public@localhost</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">### Interface 2 >> Descr: 'eth0' | Name: 'eth0' | Ip: '192.168.1.1' | Eth: '' ###</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Target[localhost_2]: 2:public@localhost:</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">SetEnv[localhost_2]: MRTG_INT_IP="</span></span><span style="font-size: xx-small;"><span style="font-family: "Courier New",Courier,monospace;">192.168.1.1</span></span><span style="font-size: xx-small;"><span style="font-family: "Courier New",Courier,monospace;">" MRTG_INT_DESCR="eth0"</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">MaxBytes[localhost_2]: 12500000</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Options[localhost_2]: nobanner,noborder,growright,transparent</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Title[localhost_2]: Traffic Analysis for eth0</span></span><br />
<span style="font-size: xx-small;"><span style="font-family: "Courier New",Courier,monospace;"> </span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">### CPU</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Target[localhost.cpu]: hrProcessorLoad.768&hrProcessorLoad.768:public@localhost</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Title[localhost.cpu]: CPU Load</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">PageTop[localhost.cpu]:Active CPU load</span></span><span style="font-family: "Courier New",Courier,monospace;"> </span><br />
<div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: xx-small;">MaxBytes[localhost.cpu]: 100</span></div><span style="font-size: xx-small;"><span style="font-family: "Courier New",Courier,monospace;">Unscaled[localhost.cpu]: ymwd</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Options[localhost.cpu]: growright,gauge,nopercent,noo,transparent,nolegend,nobanner,noborder</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">YLegend[localhost.cpu]: %</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">ShortLegend[localhost.cpu]: %</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">LegendI[localhost.cpu]: Processor Load</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">### Temperature</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Target[localhost.temp]: `/opt/etc/mrtg/tempscript1.sh`</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Title[localhost.temp]: Temperature Reading</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">PageTop[localhost.temp]: </span><span style="font-family: "Courier New",Courier,monospace;">Temperature reading</span></span><span style="font-family: "Courier New",Courier,monospace; font-size: xx-small;"> </span><br />
<div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: xx-small;">MaxBytes[localhost.temp]: 75</span></div><span style="font-size: xx-small;"><span style="font-family: "Courier New",Courier,monospace;">Unscaled[localhost.temp]: ymwd</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Options[localhost.temp]: growright,gauge,nopercent,transparent,nolegend,nobanner,noborder</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">YLegend[localhost.temp]: Celsius</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">ShortLegend[localhost.temp]: C</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">LegendI[localhost.temp]: HDD Temperature</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">LegendO[localhost.temp]: Sys Temperature</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">### Memory</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Target[localhost.mem]: hrStorageUsed.1&hrStorageUsed.1:public@localhost * 1024</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Title[localhost.mem]: Memory Consumption</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">PageTop[localhost.mem]:Memory Consumption</span></span><br />
<div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: xx-small;">Options[localhost.mem]: growright,gauge,nopercent,noo,transparent,nolegend,nobanner,noborder</span></div><span style="font-family: "Courier New",Courier,monospace;"></span><span style="font-size: xx-small;"><span style="font-family: "Courier New",Courier,monospace;">MaxBytes[localhost.mem]: 129871873</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">LegendI[localhost.mem]: Used Memory</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"></span><span style="font-family: "Courier New",Courier,monospace;">ShortLegend[localhost.mem]: Bytes</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Unscaled[localhost.mem]: ymwd</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">YLegend[localhost.mem]: Bytes</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Kilo[localhost.mem]: 1024</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">### Hard drive: /</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Target[localhost.hd1]: hrStorageUsed.31&hrStorageUsed.31:public@localhost * 4096</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Title[localhost.hd1]: Disk Usage: /</span><span style="font-family: "Courier New",Courier,monospace;"> </span></span><br />
<span style="font-size: xx-small;"><span style="font-family: "Courier New",Courier,monospace;">PageTop[localhost.hd1]:Disk Usage: /</span></span><br />
<div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: xx-small;">Options[localhost.hd1]: growright,gauge,nopercent,noo,transparent,nolegend,nobanner,noborder</span></div><span style="font-family: "Courier New",Courier,monospace;"></span><span style="font-size: xx-small;"><span style="font-family: "Courier New",Courier,monospace;">MaxBytes[localhost.hd1]: 100000000000000000</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">LegendI[localhost.hd1]: Storage Used</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">### LegendO[localhost.hd1]: Total</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Kilo[localhost.hd1]: 1024</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">YLegend[localhost.hd1]: Used Bytes</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">ShortLegend[localhost.hd1]: B</span></span><br />
<span style="font-size: xx-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"></span></span></span></span><span style="font-size: xx-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"> </span></span></span><span style="font-size: xx-small;"><span style="font-family: "Courier New",Courier,monospace;"></span></span><br />
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">There are some important notes however:</span><br />
<ul style="text-align: justify;"><li style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Hard disk usage is normalized against the 1TB version of the MBWE. The corresponding MaxBytes property has to be modified if this is to be used with a hard disk of an other size.</li>
<li style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">The global RouterUpTime property is modified so that it indeed reflects the uptime and not just the uptime of the net-snmp daemon.</li>
<li style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Memory usage is set to plot against the maximum of 128 MB for the white light edition. For the blue ring edition 64MB is to be used. </li>
<li><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">If the script for temperature reading is put somewhere else, the corresponding Target line has to be altered as well.</span></li>
</ul><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">In case everything is OK, which can be tested by manually issuing ´mrtg /opt/etc/mrtg.cfg´ in the shell, the other graphs are filled with data as well:</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDxKmk-Qa_Ty2vUvh1g5WrwCnGF0ZHPM7_hVHRSlDngoq1qg1URvFPFonhyphenhyphenMaDNgi0zEZiHIsVsKehvobQrVFLqsaYHkEUzGLBf6gQnCAYNQ0TTWxFC3krtThDW-bB496i6JHjFc-THuzz/s1600-h/localhost.temp-day.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="77" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDxKmk-Qa_Ty2vUvh1g5WrwCnGF0ZHPM7_hVHRSlDngoq1qg1URvFPFonhyphenhyphenMaDNgi0zEZiHIsVsKehvobQrVFLqsaYHkEUzGLBf6gQnCAYNQ0TTWxFC3krtThDW-bB496i6JHjFc-THuzz/s400/localhost.temp-day.PNG" width="400" /></a></div><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><br />
</span>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-25950847870925566712010-02-14T19:28:00.003+01:002010-06-12T18:07:55.619+02:00WD MyBook Hacks - Temperature Readings<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">This is a topic that puzzled me for some time. Built-in temperature sensors are useful for monitoring the health status of the device and making proper action if for instance overheating occurs. For personal computing, <a href="http://www.lm-sensors.org/">lm-sensors</a> is a frequently-used tool for this purpose which is able to read the sensors via <a href="http://en.wikipedia.org/wiki/SMBus">SMBus</a> on most of the motherboards. However, the MyBook has a different facility for this, so we will see how to take advantage of it. In fact, not only the on-board temperature sensor can be read, but the one on the hard drive can be used as well.</div><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><b>Reading sensor on the hard drive</b></div><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">This sensor can simply be reached through reading the <a href="http://en.wikipedia.org/wiki/S.M.A.R.T.">S.M.A.R.T.</a> data of the drive as <a href="http://hacksomethingtonight.blogspot.com/2009/12/wd-mybook-hacks-smart.html">I posted earlier</a>. What we need to do is to grep the useful data and get rid of the garbage by selecting the line and the field we are interested in:</div><br />
<div style="font-family: "Courier New",Courier,monospace;">#~: smartctl -a -d ata /dev/sda | awk '/Temperature/ {print $10}'</div><div style="font-family: "Courier New",Courier,monospace;">44</div><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">will do the job, and we get the temperature of the hard drive in Celsius.</div><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><b>Reading the on-board temperature sensor</b></div><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">This one can be interrogated through:</div><b> </b><br />
<div style="font-family: "Courier New",Courier,monospace;">#~: cat /sys/module/thermAndFan/parameters/current_temp</div><div style="font-family: "Courier New",Courier,monospace;">27</div><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">which is a reasonable value. If however we look further into the details:</div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;">#~: cat /sys/module/thermAndFan/parameters/hot_limit</div><div style="font-family: "Courier New",Courier,monospace;">16</div><div style="font-family: "Courier New",Courier,monospace;">#~: cat /sys/module/thermAndFan/parameters/cold_limit</div><div style="font-family: "Courier New",Courier,monospace;">104</div><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">this should give the clue that this is not a direct temperature reading. Indeed this sensor does not read in Celsius but rather in "Counts" which is proportional to the sensor resistance value. Luckily enough google finds the lookup table for this platform <a href="http://gauss.amakha.org/repos/amakha/trunk/meta-oe/recipes/linux/linux-2.6.24/oxnas/oxnas.diff">here</a> (see TvsCnt[] array). As the sensor is a semiconductor <a href="http://en.wikipedia.org/wiki/Thermistor">thermistor</a>, there is no simple linear equation to determine the temperature, rather the following exponential dependence should be used: Cnt=a×exp(b/T), with Cnt being the reading above and T being the <i>absolute</i> temperature in Kelvin. For this specific sensor the parameters are a=1/9331 and b=3865 as a result by a simple fitting procedure. So after some algebra we find that the temperature will be: t=3865/(ln(Cnt)+9.1411)-273.16 in Celsius (feel free to do it in Fahrenheit :) ).</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">In order to implement this equation, we will use the command-line <a href="http://www.isthe.com/chongo/tech/comp/calc/">calc</a> tool:</div><div style="font-family: "Courier New",Courier,monospace;">#~: ipkg install calc</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">Finally using this tool a simple script can be used to determine the temperature:</div><br />
<div style="font-family: "Courier New",Courier,monospace;">#!/bin/sh</div><div style="font-family: "Courier New",Courier,monospace;">Y1=`cat /sys/module/thermAndFan/parameters/current_temp `</div><div style="font-family: "Courier New",Courier,monospace;">C1='display(0);config("tilde","off");3865/(ln('<br />
C2=')+9.1411)-273.16'<br />
/opt/bin/calc $C1$Y1$C2 | awk 'NR==3 {print $1}' </div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">which results in a single return value, e. g. 37.</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><br />
</div><div style="text-align: justify;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Finally the question remains: Why would we do this? The reason is that these readings <a href="http://hacksomethingtonight.blogspot.com/2010/02/wd-mybook-hacks-mrtg.html">can be plotted</a> using for instance </span><a href="http://oss.oetiker.ch/mrtg/index.en.html" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">MRTG</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">, so that the health status of the storage can be checked easily. </span></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-29333320548389036352010-01-28T22:17:00.000+01:002010-01-28T22:17:36.219+01:00Inside a LED lamp<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyAvxBTNOwAozEKb0TtQK9Gj0YTomrav6-i5thM-uDIjVowf_HfkTOsSR1AGW1nxp6-ejP7Al8buU_9JYpV2TagpweiNQEkFc0FVyOJHSTqkGZfv0f8DhDgPN0azHbt-5P6zJ9WYwLia82/s1600-h/ledlamp1.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyAvxBTNOwAozEKb0TtQK9Gj0YTomrav6-i5thM-uDIjVowf_HfkTOsSR1AGW1nxp6-ejP7Al8buU_9JYpV2TagpweiNQEkFc0FVyOJHSTqkGZfv0f8DhDgPN0azHbt-5P6zJ9WYwLia82/s200/ledlamp1.jpg" width="200" /></a>Using <a href="http://en.wikipedia.org/wiki/LED_lamp">LED lamps</a> instead of <a href="http://en.wikipedia.org/wiki/Light_bulb">incandescent bulbs</a> and <a href="http://en.wikipedia.org/wiki/Compact_fluorescent_lamp">fluorescent lamps</a> is argued to be power efficient thus economically favorable. Longer life span is also usually cited as an advantage. I wanted to look into the details for a long time and recently I ordered some LED lamps on ebay, so I took one of them apart to see what is inside...<br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">The lamp is a 48 LED device, and is written to use 4.5W on a 230V power supply. My intention is to present the schematics of the lamp so that we can see the details of its operation.<br />
</div><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><b>LED basics:</b><br />
</div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjb6FHGmTwY8FZbDL3Q045OWFZxrEZtdn-SFO7O_iANrtXL3hUbZTMeHGCpgTIu6cLgxokE98oKvT0ED2hmCcPs8gTn-pMOKaWja8TnNBmBRm8CVWkaBtyZg2Sv7JAu1phO1057bqMzpKdn/s1600-h/ledlamp2.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="146" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjb6FHGmTwY8FZbDL3Q045OWFZxrEZtdn-SFO7O_iANrtXL3hUbZTMeHGCpgTIu6cLgxokE98oKvT0ED2hmCcPs8gTn-pMOKaWja8TnNBmBRm8CVWkaBtyZg2Sv7JAu1phO1057bqMzpKdn/s200/ledlamp2.jpg" width="200" /></a><br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">Just to understand the main building block of the lamp: LEDs (light emitting diodes) are semiconductor heterostructure devices meaning that they have rectifying properties so that current only passes through one direction, while in the other way around it doesn't. While this is true for all diodes, the plus for LEDs is that light emission will happen only when they are conducting. Even if this is the case there is a certain threshold for the light emission to start which is around 3.5V for blue and white LEDs. Above this threshold the current through the device rises exponentially so it needs to be regulated which is usually achieved by either an external resistor in series or a current generating power supply circuit. <br />
</div><br />
<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><b>LED lamp:</b><br />
</div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT4ZoNuU5VZBbhhiD1cue3J2kjIGRkDN3RjeN108BxrVqyNAFeiKh_5kF36-bxJOVNKpRWxrwdNA_I6Cn_tcGf4-NTzfcEyDA2NX9Mt4roXRH9W6eEEaBpxeIajnfUsekd7Z-g5kaDisNy/s1600-h/ledlamp.sch.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="181" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT4ZoNuU5VZBbhhiD1cue3J2kjIGRkDN3RjeN108BxrVqyNAFeiKh_5kF36-bxJOVNKpRWxrwdNA_I6Cn_tcGf4-NTzfcEyDA2NX9Mt4roXRH9W6eEEaBpxeIajnfUsekd7Z-g5kaDisNy/s400/ledlamp.sch.png" width="400" /></a><br />
</div><div class="separator" style="clear: both; font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">Let's see what we have here: Regulation on the AC side is done by C1 as it acts as a finite impedance at 50Hz. The point is that the this is achieved without any unnecessary dissipation as there is no heat generated on C1. D1 is an integrated <a href="http://en.wikipedia.org/wiki/Graetz_bridge">Graetz-bridge</a> which rectifies the input voltage. The role of C2 is <a href="http://en.wikipedia.org/wiki/Graetz_bridge#Output_smoothing">smoothing</a> the output and R4 is an additional protection for the LED block. R1, R2 and R3 discharge the capacitors after switching the lamp off (most likely due to safety reasons). I also put some measurement data on the schematics: the 48 LEDs in series operate from a sum of 179V meaning that each LED has a voltage drop of 3.73V on average, in good agreement with our expectations. The 110mV voltage across the 10 Ohm resistor tells that 11mA flows through the LEDs meaning that the dissipation of the block is 11mA×179V=1.97W which is way lower than the expected 4.5W! Indeed it is not surprising that the light output of this lamp is not enough especially if compared to compact fluorescent lamps. The <a href="http://en.wikipedia.org/wiki/Power_factor_correction">power factor</a> can also be calculated: the voltage drop over C1 is 124V leading to a power factor of 0.84. This value of course becomes important if LED lighting is to take a major role in households.<br />
</div><div class="separator" style="clear: both; text-align: justify;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">In conclusion it turns out that the electrical circuit is as simple as possible leading to a high average lifetime of the device (I expect it to be comparable to the couple of thousand hours of compact fluorescent lamps). No 50Hz wobbling of the light output is also a benefit of the device. However the efficiency of the principle described above is given by the fact that many low power LEDs was put in series leading to a voltage drop of 179V on the LED block with only 11mA current consumption. High power LEDs cannot be used this way since each single (!) chip has a light output better then this entire block while consuming several hundred mA-s at around 3.5V (a good example is </span><a href="http://www.cree.com/" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Cree's</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> </span><a href="http://www.cree.com/products/xlamp_mce.asp" style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">XLamp</a><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> series). This means that a more complicated power supply is necessary for such a LED lamp which together with the more expensive LED means more expensive device but way better light output as well (especially true for devices equipped with three or four high power LEDs), so I recommend buying such a lamp instead of these cheap ones. </span><br />
</div><div class="separator" style="clear: both; text-align: justify;"><br />
</div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com0tag:blogger.com,1999:blog-5844573689471194951.post-30577072726658144442010-01-23T03:19:00.001+01:002010-02-09T22:46:10.309+01:00WD MyBook Hacks - Remove Default Shares<div style="text-align: justify;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">The default shares - [Download] and [Public] - always annoyed me quite a lot, so I figured out how to remove them, since simply deleting them obviously won't work:</span></div><ol style="text-align: justify;"><li><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">stop samba daemon:</span> <span style="font-family: "Courier New",Courier,monospace;">#~: /etc/init.d/S90smbd stop</span></li>
<li><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">edit </span><span style="font-family: "Courier New",Courier,monospace;">/usr/private/user_smb_conf/.overall_share</span><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">: remove sections </span><span style="font-family: "Courier New",Courier,monospace;">[Download]</span><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> and </span><span style="font-family: "Courier New",Courier,monospace;">[Public]</span><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"> (should be first two sections). Note: Here you can also check the other shares manually.</span></li>
<li><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">start samba daemon:<span style="font-family: "Courier New",Courier,monospace;"> </span></span><span style="font-family: "Courier New",Courier,monospace;">#~: /etc/init.d/S90smbd start</span></li>
</ol><div style="text-align: justify;"><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Well, that's all. It is also possible to make a backup copy of .overall_share so that it can be restored if necessary since we did not delete the actual directories.</span><br />
<span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">Update: the web interface seems to overwrite </span><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">.overall_share adding the removed sections always if a new user is added or user credentials are changed. The obvious yet inconvenient solution is to do this hack every time it is necessary, while the proper solution would be to alter the corresponding part of the web interface. This I haven't figured out yet, but I will post it if I succeed. </span></div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com2tag:blogger.com,1999:blog-5844573689471194951.post-75322178973803567392010-01-18T22:46:00.000+01:002010-01-18T22:46:16.757+01:00WD MyBook Hacks - Built-in Webserver<div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">Apparently the white light version of MBWE broke up with <a href="http://www.lighttpd.net/">lighttpd</a>, and hooked up with <a href="http://acme.com/software/mini_httpd/">mini_httpd</a>. Reason for this is unknown for me, one thing is sure however: If you want to be on the safe side and use the web-based admin interface, it is better to live with it. I do believe that other http servers can be installed, including:<br />
</div><div style="font-family: "Courier New",Courier,monospace;">~#: ipkg list | grep httpd<br />
</div><div style="font-family: "Courier New",Courier,monospace;">lighttpd - 1.4.25-1 - A fast webserver with minimal memory footprint.<br />
minihttpd - 1.19-2 - small HTTP server<br />
nostromo - 1.9-1 - nhttpd is a simple, fast and secure HTTP server.<br />
php-thttpd - 2.25b-5.2.12-1 - php-thttpd is thttpd webserver with php support<br />
thttpd - 2.25b-5 - thttpd is a lightweight http server<br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">Each has a separate way to configure, the only thing that has to be made sure is that it binds to a different port than the default 80. Or, even better the admin interface can be removed from port 80, by using -p command-line parameter discussed later on.<br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif; text-align: justify;">Anyhow, at the moment we deal with the mini_httpd:<br />
</div><div style="font-family: "Courier New",Courier,monospace;">~#: ps ax | grep http<br />
</div><div style="font-family: "Courier New",Courier,monospace;"> 2566 root 832 S < /usr/sbin/mini_httpd -d /proto/SxM_webui -c **.mp3|**<br />
16981 root 584 S grep http<br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">which tells us that the served directory is<span style="font-family: "Courier New",Courier,monospace;"> /proto/SxM_webui</span>. This means that additional files or directories created there will be served as well by the daemon so it is suitable for share simple things not including password protection, virtual hosts and so on...<br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">In fact, I did not find any reasonable online manual page for mini_httpd, yet its basic features are easy to find:<br />
</div><div style="font-family: "Courier New",Courier,monospace;">~#: mini_httpd --help<br />
</div><div style="font-family: "Courier New",Courier,monospace;">usage: mini_httpd [-C configfile] [-D] [-S] [-E certfile] [-Y cipher] [-p port] [-d dir] [-dd data_dir] [-c cgipat] [-u user] [-h hostname] [-r] [-v] [-l logfile] [-i pidfile] [-T charset] [-P P3P] [-M maxage] [-maxproc max_concurrent_procs]<br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">On my system<span style="font-family: "Courier New",Courier,monospace;"> /etc/init.d/S55mini_httpd</span> starts the server with the following syntax:<br />
</div><div style="font-family: "Courier New",Courier,monospace;">/bin/nice -n -20 \<br />
/usr/sbin/mini_httpd \<br />
-d $WEBROOT \<br />
-c "**.mp3|**.m4a|**.mp4|**.mov|**.pdf|**.wma|**.m4v|**.php|**.cgi" \<br />
-u root \<br />
-l /var/log/mini_httpd.log \<br />
-i /var/run/mini_httpd.pid \<br />
-maxproc 16 \<br />
-p $HTTP_PORT <br />
</div><div style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;">with <span style="font-family: "Courier New",Courier,monospace;">$WEBROOT</span> being just as above and <span style="font-family: "Courier New",Courier,monospace;">$HTTP_PORT = "80"</span>.<br />
</div>Attila Geresdihttp://www.blogger.com/profile/13424583443160373783noreply@blogger.com4