Wednesday, December 17, 2008

Ganglia tricks

Ganglia is a powerful monitoring tool for clusters. Some tricks:

1) remove dead node
try to restart gmond and gmetad.
in /etc/gmond.cong, try to set host_dmax=3600 (sec) in globals.

2) two clusters in one subnetwork
for gmetad to collect data from corresponding cluster (not the other), the trick is to set the TCP/IP port for these two clusters to be different. For instance, the default port is 8649. You can set the second one as 8648. Then, in the server with web frontend, edit gmetad.conf, and put something
data_source "Cluster1" c1_headnode:8649
data_source "Cluster2" c2_headnode:8648
to show all info in one web interface.

Wednesday, December 3, 2008

Create software RAID with mdadm

Here, I will briefly list the steps to create a software RAID5 with mdadm.

1) use "fdisk -l" to check the available hard drives. In my case, I will allocate 4 drives: /dev/sdb, to /dev/sde.
2) to create partitions on raid drives, "fdisk /dev/sdb"; "n->p->1" to create a new partition, /dev/sdb1, "t" to change partition type, use code "fd" to set it as Linux raid autodetect. Do the same for the rest drives.
3) to create the raid "mdadm --create /dev/md0 --chunk=64 --level=raid5 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1". And it will report that /dev/md0 is created and started. (note that it's md0, 0 as number zero, not letter o).
4) "cat /proc/mdstat" and wait for the reshaping process to complete. It will take hours, so don't wait, come back later. After this is done, continue the following.
5) to format the new device "mkfs.ext3 /dev/md0". It will also takes a little while to complete.
6) create a mount point and mount /dev/md0 there. You can also edit /etc/fstab to mount it automatically next time.
7) "mdadm --detail --scan > /etc/mdadm.conf" to save the raid configuration,
8) use "mdadm --detail /dev/md0" to check raid status. also "smartctl --all -d ata /dev/sdb" to check the SMART status of each hard drive.

Emacs problem in Cygwin after rebase

In Cygwin, in order for grace (xmgr) to work, you need to rebase (google it for the guide). But after rebasing, emacs stops working: it hangs there and costs all the CPU. The solution is to reinstall libncurses7. Yeehooo....!

Tuesday, November 18, 2008

Insert driver to Linux initrd.img

Recently, I tried to install Rocks Cluster to some new computers. The problem is that newly introduced motherboards contain gigabit ethernet controllers whose drivers are not included in Linux installer. This gives a lot of troubles in installing the node.

Rocks documentation suggests re-compiling the kernel roll by putting in the device drivers. Somehow, the compiling process works but the installation has problems in finding in libs.

I found an easy way to insert the drivers, i.e., to modify the initrd.img.
The procedures are, for example,

1) in /tmp, mkdir /tmp/initdproject to create a work directory.
2) gunzip < /tftpboot/pxelinux/initrd.img > /tmp/initrdproject/initrd.img.unzipped
3) cd /tmp/initrdproject; mkdir initrd
4) cd initrd; cpio -idv < ../initrd.img.unzipped
5) mkdir /tmp/initrdproject/modules
6) cd /tmp/initrdproject/initrd/modules
7) gunzip < modules.cgz | (cd /tmp/initrdproject/modules && cpio -idv)
8) cp your driver, in my case r8168.ko: cp /somedir/r8168.ko /tmp/initrdproject/modules/2.6.18-53.1.14.el5/x86_64
9) verify your r8168.ko has the right attrib, if not, chmod 744 r8168.ko
10) cd /tmp/initrdproject/modules; find 2.6.18-53.1.14.el5 | cpio -ov -H crc | gzip > modules.cgz
11) copy back modules.cgz to replace the old one: cp /tmp/initrdproject/modules.cgz /tmp/initrdproject/initrd/modules
12)cd /tmp/initrdproject/initrd/modules, change module configuration files as following steps
13) edit module-info, add
r8168
eth
"RTL8168/8111 Gigabit Ethernet"
14) edit modules.alias, add
alias pci:v000010ECd00008168sv*sd*bc*sc*i* r8168
15) edit pci.ide, find 10ec Realtek ...., and add
8168 RTL8168/8111 Gigabit Ethernet
16) ok, pack things back now.
cd /tmp/initrdproject/initrd
find . | cpio --create --format='newc' > ../newinitrd
cd ..
gzip <> initrd.img
17) copy initrd.img back to replace the origin initrd.img (don't forget to backup).

Monday, October 13, 2008

Linux: update drivers

For a updated driver to be corrected recognized in the next boot:

To save the current ramdiscimage and make a new one:
> mv /boot/initrd.img-`uname -r` /boot/initrd.img-`uname -r`.old
> mkinitramfs -o /boot/initrd.img-`uname -r`

Thursday, October 2, 2008

RAID configuration

I will introduce the different RAID configurations commonly used.

1) RAID 0: simply connect several drives together as one big drive.
Good things:
* cost no CPU, so the onboard(motherboard) RAID controller or soft RAID is adequate.
* simple configuration
* sometimes, for big files, the read/write speed is promoted as you are writing to several disks at the same time. In this sense, don't put two drives on a single IDE cable (master and slave) for IDE hard drives.
Bad thing:
* No redundancy. One drive goes bad, all things are lost. You are double, triple .... chances of losing data.

