Friday, February 23, 2007
Linux force file system check

In Linux, you can not run fsck in the normal runlevel or with the file system in use.
You need to do that in single user mode by running "init 1"
or use the trick mentioned as following:


     The -f flag means 'reboot fast'. This only creates an advisory file /fastboot which can 
be tested by the system when it comes up again. The boot rc file can test if this file
is present, and decide not to run fsck(1) since the system has been shut down in the
proper way. After that, the boot process should remove /fastboot.

The -F flag means 'force fsck'. This only creates an advisory file /forcefsck which
can be tested by the system when it comes up again. The boot rc file can test if this
file is present, and decide to run fsck(1) with a special 'force' flag so that even
properly unmounted file systems get checked. After that, the boot process should
remove /forcefsck.
Pop (Pu Liu)

Thursday, February 15, 2007
Linux resources and boot disk

IBM Linux portal


This howto uses isolinux to boot the cd, not like other boot CD's, which use "El Torito". Booting a CD via "El Torito" uses a disk image similar like a floppy image, which will take care of loading and configuring the system and the rest of the CD.
Booting a CD with isolinux is pretty straight forward. Isolinux will load the kernel and the initial ram disk (initrd) - the ramdisk (with linuxrc) will take care of mounting the CDROM and doing further initialization.

The scripts:

  • will check if all needed binaries and libraries are available on your base system. If something critical is missing, i.e. a library, replace the name of the library with the new name (most likely only the version number will have changed). Don't forget to update the symlink name aswell (if it has changed at all).
  • will create the directory structure, copy binaries, libraries and configuration files.
  • will create the initial ramdisk (initrd), the root filesystem (rootfs) and the ISO CDROM image itself.

Say you want to use Linux in a dual-boot arrangement, but you don't have any free space on your computer's hard drive. One solution would be to use a "live" Linux distribution such as Knoppix, which can be run directly from CD. This is certainly viable for occasional use, but it has a number of serious drawbacks:

Creating the root filesystem involves selecting files necessary for the system to run. In this section we describe how to build a compressed root filesystem. A less common option is to build an uncompressed filesystem on a diskette that is directly mounted as root; this alternative is described in Section 9.1.

The initial RAM disk was originally created to support bridging the kernel to the ultimate root file system through a transient root file system. The initrd is also useful as a non-persistent root file system mounted in a RAM disk for embedded Linux systems.

Linux boot up


Play with initrd

Unpacking an initrd

#prepare work directory
cd ~/temp

#Grap initrd
cp /media/cdrecorder/initrd.gz .

#unzip the file
gunzip initrd.gz

#you will get a new file named initrd

#create a directory as mount point
mkdir initrd.dir

#before mount it, change to super user

#mount it
mount initrd initrd.dir -o loop

#access it
cd initrd.dir

Packing an initrd (~/src/initrd/*)

#prepare work directory
cd ~/temp

#Create a file with 14M (14000*1k)
dd if=/dev/zero of=initrd bs=1k count=14000

#create a loop device from this file
losetup /dev/loop1 initrd

#create ext2 file system on this device
mkfs -t ext2 -m 0 /dev/loop1

#mount this file system under /mnt
mount /dev/loop1 /mnt

#copy file content from source to /mnt
cd ~/src/initrd/
#use tar to copy in order to keep symbolic links, file group, and permission)
tar cf - . | (cd /mnt; tar xf - )

#clean up
umount /mnt
losetup -d /dev/loop1

#the initrd is ready, zip it
cd ~/temp
gzip -f initrd

Pop (Pu Liu)

Linux: Copy Files

cp -r or cp -a might not be appropriate in some cases.
1. NFS (might be a partial copy)
2. symbolic links (will copy the actual content)
3. file group and permission (will lose)

An alternative could be using tar (from

(cd /source/directory && tar cf − . ) | (cd /dest/directory && tar xpvf −)

# Move entire file tree from one directory to another
# [courtesy Alan Cox <>, with a minor change]
# 1) cd /source/directory
# Source directory, where the files to be moved are.
# 2) &&
# "And−list": if the 'cd' operation successful,
# then execute the next command.
# 3) tar cf − .
# The 'c' option 'tar' archiving command creates a new archive,
# the 'f' (file) option, followed by '−' designates the target file
# as stdout, and do it in current directory tree ('.').
# 4) |
# Piped to ...
# 5) ( ... )
# a subshell
# 6) cd /dest/directory
# Change to the destination directory.
# 7) &&
# "And−list", as above
# 8) tar xpvf −
# Unarchive ('x'), preserve ownership and file permissions ('p'),
# and send verbose messages to stdout ('v'),
# reading data from stdin ('f' followed by '−').
# Note that 'x' is a command, and 'p', 'v', 'f' are options.
# Whew!

You can also use a tar pipe to copy across the network:

(cd /source/directory && tar cf − . ) | ( ssh server 'cd /dest/directory && tar xpvf −' )

Pop (Pu Liu)

Monday, February 05, 2007
enable existing applications for Grid
Quoted from

Let's summarize the six strategies:

Strategy 1Batch AnywhereThe application can run as a single job on any of many computers in a grid.
Strategy 2Independent Concurrent BatchMultiple independent instances of the application can be running concurrently.
Strategy 3Parallel BatchThe work of a batch program is subdivided so that multiple independent program instances can each work on part of the job in parallel.
Strategy 4ServiceA program becomes a service subroutine callable by a client through some grid middleware.
Strategy 5Parallel ServiceA program becomes multiple instances of a service subroutine callable in parallel by a client through some grid middleware.
Strategy 6Tightly Coupled Parallel ProgramsThese specialized programs require, and are designed from the start for, intense tightly coupled parallel processing.

Pop (Pu Liu)

Powered by Blogger