Wednesday, October 18, 2006

what is superblock and how to recover it

Hello EB,

The scope of this article not covers about the basic things about file system, but its about troubleshooting of currupt file system.
So, when you create file system on hard drive it will sub devided into multiple file system blocks.
Blocks are used for -
1. To store user data
2. Some blocks used for to store file system's metadata.
(Metadata is kind of structure of your file system and it contents superblock, indoes and directories)

Superblock - Each of your filesystem has a superblock. File system like ext2. ext3 etc. Superblock contents the information about file system like -
* File system type
* Size
* Status
* Information about other metadata

Now you will guess that how important is superblock for your filesystem, if that is that currupt then you may not able to use that partition or may you will error while tring to mount that filesystem.
Following are some errors when superblock get currupts or some bad sectors
- You cant able to mount the filesystem, it will refuse to mount
- Filesystem gets hang
- Sometimes though you are able to mount that filesystem, but strange behavior occures.

These kind of errors occures because of bunch reasons. Most of the time fsck works fine for these errors -
$e2fsck -f /dev/hda3

(-f option for forcefully checking even filesystem seems clean)

Now fsck doesnt work because of lost of superblock, what you will do??
Note that Linux maintains multiple redundant copies of the superblock in every filesystem. You can find out this information with this following command -
$dumpe2fs /dev/hda6 grep -i superblock
dumpe2fs 1.32 (09-Nov-2002)
Primary superblock at 1, Group descriptors at 2-2
Backup superblock at 8193, Group descriptors at 8194-8194
Backup superblock at 24577, Group descriptors at 24578-24578
Backup superblock at 40961, Group descriptors at 40962-40962
Backup superblock at 57345, Group descriptors at 57346-57346
Backup superblock at 73729, Group descriptors at 73730-73730

To repair file system by alternative superblock
$e2fsck -f -b 8193 /dev/hda6

(Take backup using dd before doing running commands)