2) RAID 1: simply mirror of two drives. This is a way to protect your data while maybe costs a little machine efficiency.

3) RAID 1+0 (which is also called RAID 10): use several disks as RAID0 and the same number of mirror disks ( RAID 1). Taking the advantage of both speed and safety. But not efficient.

4) RAID 5: RAID 5 is the most popular RAID configuration to take the both advantage of date redundancy (by additional parity data) and the read/write speed by accessing many disks at the same time. A RAID 5 uses block-level striping with parity data distributed across all member disks.
* You will need at least three drives for RAID 5.
* You had better buy a decent RAID controller card (with an own CPU) rather than cheap controllers( 99% of motherboard controllers) because there are a lot of calculations which may instead cost your own CPU.

5) JBOD: JBOD stands for Just a Bunch Of Disks (Just a Box Of Drives). Some RAID controllers use JBOD to refer to configuring drives without RAID features. Each drive shows up separately in the OS. Concatenation or Spanning of disks is not one of the numbered RAID levels, but it is a popular method for combining multiple physical disk drives into a single virtual disk. It provides no data redundancy. As the name implies, disks are merely concatenated together, end to beginning, so they appear to be a single large disk. The good thing compared with RAID 0 is that you can combine different volumes of physical drives (120G, 300G ...) into a single logical drive. This is similar to Logical Volume Manager(LVM) in Linux.

6) Linux soft RAID compared with RAID controller.
It's almost the same unless RAID 5 will cost a little bit of CPU.


FAQ:
1) how to build a RAID 1 for an existing drive?
You will loose the data in existing disk. The proper procedure a) better back up the data first(actually recommended to all raid changes)
b) create the array first with the new drive, c) copy data back d) add the old drive as the missing drive .
in linux, use commands as
mdadm --create /dev/md0 --level 1 --raid-devices=2 missing /dev/sdb2
mdadm /dev/md0 -a /dev/sda2

2) add a new drive to RAID 5 (grow).
IN general, possible. But be sure to check the RAID controller manual to see whether it's supported. If supported, you need to add the drive to the existing RAID in the configuration menu(BIOS).

For soft-RAID, you can skip and boot Linux directly.

The general procedure is 1) to add the drive to the RAID array 2) to reshape the data distributed.

In Linux, use commands like
mdadm --add /dev/md1 /dev/sdx1
mdadm --grow /dev/md1 --raid-devices=n (n = new total numbers of physical drives).
Then wait hours for it to reshape.

3) recover the hard drive failure in RAID 5. If one drive fails, you still have chances to fix it. Normally it's a procedure by replacing the failed drive and rebuilding the data from other drivers. But be sure to read the hardware/software manual first.
In linux a) use # smartctl -cv /dev/hdx to check the failed drive, 2) shutdown the computer and replace
the failed drive. 3) reboot (very slow), partition the new drive as type fd (that is in hexadecimal, aka 0xfd), "Linux raid autodetect". 4) /sbin/mdadm /dev/md0 -a /dev/sdx1.






What is SELinux (Security-Enhanced Linux) ?

What is SELinux (Security-Enhanced Linux) ?
Wiki: Security-Enhanced Linux (SELinux) is a Linux feature that provides a variety of security policies, including U.S. Department of Defense style mandatory access controls, through the use of Linux Security Modules (LSM) in the Linux kernel. It is not a Linux distribution, but rather a set of modifications that can be applied to Unix-like operating systems, such as Linux and BSD. Its architecture strives to streamline the volume of software charged with security policy enforcement, which is closely aligned with the Trusted Computer System Evaluation Criteria (TCSEC, referred to as Orange Book) requirement for trusted computing base (TCB) minimization (applicable to evaluation classes B3 and A1) but is quite unrelated to the least privilege requirement (B2, B3, A1) as is often claimed.[citation needed] The germinal concepts underlying SELinux can be traced to several earlier projects by the U.S. National Security Agency.

More resources:
WIKI

I will take the example of Fedora 9 as an example to explain the settings for SELinux. More to come ....

SELinux and Intel Fortran/C compilers

I have met several problems with SELinux when using Intel Fortran/C compilers on EMT64 systems. For examples, one with the libifcore.so.5 conflict : http://physicscomputing.blogspot.com/2008/04/intel-fortran-compiler-selinux-and.html.

A recent problem is the program stopped after running for a couple of hours, only reporting page errors in /var/log/messages. The system sometimes crashed. After I disabled the selinux, everything is fine.

SELinux has restricted certain access to shared libraries. You can configure it to allow the access to shared libraries. In Fedora Core, you can bring up "system-config-security". If you feel that the computation stability is of the first priority or your computer is well protected(such as nodes in a cluster), you can simply disable SELinux.

Friday, September 26, 2008

Bargain workstations available: MSI introduced a 8DIMM motherboard for Core 2 Quad/Dual systems

