2009年9月10日 星期四

install java on linux

chmod +x jdk-6u16-linux-x64-rpm.bin

su -c ./jdk-6u16-linux-x64-rpm.bin

2009年1月13日 星期二

software raid in linux

create raid:
 mdadm --create --verbose  /dev/md0 --level=0 --raid-device=2 /dev/sda1 /dev/sdb1

stop raid:
mdadm --manage --stop /dev/md0

2009年1月12日 星期一

inode

An inode is a data structure on a traditional Unix-style file system such as UFS or ext3. An inode stores basic information about a regular file, directory, or other file system object.

see inode number of a file:
ex: ls  -i  test3.c
715775 test3.c

see info about the file
ex: stat  test3.c
File: `test3.c'
Size: 451       Blocks: 8          IO Block: 4096   regular file
Device: 303h/771d Inode: 715775      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2009-01-06 22:11:55.000000000 +0800
Modify: 2008-12-22 17:43:56.000000000 +0800
Change: 2008-12-22 17:43:56.000000000 +0800

e2fsck

check file system
ex:
e2fsck  -f  /dev/sda2

dumpe2fs

dump ext2/ext3 filesystem information

ex:  
dumpe2fs  /dev/hda1

mpe2fs 1.38 (30-Jun-2005)
Filesystem volume name:   /
Last mounted on:          
Filesystem UUID:          1004b524-1c21-4829-bb94-0b5dada664c8
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype sparse_super large_file
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              2560864
Block count:              2560351
Reserved block count:     128017
Free blocks:              1215812
Free inodes:              2431393
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      625
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         32416
Inode blocks per group:   1013
Filesystem created:       Tue Aug  5 18:03:45 2008
Last mount time:          Thu Jan  1 05:36:59 2009
Last write time:          Thu Jan  1 09:26:35 2009
Mount count:              95
Maximum mount count:      -1
Last checked:             Tue Aug  5 18:03:45 2008
Check interval:           0 ()
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:  128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      2b724a84-72d7-4a1e-a4fb-e9d5d09e4581
Journal backup:           inode blocks


Group 0: (Blocks 0-32767)
  Primary superblock at 0, Group descriptors at 1-1
  Reserved GDT blocks at 2-626
  Block bitmap at 627 (+627), Inode bitmap at 628 (+628)
  Inode table at 629-1641 (+629)
  0 free blocks, 32405 free inodes, 2 directories
  Free blocks: 
  Free inodes: 12-32416
Group 1: (Blocks 32768-65535)
  Backup superblock at 32768, Group descriptors at 32769-32769
  Reserved GDT blocks at 32770-33394
  Block bitmap at 33395 (+627), Inode bitmap at 33396 (+628)
  Inode table at 33397-34409 (+629)
  29415 free blocks, 32416 free inodes, 0 directories
  Free blocks: 36121-65535
  Free inodes: 32417-64832
Group 2: (Blocks 65536-98303)
  Block bitmap at 65536 (+0), Inode bitmap at 65537 (+1)
  Inode table at 65538-66550 (+2)
  31746 free blocks, 32414 free inodes, 1 directories
  Free blocks: 66552-88063, 88069-96255, 96257-98303
  Free inodes: 64834, 64836-97248
Group 3: (Blocks 98304-131071)
  Backup superblock at 98304, Group descriptors at 98305-98305
  Reserved GDT blocks at 98306-98930
  Block bitmap at 98931 (+627), Inode bitmap at 98932 (+628)
  Inode table at 98933-99945 (+629)
  30813 free blocks, 32396 free inodes, 0 directories
  Free blocks: 99946-114687, 114689-122879, 123192-131071
  Free inodes: 97268, 97270-129664
Group 4: (Blocks 131072-163839)
  Block bitmap at 131072 (+0), Inode bitmap at 131073 (+1)
  Inode table at 131074-132086 (+2)
  31734 free blocks, 32416 free inodes, 0 directories
  Free blocks: 132088-151440, 151459-163839
  Free inodes: 129665-162080
Group 5: (Blocks 163840-196607)
  Backup superblock at 163840, Group descriptors at 163841-163841
  Reserved GDT blocks at 163842-164466
  Block bitmap at 164467 (+627), Inode bitmap at 164468 (+628)
  Inode table at 164469-165481 (+629)
  13148 free blocks, 30388 free inodes, 212 directories
  Free blocks: 165518-165522, 165524-165531, 165533-165535, 165537-165538, 165541-165546, 165548-165554, 165558-165562, 165573, 165576-165818, 165820-165887, 165891-167936, 167938, 167940-168618, 168807-168922, 169101-169226, 169381-169403, 169638-169760, 170300, 170390-170416, 170611-170692, 170695-170790, 170993-171100, 171288-171541, 171640-171760, 172077-172296, 172387-172655, 172733-174079, 174081-174083, 174085-176127, 176129, 176133-176135, 176150-176580, 176718-176829, 177002-177018, 177053-177117, 177286-177411, 177677-177699, 177748-177781, 177847-177969, 178312, 178467-178591, 178786-178863, 178996-179026, 179633-179735, 179834-179880, 179910-180006, 180224, 180531-180579, 180670-180752, 180773-180969, 180976-180997, 181028-181096, 181172-181280, 181518-181865, 182000-182061, 182216-182271, 182283, 184320, 184322, 186381, 189062, 189065, 189071-189098, 189311-189648, 189799-190039, 190297-190463, 190471, 190476-190639, 190705-190751, 190849-190909, 190920-191024, 191035-191661, 191672-191953, 191974-192124, 192183-192457, 193135, 193138-193154, 193533-193604, 193714-193800, 194381-194390, 194408-194427, 196328, 196459
  Free inodes: 164072, 164077, 164111-194496

2008年12月22日 星期一

strace

trace system call and signals

linux multipath

load driver:
1. chkconfig boot.multipath on
2.chkconfig multipathd on
3. /etc/init.d/boot.multipath start
4. /etc/init.d/multipathd start

query multipath status:
multipath -l

stop multipath service:
1. /etc/init.d/boot.multipath stop
2. /etc/init.d/multipathd stop

/etc/scsi_id.config:
the info related to multipath

how to decide multipath:
the sds with the same uuid are combined into a dm
scsi_id -g -s /block/sda can get uuid

for red hat:
default multipath is not triggered
modify /etc/multipath.conf :
comment blacklist
remove dm:
multipath -F
multipath stop