If you are using Sun Solaris, as My experience frequent power failure can get you hell :-( . I am using old sparc and one time in month I have run fsck using commands as per my last blog. So if your Sun Solaris lost the superblock then boot from cdrom or network, to retrive information about your filesystem's superblock give following command -
$newfs -N /dev/rdsk/devicename

Now use alternative superblock
$fsck -F ufs -o b=block-number /dev/rdsk/devicename

okie guys, hope this information helps somebody.

Tuesday, October 17, 2006

smb partition mounting using mount command

Hello EB,

Here is the useful commands when you want to browse the smb shared files using user name, password and even you can specify specific domain -

smbclient -W domain -L smbhost(IP) -U vishalh
mount -t smbfs -o username=amolk,password,workgroup=domain //smbhost(IP)/share /mnt

Wednesday, October 04, 2006

Sun Solaris - Solution for fsck error at boot time

Hello EB,

Most of time we get some problems with Sun solaris machines at boot time, generally it because of bad sectors or damaged file system. Machine go into File system repair option, so deal with these kind of problems use following commands -

fsck -F (ufs/vxfs) /dev/rdsk/(partition)

noninteractive :fsck tries to repair all the problems it finds in a file system without stopping for user response useful in case of a large number of inconsistencies in a file system but has the disadvantage of removing some useful files which are detected to be corrupt .
If file system is found to have problem at the booting time non interactive fsck fsck is run and all errors which are considered safe to correct are corrected. But if still file system has problems the system boots in single user mode asking for user to manually run the fsck to correct the problems in file system

fsck -F (ufs/vxfs) -Y /dev/rdsk/(partition)

Please use this option at your own risk because it will consider "yes" option for every qwestion so your filesystem might get modified.
Some fsck options as follows -

fsck [ -F fstype] [-V] [-yY] [-o options] special
-F fstype type of file system to be repaired ( ufs , vxfs etc)
-V verify the command line syntax but do not run the command
-y or -Y Run the command in non interactive mode - repair all errors encountered without waiting for user response.
-o options Three options can be specified with -o flag
b=n where n is the number of next super block if primary super block is corrupted in a file system .
p option used to make safe repair options during the booting process.
f force the file system check regardless of its clean flag.
special - Block or character device name of the file system to be checked/repaired - for example /dev/rdsk/c0t3d0s4 .Character device should be used for consistencies check & repair
phases:
fsck checks the file system in a series of 5 pages and checks a specific functionality of file system in each phase.
** phase 1 - Check Blocks and Sizes
** phase 2 - Check Pathnames
** phase 3 - Check Connectivity
** phase 4 - Check Reference Counts
** phase 5 - Check Cylinder Groups

Wednesday, September 06, 2006

Benchmark chart of Linux v/s Windows


Hello EB,

I have both Linux and windows while running webserver. In this senario, the overall size of one million files was about twice as large as the 2 GB of main memory. The total number of requests in test runs for which a reboot had previously cleared the buffer cache was clearly below 500,000. Files would generally have to be loaded from hard disk before being sent through the net.
In this setup, the freeware system clearly shows better results: While NT can hardly manage more than 30 requests per second, Linux can handle more than 166. With 512 client processes, it even manages 274 pages per second. Since more than 400,000 pages are retrieved during this test, however, we cannot be entirely sure that the increase especially towards the end of the graph isn't down to a caching effect. But who would complain about an overly efficient buffer cache?
When calling CGI scripts, Windows NT is no match for Linux. As the load is not confined to kernel mode in this case, Linux can benefit from additional CPUs. The graph at the bottom nicely depicts the linear increase for a CGI script with integrated delay.

Wednesday, August 30, 2006

Remote installation of RHES4 64bit

Remote installation of RHES4.2 64bit -

If that server is already having redhat version installed –

1. Copy kernel and initrd image in /boot directory (In my senario I already made RHES4u2.tar.gz gz file using /remoteinstall/Redhat4update2/images/pxeboot/* on my file server , you can use 1st CD of RHES4update2 top copy the kernel and initrd image)
172.30.0.62 - This is my file server

scp username@173.30.0.62:/remoteinstall/Redhat/RHES4u2.tar.gz
tar -xvzf RHES4.u2.tar.gz
cp pxeboot/* /boot/

2. Edit the /etc/grub.conf file. Go onto next line of splash image.
title rhes4
root (hd0,0)
kernel /vmlinuz vnc vncconnect=172.30.0.3 headless ip=172.30.0.127 netmask=255.255.255.0 gateway=172.30.0.1 dns=172.30.0.41 ks=http://172.30.0.131/ks4.cfg
initrd /initrd.img

Save the file and reboot the machine.

3. Now start you vncviewer into listen mode.
(Make following changes
1.Replace 172.30.0.3 ip with your desktop’s ip
2. Replace 172.30.0.127 with to the IP of the machine which you are installing.)

My kick start configuration file looks like this -
# Kickstart file automatically generated by anaconda.

install
nfs --server=172.30.0.62 --dir=/big2/Redhat/RHES4.u2_64
lang en_US.UTF-8
langsupport --default=en_US.UTF-8 en_US.UTF-8
keyboard us
rootpw --iscrypted $1$1zTBqKn5$lnZ052YwM6uILBON/khw0.
firewall --disabled
selinux --enforcing
authconfig --enableshadow --enablemd5
timezone --utc Asia/Calcutta
bootloader --location=mbr --append="rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all
part /boot --fstype ext3 --size=100
part /usr --fstype ext3 --size=15000
part / --fstype ext3 --size=5000
part /opt --fstype ext3 --size=2000
part /var --fstype ext3 --size=2000
part /tmp --fstype ext3 --size=2000
part swap --size=2000

%packages
@ compat-arch-development
@ admin-tools
@ system-tools
@ dialup
@ compat-arch-support
@ legacy-software-development
@ base-x
@ development-tools
e2fsprogs
kernel-devel
kernel

%post

Hope this will help somebody :)

Thursday, August 24, 2006

rpm options

Hello EB,

rpm is a powerful Package Manager, which can be used to build, install, query, verify, update, and erase individual software packages. A package consists of an archive of files and meta-data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package. Packages come in two varieties: binary packages, used to encapsulate software to be installed, and source packages, containing the source code and recipe necessary to produce binary packages.

Now most of famous distribution used rpm packages like redhat, suse and even lot free distributions like white box.

Following are some but basic option for rpm command -

rpm {-i--install} [install-options] PACKAGE_FILE ...
rpm {-U--upgrade} [install-options] PACKAGE_FILE ...

  • Sometimes you want to know which library uses which rpm packages or vice versa one rpm packages installs which libraries

#rpm -qf /usr/lib/libstdc++-2-libc6.1-1-2.9.0.so
compat-libstdc++-7.3-2.96.128

#rpm -ql compat-libstdc++-296-2.96-132.7.2
/usr/lib/libstdc++-2-libc6.1-1-2.9.0.so
/usr/lib/libstdc++-3-libc6.2-2-2.10.0.so
/usr/lib/libstdc++-libc6.2-2.so.3

  • Most of time you want to uninstall some rpm packages and you use rpm -e but it says there multiple packages are exist use

rpm -e --allmatches {rpm name}

Let me know if you have any queries with rpm commands,

hope these information will help you.

Thanks

Tuesday, July 18, 2006

Free E-Books To Download

Hello Guys,

Check out this kool link for free e-books to download till 4th August 2006.
So hurry...

http://worldebookfair.com/Technical_eBook_Colleciton.htm

Cheers,