MSI launches "P45-8D Memory Lover" motherboard: the world's first motherboard equipped with 8 memory slots. Intel P45 chipsets support DDR2 memories up to 16GB and MSI is the first to make 16GB possible. It is already available on market for around $160 dollars. This provides the cheapest option for workstations. Reason: Core 2 Quad CPUs are cheaper than Xeons; unbuffered non-ECC memories are cheaper than registered ECC memories for servers.

Estimate the cost for a workstation with 16GB memory:
1) get this motherboard for $160
2) CPU, recommand the 1333MHZ core 2 Quad Q9550 ($300) or Q9650($500). 1666Mhz is still very expensive right now.
3) P-45 only supports DDR2 to 16GB while 8GB max for DDR3. Currently, DDR2-1066 only has 1GB/DIMM avaiable. We have to pick DDR2-800 8x2GB: around $300.
4) hard drive: depends, let bugget $150 for a 1TB SATAII drive.
5) a cheap graphic card and computer case around $100.

The total cost is around $1000. Wowwwww

Something to correct: the 8 DIMM slots are actually 4 for DDR2 (up to 16GB) and another 4 for DDR3 (up to 8GB). There are limited types of 4GB/DIMM non-Ecc unbuffered memory available: for instance OCZ 4x4GB PC2-6400 DDR2800, CL 5-6-6-18, for $350.  But I expect more manufacturers will come into this line.  This 4GB chip was useless because Intel chipsets only support up to 8GB mem while nVidia's chipsets (claiming to support up to 16GB) are not popular relatively . But since the introduction of P45 chipset generations, 4GB chips are born! 




Thursday, July 17, 2008

Ultimate pocket gadget: Iphone, Windows Mobile, or Nokia Tablet

Apple has released its 3G versions of Iphone: you probably are already tired of hearing this word, iphone. But yes, I believe this is the one. Oh gee, why only apple makes things right?

OK, I have owned a blackberry, Nokia internet tablet, ATT 8525 Windows Mobile, but I still want an iphone. Here's the story.

What do you want to do with a pocket electronic gadget?
1) communication: to make phone calls, internet chat, messaging, email
2) basic internet surfing, such as checking news headline, weather, traffic, googling
3) maps, GPS is a plus
4) multimedia, such as watching videos,listening to music
5) personal organizer, such as addressbook, calendre, to-do list
6) gaming
7) E-book reader

Let one first review all these products.
1) Blackberry: The advantages of blackberry phones are push-emails and full-qwerty keyboard. But these features have been and will be included in other phones. It allows third-party applications in Java. Unless there is a big development in Symbian OS, I doubt that blackberry phones won't be able to compete with iphone, windows mobile phones in high-end applications for pocket computers. However, blackberry indeed has decent phones, very clear voice and very helpful voice command features. It will remain a good choice for cellular phones with message support. 
2) Windows mobile. I used a Cingular 8525(HTC Hermes). I don't like this bulky phone. Maybe Samsung's models are better. Well, this is Microsoft's Windows. So, almost all feature can be implemented. At the same time, like Windows VS MacOS,  or Zune VS IPOD, don't expect everything to work perfectly. I especially don't like the fact that almost any usable programs in windows mobile is not free. 
3) Nokia internet tablet. I owe a Nokia 770. There are great improvements along this product line to include camera, GPS, Qwerty-keyboard. Big thing, it is a Linux computer! So, you can have all the wonderful and free programs running in Linux. I indeed enjoyed the touchscreen, and a bigger screen( good enough to read ebooks and pdf files).  But this is not a cellular phone (although you can use the phone feature through internet, such as skype, google talk, gizmoproject). I believe Linux in the long run has advantages over Symbian. Nokia, a big fan for Symbian has converted their top intelligent phones to Linux.   

4) Google has created all nice web applications for mobile internet devices. All it need is a platform. It's no surprise that Google will introduce it's own Cellular phone version. Anyway, when you can have Wireless Internet connections everywhere, who will need a cellular phone? 

5) Iphone, almost perfect! While applications are important, they are not all. Imagine there are so many MP3 players in the market, why does IPOD win the major share? I am a big fan for MacOS due to its simple operation and a lot of free applications. MacOS is indeed a powerful Linux + a nice Windows user interface. 

My perfect pocket PC will be
1) having a decent computer system, such as CPU, memory, flash-card support. 
2) running Linux or MacOS, with lots of free application available.
3) big LCD screen while foldable to fit in my pockets. 
4) support external devices, such as printer, monitor, keyboard via USB, bluetooth, ...
5) good touchscreen features, handwriting recognition. I love Apple's two-finger control. Hey, most people has ten fingers, and a mouth, and body movements. Can we use some of these too?

Wednesday, July 16, 2008

Connecting SATA disk array

Let's say, you want an external enclosure for sata drvies and hook up to your computer. Here's the solution.

1) use sata multilane: check this guide. Basically, you can connect four sata drives to four sata ports in your computer with a single sata multilane cable(bridge).

