when disk has problem, normally you done fsck.
when fsck generates error like ext2 not recognized, please run e2fsck -b xxxx, this one what you must do:
1. linux rescue
2. fdisk /dev/sdX
3. fsck to each partition, NOT to the disk /dev/sda NOR to the swap NOR to the sda4(extended partition - 0 length partition)
If you got error about superblock, then:
4. each partition : mkfs -n -S /dev/sdXY
5. Get the superblock backup number xxxx, xxx, xxx and run : efsck -b xxxx /de/sdXY, try till succesfully
Reminder : Do not fsck to the disk /dev/sdX, but do it to the partition instead.
Wednesday, 9 March 2011
Wednesday, 2 March 2011
Linux WWPN and adding SAN disk
To rescan an entire SCSI bus and re-register all devices found:
When dealing with fibre attached storage, it is necessary to issue a LIP (loop initialization primitive) on the fabric:
shell> echo "1" > /sys/class/fc_host/host#/issue_lip
Replace the “#” with the number of the SCSI bus to be rescanned.
Note: Issueing a LIP (above) on Red Hat Enterprise Linux 5 is all that is needed to rescan fibre attached storage. Once the LIP is issued, the bus scan may take a few seconds to complete.
To rescan all other SCSI attached storage, a rescan should be issued:
shell> echo "- - -" > /sys/class/scsi_host/host#/scan
Replace the “#” with the number of the SCSI bus to be rescanned.
In addition to re-scanning the entire bus, a specific device can be added or deleted for some versions or Red Hat Enterprise Linux as specified below.
To remove a single existing device explicitly
shell> echo 1 > /sys/block//device/delete
OR, use the rescan-scsi-bus.sh under sg3-utils.rpm
To see the WWPN:
at BIOS : CTRL-Q Fast Util
at OS : qlogic : /proc/scsi/qlxxxx
emulex : /sys/class/scsi/device/driver/...../portid
When dealing with fibre attached storage, it is necessary to issue a LIP (loop initialization primitive) on the fabric:
shell> echo "1" > /sys/class/fc_host/host#/issue_lip
Replace the “#” with the number of the SCSI bus to be rescanned.
Note: Issueing a LIP (above) on Red Hat Enterprise Linux 5 is all that is needed to rescan fibre attached storage. Once the LIP is issued, the bus scan may take a few seconds to complete.
To rescan all other SCSI attached storage, a rescan should be issued:
shell> echo "- - -" > /sys/class/scsi_host/host#/scan
Replace the “#” with the number of the SCSI bus to be rescanned.
In addition to re-scanning the entire bus, a specific device can be added or deleted for some versions or Red Hat Enterprise Linux as specified below.
To remove a single existing device explicitly
shell> echo 1 > /sys/block/
OR, use the rescan-scsi-bus.sh under sg3-utils.rpm
To see the WWPN:
at BIOS : CTRL-Q Fast Util
at OS : qlogic : /proc/scsi/qlxxxx
emulex : /sys/class/scsi/device/driver/...../portid
Tuesday, 18 January 2011
RHEL6 - Instalation, rpm, repo
After install by default you dont have x windows:
- install xorg-x11-......
- install gnome-.........
The problem is too many packages, you must use:
yum groupinstall "X window system"
yum groupinstall "Desktop"
It used to be "GNOME Desktop Environment", but now the Desktop is refered to GNOME.
If you dont know the file related to which group, just open the comps.xml or repomd.xml file as explain further below.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if you find problem group not available, check by :
yum grouplist ==> to see all available group pacakes
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if that command shows data group not available, so you must:
cp xxxxxxcompsxxxxx.xml to local repo directory.
cd to repo directory
createrepo -g xxxxxxxxcompsxxxx.xml .
yum clean all
this will build repodata folder in your local repo folder.
You copy xxxxxxcompsxxxxx.xml from the same DVD in where you copy all the rpms to your local repo folder. Or you can use the DVD of rhel5 or other version, but maybe there are discrepancies of the packages in the group install, it works though.
If the repomd is overlapped with anotehr comps.xml files, just delete the repodata folder and run the createrepo -g again.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
createrepo you must install using rpm (or yum) but since this means you have no repo yet, so either way you must install the 2 deps packages manually.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
rpm --nogpgcheck
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
how to create local repo:
1. copy all the rpms from DVD to a local folder
2. in that local folder type : createrepo .
3. edit the yum.conf in /etc/yum
put the name of your repo (whatever)
baseurl=file:///folder
enabled=1
gpgcheck=0
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
rpm -qa (checking what packages installed in your PC)
rpm -q (chcking if it is insalled or not) same as above but the output diffrent though same meaning.
rpm -qi (see info of the packages)
REMEMBER : dont use * in the packages name, use : rpm -q | grep XXXX instead.
Note : if your CWD has pacakges files also, it cant be confusing, be careful!!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- install xorg-x11-......
- install gnome-.........
The problem is too many packages, you must use:
yum groupinstall "X window system"
yum groupinstall "Desktop"
It used to be "GNOME Desktop Environment", but now the Desktop is refered to GNOME.
If you dont know the file related to which group, just open the comps.xml or repomd.xml file as explain further below.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if you find problem group not available, check by :
yum grouplist ==> to see all available group pacakes
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if that command shows data group not available, so you must:
cp xxxxxxcompsxxxxx.xml to local repo directory.
cd to repo directory
createrepo -g xxxxxxxxcompsxxxx.xml .
yum clean all
this will build repodata folder in your local repo folder.
You copy xxxxxxcompsxxxxx.xml from the same DVD in where you copy all the rpms to your local repo folder. Or you can use the DVD of rhel5 or other version, but maybe there are discrepancies of the packages in the group install, it works though.
If the repomd is overlapped with anotehr comps.xml files, just delete the repodata folder and run the createrepo -g again.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
createrepo you must install using rpm (or yum) but since this means you have no repo yet, so either way you must install the 2 deps packages manually.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
rpm --nogpgcheck
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
how to create local repo:
1. copy all the rpms from DVD to a local folder
2. in that local folder type : createrepo .
3. edit the yum.conf in /etc/yum
put the name of your repo (whatever)
baseurl=file:///folder
enabled=1
gpgcheck=0
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
rpm -qa (checking what packages installed in your PC)
rpm -q (chcking if it is insalled or not) same as above but the output diffrent though same meaning.
rpm -qi (see info of the packages)
REMEMBER : dont use * in the packages name, use : rpm -q | grep XXXX instead.
Note : if your CWD has pacakges files also, it cant be confusing, be careful!!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Thursday, 13 January 2011
VMware : ESX vs ESXi vs ESXiEmbedded
ESX has service console, service console is restricted shell of redhat OS
ESXi is not using service console, u have to use RemoteCLI to manage it, but still ESXi needs a Harddisk to store. The donwside is could be hard to troubleshoot for newbie since not using service console.
ESXiEmbedded is ESXi but stored in flashdisk instead, the downside is flash disk has no mirroring function, when it is broken, u need to install new one.
ESXi is not using service console, u have to use RemoteCLI to manage it, but still ESXi needs a Harddisk to store. The donwside is could be hard to troubleshoot for newbie since not using service console.
ESXiEmbedded is ESXi but stored in flashdisk instead, the downside is flash disk has no mirroring function, when it is broken, u need to install new one.
Thursday, 28 October 2010
Kernel code and compiling
LKM (loadable kernel module) -> alter without reboot, load/unload when needed, smaller core kernel. Example : device driver
as opposed to SK (static kernel) -> need reboot when altered
xxx.c --> xxx.ko (ko= kernel object)
.so = shared object
A. /proc/kallsyms contains all function of kernel (ex. printk) and the services using it.
===> printk is print at kernel (seen at dmesg or /var/log/messages)
===> printf is print at user mode
B. /boot/System.map.xxxxx contains all the system calls (which is a "call" to kernel space, from user space)
Symbols that are visible for Load kernel module is in:
C. /lib/modules/'uname -r'/build/Module.symvers
ABC relation:
C containing the symbol (function/call) and the memory address (address important for debugging). B containing all the symbol(along with the ID) with the services use it (ex. service : ip, ipv6,nfs). A containing the symbol/function/call(along with the ID) available, and with subs of that function.
To compile:
Make the xxx.c file (C source code)
Cretae the Makefile (enough this 1 line ==> obj-m := xxx.o )
compile it by:
make -C /usr/src/kernels/2.6.18-92.el5-i686/ modules M=$PWD
Result many files, one of them is xxx.ko
modinfo xxx.ko (To see the information which is written in the xxx.c)
insmod xxx.ko (opposed : rmmod xxx.ko or rmmod xxx)
==> must use the path/file location, and execute/install module dependency beforehand
==> modules and its alias is in /etc/modules.conf (either can be used)
==> dependency is in /lib/modules/version/modules.dep
modprobe xxx (opposed : modprobe -r xxx)
==> modprobe use insmod too, but it is aware the def location of module /lib/modules/version, and it is aware of the dep. So use this better.
lsmod (to see what is installed) ==> /proc/modules
depmod -a (to refresh the module database list) IMPORTANT!!
To make it (copy auto) to /lib/modules/.........
make -C /usr/src/kernels/2.6.18-92.el5-i686/ modules_install M=$PWD
as opposed to SK (static kernel) -> need reboot when altered
xxx.c --> xxx.ko (ko= kernel object)
.so = shared object
A. /proc/kallsyms contains all function of kernel (ex. printk) and the services using it.
===> printk is print at kernel (seen at dmesg or /var/log/messages)
===> printf is print at user mode
B. /boot/System.map.xxxxx contains all the system calls (which is a "call" to kernel space, from user space)
Symbols that are visible for Load kernel module is in:
C. /lib/modules/'uname -r'/build/Module.symvers
ABC relation:
C containing the symbol (function/call) and the memory address (address important for debugging). B containing all the symbol(along with the ID) with the services use it (ex. service : ip, ipv6,nfs). A containing the symbol/function/call(along with the ID) available, and with subs of that function.
To compile:
Make the xxx.c file (C source code)
Cretae the Makefile (enough this 1 line ==> obj-m := xxx.o )
compile it by:
make -C /usr/src/kernels/2.6.18-92.el5-i686/ modules M=$PWD
Result many files, one of them is xxx.ko
modinfo xxx.ko (To see the information which is written in the xxx.c)
insmod xxx.ko (opposed : rmmod xxx.ko or rmmod xxx)
==> must use the path/file location, and execute/install module dependency beforehand
==> modules and its alias is in /etc/modules.conf (either can be used)
==> dependency is in /lib/modules/version/modules.dep
modprobe xxx (opposed : modprobe -r xxx)
==> modprobe use insmod too, but it is aware the def location of module /lib/modules/version, and it is aware of the dep. So use this better.
lsmod (to see what is installed) ==> /proc/modules
depmod -a (to refresh the module database list) IMPORTANT!!
To make it (copy auto) to /lib/modules/.........
make -C /usr/src/kernels/2.6.18-92.el5-i686/ modules_install M=$PWD
Monday, 25 October 2010
Memory physical types
RAM vs SAM (random addresses vs serial addresses(tape) )
DRAM vs SRAM
*Dynamic(keep refreshed the voltage, up to 1000times/sec)
*Static (need not refreshed, so faster but more expensive)
Note : memory chips containing transistors (each transistor has capacitor for storing electric as represent of bit 1), the transistor function as switch, 0 or 1. Transistor has Base, C and Emitter. These 3 legs make a transistors as electronic switch.
DRAM vs SDRAM
* Synchronous : faster and more expensive (it has feature pipelines, where it can do next task without wait the prev one). The sync is about time clock, so it has cycle to do actions.
== Pipelining means that the chip can accept a new instruction before it has finished processing the previous one. In a pipelined write, the write command can be immediately followed by another instruction without waiting for the data to be written to the memory array. In a pipelined read, the requested data appears after a fixed number of clock pulses after the read instruction, cycles during which additional instructions can be sent. (This delay is called the latency and is an important parameter to consider when purchasing SDRAM for a computer.) ====
Complete on : http://en.wikipedia.org/wiki/Synchronous_dynamic_random_access_memory
DIMM vs SIMM
* dual inline memory module
DDR (dual data rate)vs SDR (single)
*
DDR2 ( is then DDR1)
DDR3 (is faster in transfer than DDR2)
x4 vs x8 (by 4 vs by 8)
DRAM vs SRAM
*Dynamic(keep refreshed the voltage, up to 1000times/sec)
*Static (need not refreshed, so faster but more expensive)
Note : memory chips containing transistors (each transistor has capacitor for storing electric as represent of bit 1), the transistor function as switch, 0 or 1. Transistor has Base, C and Emitter. These 3 legs make a transistors as electronic switch.
DRAM vs SDRAM
* Synchronous : faster and more expensive (it has feature pipelines, where it can do next task without wait the prev one). The sync is about time clock, so it has cycle to do actions.
== Pipelining means that the chip can accept a new instruction before it has finished processing the previous one. In a pipelined write, the write command can be immediately followed by another instruction without waiting for the data to be written to the memory array. In a pipelined read, the requested data appears after a fixed number of clock pulses after the read instruction, cycles during which additional instructions can be sent. (This delay is called the latency and is an important parameter to consider when purchasing SDRAM for a computer.) ====
Complete on : http://en.wikipedia.org/wiki/Synchronous_dynamic_random_access_memory
DIMM vs SIMM
* dual inline memory module
DDR (dual data rate)vs SDR (single)
*
DDR2 ( is then DDR1)
DDR3 (is faster in transfer than DDR2)
x4 vs x8 (by 4 vs by 8)
Sunday, 24 October 2010
How raid 5 works and the parity calculated
RAID 5, required 3 disks minimum. The total storage afterward is (n-1) disk capacity, and YES all disks must have same size.
How they calculate it the parity is like this:
disk1 disk2 disk3 .... diskLast
0 1 0 parity:disk1 XOR disk2 then the result is XOR to disk3
parity 0 0 1
Above example of disk stripe segment of 1 bit, in real world the normal ones is between 4bits to 256bits.
The magic is when disk1/2/3 failed, it can rebuild from the result, as following:
disk2 XOR disk3 then XOR to parity(above is in diskLast) = disk1
It is not magic though, it is only about:
if bits same then it friend (0 XOR 0 = 0 (friends) 1 XOR 1 = 0 (friends) )
if bits differs then it is enemy.
So from the friend/enemy, you can figure the other bit from the partner bit.
Here is the best explanation:
http://www.scottklarr.com/topic/23/how-raid-5-really-works/
The other thing you must know, when the drive failed, the server will use more IO and CPU, cause when read operation happening it will calculate to result the missing data ( i wanna say that everything is in place as normal, NOT like the idea where if a drive failed then the parities are all calculated and stores the missing bits to the parity bits place as replacing, it is NOT like that)
When a new drive comes, rebuild happens and same exactly as the failed one + the parity from the write operation after failed time.
How they calculate it the parity is like this:
disk1 disk2 disk3 .... diskLast
0 1 0 parity:disk1 XOR disk2 then the result is XOR to disk3
parity 0 0 1
Above example of disk stripe segment of 1 bit, in real world the normal ones is between 4bits to 256bits.
The magic is when disk1/2/3 failed, it can rebuild from the result, as following:
disk2 XOR disk3 then XOR to parity(above is in diskLast) = disk1
It is not magic though, it is only about:
if bits same then it friend (0 XOR 0 = 0 (friends) 1 XOR 1 = 0 (friends) )
if bits differs then it is enemy.
So from the friend/enemy, you can figure the other bit from the partner bit.
Here is the best explanation:
http://www.scottklarr.com/topic/23/how-raid-5-really-works/
The other thing you must know, when the drive failed, the server will use more IO and CPU, cause when read operation happening it will calculate to result the missing data ( i wanna say that everything is in place as normal, NOT like the idea where if a drive failed then the parities are all calculated and stores the missing bits to the parity bits place as replacing, it is NOT like that)
When a new drive comes, rebuild happens and same exactly as the failed one + the parity from the write operation after failed time.
Subscribe to:
Posts (Atom)