2) use sata port multiplier, check this guide Theoretically, it is possible to hook up 15 sata drives to one sata port on your computer(motherboard or PCI sata adaptor) with port multiplier. Yet, they have to share 3Gbps band width. Actually, commercial SATA disk arrays use port multiplier. Check addnonics as an example: it has internal/external 5x1 port multiplier which allows 5 sata drives on one sata/eSATA port.

3) commercial enclosures can also provide interfaces such as Fiber Channel, SCSI, SAS and Infiniband. Check out some commercial products, such as Sans Digital.

FAQ:
1) how to get an eSATA port?
You can use a SATA to eSATA converter or get an eSATA PCI adaptor.

Disk storage solutions for workstations

In this article, I discuss the options for installing storages (hard disks) on workstations and servers.

Let me first explain some of the terminologies

1) the type of physical hard disks
Desktops and workstations usually use 3.5in hard disks, which come in the following interfaces:
  • a) Ultra-ATA(parallel Advanced Technology Attachment, also known as IDE or EIDE) drives. Ultra-ATA 100 supports the transfer rate of 100M/s and has the capacity as large as 750GB for a single drive. These are used in old desktops, and have been replaced by SATA drives for better performance. Price: 750G for $120.
  • b) SATA(serial-ATA) drives. Currently, SATA-II(or SATA-300) supports a transfer rate of 300M/s (raw bandwidth 3G/s) and the capacity as large as 1TB (Seagate will release a 1.5TB drive soon). Price: 1TB for $200.
  • c) SCSI(Small Computer System Interface) drives. Most commonly ones found on market is Ultra-320 (supports 320M/s) and 300GB in capacity. Price: 300GB for $200.
  • d) Fiber-channel drives. Common ones on market are FC-AL (Arbitrated Loop) 2G/s (200M/s transfer rate), 300GB for $585.
  • e) SAS (Serial Attached SCSI), current 3Gbps models support transfer rate of 375M/s. Price 300GB for $188.
  • f) Infiniband, this is relatively new and rare and extremely expensive.

2) Connection type
  • a) external or internal: usually the desktop computers and workstations have limited space inside the main case, limited power connectors, motherboard connectors which limit the number of hard drives put inside. For instance, for normal desktops, 4 sata drives are usually at its maximum. Supermicro workstations can put 8 drives inside. So, if you want bigger storage, an external disk array (including rackmount) is recommended. If we choose an external array, all you need is a (external) connection port from the main workstation/server. You then need a PCI adaptor if the motherboard doesn't come with one.
  • b) connection bus. Besides the type of drives mentioned above, we can also connect the external drives with FireWire or USB. The number of drives and the connection speed is summarized in wikipedia, and is copied here:
Name ↓ Raw bandwidth (Mbit/s) ↓ Transfer speed (MB/s) ↓ Max. cable length (m) ↓ Power provided ↓ Devices per Channel ↓
SAS 3000 375 8 No 4
eSATA 3000 300 2 with eSATA HBA (1 with passive adapter) No [11] 1 (15 with port multiplier)
SATA 300 3000 300 1 No 1 (15 with port multiplier)
SATA 150 1500 150 1 No 1 per line
PATA 133 1064 133 0.46 (18 inches) No 2
FireWire 3200 3144 393 100; alternate cables available for 100 m+ 15 W, 12–25 V 63 (with hub)
FireWire 800 786 98.25 100[12] 15 W, 12–25 V 63 (with hub)
FireWire 400 393 49.13 4.5[12][13] 15 W, 12–25 V 63 (with hub)
USB 2.0 480 60 5[14] 2.5 W, 5 V 127 (with hub)
Ultra-320 SCSI 2560 320 12 No 16 (HBA is a device)
Fibre Channel
over copper cable
4000 400 12 No 126
(16777216 with switches)
Fibre Channel
over fiber
10520 2000 2–50000 No 126
(16777216 with switches)
Infiniband
12X Quad-rate
120000 12000 5 (copper)[15][16]

<10000>

No 1 with Point to point
Many with switched fabric


OK, we can decide what kind of storage system is good for us. Infiniband, Fiber-Channel, SAS are relatively new and expensive. The common solutions currently are either SCSI or SATA. SCSI has been tested for more than 20 years for its reliability and availability. Many businesses still prefer SCSI for mission critical appliations. SATA drives are relatively new. But due to its price and performance, it has gained more commercial market. In another aspect, external SATA 3.0Gbps drives may be connected to SAS backplanes, or Firewire, Infiniband buses.

I will prefer SATA drives because 1) it's big (1TB each drive); 2) it's cheap; 3) the flexibility of connections. I will focus on SATA drives below.

If you want to put SATA drives inside the workstation, notice that normal motherboard only supports 4-6 SATA ports, you will need another SATA adaptor or port multiplier(can also mounted as a PCI card). Also, there are limited SATA power connectors. You can buy IDE to SATA power connector with splitters(usually a few dollars). But make sure that you have a big power supply.

For external drives, there are commercial disk arrays which comes with either eSATA, ethernet, SAS, Firewire, USB interfaces. If speed is not the first priority, for instance, backup devices, you can take Firewire, USB, or ethernet interfaces. Otherwise, you want these external drives run as fast as internal drives, choose eSATA or SAS.

I will discuss how to connect SATA arrays in next blog.

Tuesday, May 27, 2008

Ubuntu installation

Ubuntu provides a very user-friendly interface. I will recommend it for desktops and laptops. However, since the installation media is a CD-ROM, the preinstalled softwares are limited. Here are procedures for additional softwares:

1) add a Medibuntu repository, including many commerical softwares which ubuntu cannot include in their own repositories, such as acroread, skype, mplayer. Check the method here. For instance, for 8.0.4(hardy),
  • Ubuntu 8.04 "Hardy Heron":

    sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list

Then, add the GPG Key:

sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update

then you can use "sudo apt-get install acroread" to install the adobe acrobat reader, as well as its mozilla plugin.
2) install LaTeX
sudo apt-get install tetex-base tetex-bin tetex-extra

3) install emacs, gnuplot, grace ....,

Some problems:
1) for nvidia graphical cards, the system will prompt you to install an enhanced driver nvidia-glx. However, there's a bug which messes up with your LCD monitor refresh rate. A temporary solution is to edit /etc/X11/xorg.conf, in Device section, add
Option "DynamicTwinView" "false"

Sunday, May 25, 2008

Leopard: how to fix the pdf fonts problem in preview

It appears to be the problem with the corrupted font cache. To clean/fix the corrupted cache,

To delete the ATS cache folder for the current user:

sudo rm -rf `lsof | grep com.apple.ATS/annex.aux \
| grep Finder | cut -c 66-139`

To delete the ATS cache folder for all users:

sudo rm -rf /private/var/folders/*/*/-Caches-/com.apple.ATS

After running this script, the machine should be restarted so that the caches can rebuild.



This solution is from http://www.macosxhints.com/article.php?story=20071026081555971

Tuesday, May 20, 2008

Computer Deals

If you want to buy a computer or PC parts, these are the places I will research on at first.

Convert a fat32 partition into ntfs

Windows comes with a utility called "convert" with which you can convert a fat32 partition into a ntfs file system.

  • open a terminal (command prompt) from "Run"->"cmd"
  • let's say, drive D is in fat32 format and you want to convert it. Use "vol d:" to check the volume name.
  • Use "convert d: /fs:ntfs" to convert. You will be asked for a volume name: you can either use the old name or pick a new name.
  • Wait for the conversion to be completed.
  • Although it's usually flawless (without losing any files) for this procedure, you are advised to back up your data in that drive before the conversion for secure purposes.

Friday, May 16, 2008

Upgrade your hard drive: procedures and problems

There are many cases you might want to upgrade your hard drive: 1) you are running out of space on your laptop or PC; 2) when you buy new PCs, manufacturers usually charge higher for hard drive upgrade and you want to purchase with the lowest configuration and upgrade by yourself.

The question here is how you can make a "TRUE COPY" of your old hard drive to the new drive.

I will share my experience in upgrading a Lenovo Thinkpad T61 with Windows XP installed.

1) Buy a new hard drive.

You have to figure out the exact model that your computer supports. For instance, interface (EIDE or SATA), size (2.5", 3.5" ...).

For T61 or most current-day laptops, find a 2.5" SATA drive. Actually, I purchased a portable external drive (for instance, Maxtor OneTouch 4 mini). The benefits of the external drive are: a) you can firstly plugin to copy the hard drive; b) after switching drives, you can still use the old drive as an external storage.

2) Hard drive copy: copy all partitions in the old drive to the new one.

Method: a) direct partition to partition copy; 2) backup your drive into an image and then restore the image to the new drive.

Software: there are many commercial products, such as partition magic, Norton Ghost, ... I picked a free software called Disk Copy (Supports IDE, SATAI, SATAII, SCSI, Firewire(IEEE1394) and USB drives). Another software I want to mention is Gparted, which is included in the Ubuntu installation and live CD.

3) Procedure:
  • download Disk Copy from here, and burn it into a CD.
  • keep the old drive your laptop and plugin the external hard drive (USB).
  • boot the Disk Copy CD.
  • You have the optional for "Disk Copy" or "Partition Copy". I pick Partition Copy
  • Pick the source(from the old drive) and the destination(from the new drive) partition. If you pick the destination in an existing partition in the new drive, the existing parition will be deleted and a new partition will be created with the same size as the source partition ( the rest will be left as unallocated space. If you pick the destination from a unallocated space, then a new partition is created.
  • Copy ....... The speed of copying is 800MB/Min ( I guess it's limited by the USB connection speed). Since it does a sector to sector copy, a 80GB partition will cost around 100 mins.
  • Repeat the above procedures for all partitions you want to copy.
  • Shutdown the computer, switch the hard drive.
  • Turn on the computer with the new drive, cross your fingers ......

PROBLEM

All right, my copy of the Windows XP doesn't boot normally; it hanged on the booting screen with Microsoft Windows XP logo.

Problem: I reinserted the new hard drive into the enclosure and read the boot log from another computer; discovered that the device drivers are loaded OK but then the computer tried to load files from "E:\Windows" instead of "C:\windows". OK, I realize that XP "thinks" the new drive as another drive.

Solution: change the drive letters. This can be done by changing the registry table "HKLM\System\MountedDevices\DosDevices\C:".

How can you edit the registry table without being able to boot into the system?

I found one tool named Offline NT password and registry editor. It's a bootable CD which boots into a program in a Linux envoinment. The problem allows you to change certains things on your Windows 2000/XP/NT systems, such as registry table, passwords(!).

Procedure to fix my problem: the registry table editor in ntpasswd works prefectly on HKLM\Software, but not always on HKLM\System. For instance, I cannot write back as "/Windows/System32/Config/System is read-only".
  • create the ntpasswd CD.
  • boot the CD with the new drive in the laptop and an external drive (for instance, a USB pen drive).
  • follow the prompt of the CD, pick "system" and use option "9-registry editor"
  • use "?" to find a list commands in the editor. you can "ls" to list; "cd xx" to enter a subkey.
  • ok, I use "cd MountedDeives". but then i cannot edit the value for "\DosDevices\C:". So i deleted all of \DosDevices. the idea is that i cleared all the drive letter assignments, in the next boot, XP will try to reassign drive letters, and hopefull get it right(indeed it worked !). The command to delete a key is "dv xxx".
  • all right, press q to quit and quit. It then prompted you to write the modified registry table back. But it failed as I mentioned "/Windows/System32/Config/System is read-only".
  • after the failure, the ntpasswd exited to a linux prompt.
  • mount the USB drive, for instance "mount -t vfat /dev/sdb1 /mnt".
  • the modified registry file is in "/tmp". So, "cp /tmp/system /mnt".
  • shutdown the computer.
  • put the (new) hard drive into the enclosure and plug into another (bootable) computer together with the pen drive. Now copy the "system" file in your pen drive to the (new) hard drive "Windows(or Winnt)\System32\Config", replace the old "system" file(you can make a copy).
  • Now, insert the (new) hard drive back into the computer. Boot up, .... magic happens|
COMMENT: Windows IS STUXXX!!!

Saturday, May 10, 2008

LaTeX resources

LaTeXing in Microsoft Windows

  • TeX system:
    • MikTeX, a free LaTeX system, recommended
    • The teTeX system contained in Cygwin, a Linux-like environment for Windows.
  • Editor:
    • WinEdt, pretty good but not free
    • Texmaker, similar to WinEdt and is free, recommended
    • Emacs for Windows
    • Lyx, TeXmacs, two free WYSIWYG-tyle editors. They are developed for Linux systems, but now also available for Windows through Cygwin. You can either install Cygwin or download separate packages including cygwin utilities.
  • Bib manager:
    • Endnote, commercial product, compatable with BibTeX using certain filters
    • Jabref, a Java bibtex manager, support pushing references to WinEdt, just as pushing references in Endnote to Microsoft Word, recommended
  • TeX for Powerpoint:
    • Tex4PPT, good for inserting equations
    • TeXPPT, good for inserting inline math

LaTeXing in Mac OS

There are already many helpful websites about installing TeX on Mac OS X, for example,

my preferences are

Friday, May 2, 2008

Linux Clustering softwares

The open sources version I would recommend:
which I have tested.

Of course, they are a lot of commercial versions, such as
Some useful links

Deals on Lenovo computers from Contractor Purchase Program

Note Added: the passcode is no longer valid! 

If you are interested in buying a lenovo computer ( I think the thinkpad notebooks are the best built notebooks available), you can try to order one from
http://www.lenovo.com/cpp with passcode 556655.


The R61 series start from $455.79.
The T61 series start from $631.74.
The X61 series start from $870.18,
as listed today. They are 10-40% cheaper than the regular lenovo website.

Thursday, May 1, 2008

Some useful sites for scientific computation

MacOS/WinXP dual system clock errors

When you have both Mac OSX and Windows XP/Vista on your computer, you will notice that the clock will change when you switch between two systems. This is due to that Mac treats the hardware clock(shown in BIOS) as GMT time while windows treats that as local time. The solution is then to make them agree with each other.

To make Windows take GMT time
Create a file, for instance, clockfix.reg, as

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation] "RealTimeIsUniversal"=dword:00000001

and run it (by double-clicking).

To make Mac OSX use local time
First you'll need to add a line to /etc/rc.local:

date `date -u +%m%d%H%M%Y`

And to /etc/rc.shutdown.local you'll need to add this:

date -u `date +%m%d%H%M%Y`

Update: for leopard (10.5.x), the above method doesn't work. Please follow the instruction in this link.

Wednesday, April 30, 2008

How to create a Windows XP SP3 installation disk

All right, windows XP service pack 3 comes out (you can wait until the official final release or find a download link in my previous blog). Now, if you have an old Windows XP installation CD, for instance, I have one XP HOME SP2 with my laptop, you can make a new SP3 installation CD without the hassles to go over the update procedure.

Procedures:
1) copy all files in the original installation to hard drive, for instance, C:\XPSETUP
2) download the sp3. Let's say the name is sp3.exe
3) in a terminal command prompt( for instance, by running cmd from Start->Run...), run
"sp3.exe /integrate:C:\XPSETUP"
4) find a boot disk for windows XP, for instance, w2ksect.bin in wxp10.zip. (OK, this one doesn't work. Another method is to download ISO buster and use it to extract the bootdisk image from the original installation CD.)
5) in C:\XPSETUP, you may notice files names "WIN51", "WIN51IC.SP2". Make a copy of "WIN51IC.SP2" and rename it to "WIN51IC.SP3".(it actually has been automatically created by the integrate process!)
6) burn CD with your favorite burning software. For instance, I use Nero. Create a bootable CD, set the boot image file, create a label like WXPSP3HOME, pick data mode 1, ISO9660+Joliet, move all contents in C:\XPSETUP to the target CD project. And, burn!

Windows XP service pack 3

Microsoft has delayed the release of XP SP3 to end users (as April 29). The reason: "InfoWorld blogger Randall Kennedy insinuates that Microsoft is delaying Window XP SP3 to talk up the release of Windows Vista SP1. Kennedy believes Microsoft is showing its true colors by trying to salvage a fledgling product instead of releasing a much-needed rollout to its loyal customers."

Yet, there is a direct link for downloading SP3 leaked, named windowsxp-kb936929-sp3-x86-enu_c81472f7eeea2eca421e116cd4c03e2300ebfde4.exe. According to microsoft website, kb936929 is Release Candidate 3 version. I believe this is the final release version. 

OK, I have downloaded and installed it on my laptop. It was smooth and no problems met. Indeed, I can feel the computer runs faster than before. So, upgrading to SP3 is highly recommendated.

Friday, April 25, 2008

Build lapack with gfortran

Procedures to build lapack for a Linux x86_64 system with gfortran

  1. download the source package from netlib.org: lapack.tgz
  2. in a working directory, use "tar zxvf lapack.tgz" to unpack.
  3. "cd lapack-3.1.1"
  4. "cp INSTALL/make.inc.LINUX ./make.inc"
  5. edit the file make.inc, change the compiler g77 to gfortran
  6. "make blaslib"
  7. "make lib"
  8. if you want to compile and run the rest routines, run "make all"
  9. copy the generated library files *.a into a directory where you keep lib files, for instance $(HOME)/lib

Thursday, April 24, 2008

Tablet PC, your next laptop!

First things first, the tablet PC is the destiny! Imagine this,
  • You can hold a LCD just as holding a book, reading articles, surfing webs just with your fingers.
  • Taking notes on your computers, especially, with heavy math formula, chemical symbols, musical notes, or any graphical objects.
  • Giving interactive lectures or presentations: you can write on a computer(via a projector) the same way that you write on a blackboard, while you can pull out any multimedia objects for demonstration.
  • Painting on LCD screens just as painting on papers.
  • Listening to music or watching movies the same way you are using an IPOD touch
If you have ever thought about any of these, you want a tablet PC. Actually, after using a Nokia N770 tablet(with a 4in touchscreen) for a couple of months, I got tired of keyboard.

With the invention of active digitizer(compared with the conventional passive digitizer relying on pressures), writing on computers are much more easier and with much better accuracy. Buy Wacom stocks! (Can anybody tell me how I can buy stocks from Japanese stock market directly?)

Tablet PCs usually cost around $2000, beyond the reach for normal users. HP has introduced a budget tablet PC, tx2000 series (from the modification of the previous 1000 series). You can purchase a tx2110US model for $899 at Office depot this week. So, I believe the hardware cost is already within the range, and I believe by the end of this year, every PC manufacturers will have their budget tablet PC models. But the question is, whether the software companies are ready?

My comments:
  • Apple has already successfully introduced the touchscreen on iPhone and done many good things. I am looking forward to the Mac Tablet: 1) Apple appears to have the ability to do things right. For example, there were already so many manufacturers for MP3 players before IPOD but none can be compared with IPOD. 2) Apple's "imaginative" realization that, you can use two fingers to magnify or shrink the screen. Yes, we (most) have ten fingers, which should be much more flexible than a mouse. I believe that the next patent will be filed on using more fingers and the combination of fingers and a digital pen.
  • Microsoft is everywhere. Unfortunately, perfection is what it lacks. It already has several softwares for touchscreens and digitizer pens, such as Math journal( it's free, which is a rare thing for Microsoft). But they are just usable. Come on, do something better than that! Don't wait until Apple has done it again!
  • Tablets will greatly affect the orgnization of web pages and web applications. They will be more "finger"-friendly, at least, some bigger touchable items for easy browsing with fingers.

How to build a budget Linux cluster for scientific computation

Linux clusters have become the trend for scientific computations replacing the old style supercomputers. (Grid-computing is another way).

Here I share my recent experience in building a budget linux cluster, with

Hardware:
  • CPU: Intel Quad Core Q6600 (2.4GHz) , ~$300 with motherboard combo sale at fry's. It is expected that Intel will cut the price soon and Q9450 would be a better choice. I would not recommend AMD opetrons and Intel Xeon series as they are overpriced, unless 1) you are running enterprise servers and seeking better stabilities; 2) you want to install more than 8G memory on each node.
  • Motherboard: I used ECS GM-33T which includes onboard gigabit network adaptor and video card and supports 4 DIMM memories up to 8G. Pay attention to that current motherboard chipsets only support unbuffered non-ECC memory up to 8G( a variation of NVidia chipset can support 16G, but there are no 4G/DIMM memory on the market). But GM-33T doesnot allow overclocking Q6600 as this CPU is not designed for overclocking. However, there are reports that with another motherboard, one can overclock Q6600 to 3.4GHz without generating any overheat or causing any system instability.
  • Memory: I installed 4x2G DDR2-667 memories dimms, which cost around $160-200 at fry's.
  • Hard disk: 320G SATA disk costs $70 at fry's which is adequate for a node. For the headnode, you can pick, for instance, a 1TB for $200, or two of them for backup.
  • Case: I picked a $35 PC case. If you want to save space, you can buy a rackmount case which is available for $200(for instance, 2U).
  • Network: if you don't have heavy parallel jobs, a gigabit ethernet connection is adequate. Since the motherboard already has an onboard ethernet adaptor, you only have to purchase an extra network adaptor for the master node(for connection to WAN) and a gigabit network switch(the number of ports depends on how many nodes you are building).
  • DVD drives are optional, as you can always connect an external one when installing the operating system.
Software:
  • Operating system: I picked Fedora Core 8 x86_64 for the available software packages and amazing promptness of software updates. Of course, you can pick any one of your favor. For instance, CentOS(same as RedHat Enterprise server), SuSE, Ubuntu, Debian ...
  • Clustering software: I picked OSCAR (open source clustering application resources), which includes almost everything you will need for scientific computation, for instance, job scheduling(open-pbs, maui), parallel envionment(MPI, LAM). The latest release version (5.0) only supports Fedora Core up to 5 . However, there are nightly builds for newer versions of Linux http://oscar.openclustergroup.org/filebrowser/49/branch. In my installation with FC8, I find a lot of problems. If you are not very confident about your Linux skills, please go with Fedora Core 5 or CentOS 4, and intall the released version of OSCAR. Of course, you may face the problem that the old version Linux may miss the device drivers for your new computers. But I judge that it's easier.
  • Compiler: MPI compilers come with OSCAR is adequate. For single-node computations, Intel C++/Fortran compiler is free for non-comercial purposes. It's much better than GNU compilers.
  • I will blog later on the details of software installation.
Summary, by my choice , the master node costs $800 while $600 for each node. A 16 nodes(with 64 computing CPUs) cluster costs only a little above $10,000. Several programs are tested and each node is more powerful than a HP Proliant server(with 2 dual-core AMD opetron 2218), and is 10-20% slower than an Intel Xeon X5450(that one runs at 3GHz compared to 2.4GHz of Q6600). Unbelievable? Try it out!

Tuesday, April 15, 2008

How to change the default paper size in LaTeX

The default paper size coming with every latex system, including MikTex, teTex, Mac versions is A4. If you want to change it to letter, please follow these steps,

  • If you are using an old version(not pdfetex), or, you are still using dvips, dvipdf to create ps(pdf) files, you need to change the following files.
    For dvips, edit $TEX/texmf/dvips/config/config.ps, find
    @ A4size 594.99bp 841.99bp
    @+ ! %%DocumentPaperSizes: a4
    @+ %%PaperSize: A4
    you can either comment them by adding % in front of the lines, or move these lines behind the letterSize section.
    For dvipdf, edit $TEX/texmf/dvipdfm/config/config, find
    % Set default paper size here
    p a4
    change a4 to letter
  • If you are using pdflatex, depending on the specific version of TeX, you will need to edit either $TEX/texmf/pdftex/config/pdftex.cfg or $TEX/texmf/tex/generic/config/pdftexconfig.tex. Change pagewidth to 8.5 true in; pageheight to 11 true in.
    However, I found for some systems, manual changes don't work! In these cases, you should run texconfig (or similar configuration program in MikTeX, gwTeX) to change the default paper size. It will create a personal configuration file in your home directory.

Intel Fortran Compiler: Selinux and libifcore.so.5 conflict

Intel fortran 10.1 (not tested on other versions) has one bug:
if you compile with the option "ifort -O3 -xT -mcmodel=medium -shared-intel xxxx.f90", the executable will have a problem : "./a.out: error while loading shared libraries: /opt/intel/fce/10.1.008/lib/libifcore.so.5: cannot restore segment prot after reloc: Permission denied.

This is due to that SELinux has disabled the use of shared libraries with text relocation. The solutions are 1) to disable SELinux, 2) for the specific lib, for instance, libifcore.so.5, use "chcon -t textrel_shlib_t /opt/intel/fce/10.1.008/lib/libifcore.so.5".