Saturday, November 13, 2010

How to convert from ext3 to ext2 file system?

■ Requirement : How to convert from ext3 to ext2 file system
■ OS Environment : Linux[RHEL, Centos]
■ Application: tune3fs
■ Assumption : FS is on /dev/hda and mounted on /home
■ Implementation Steps : 

1. Unmount file-system : 

$umount /dev/hda1

2. Now change the file system type to ext2 by typing the following command :

$ tune2fs -O ^has_journal /dev/hda1

3. Verify that there are no error:

$e2fsck -y /dev/hda1

4. Mount the file system to original mount point (for example /home or /mnt):

$ mount -t ext2 /dev/hda1 /home

5. Go to mount point and remove .journal file

$ rm -f .journal

How to convert ext2 to ext3 file system?

■ Requirement : How to convert ext2 to ext3 file system
■ OS Environment : Linux[RHEL, Centos]
■ Application: tune2fs
■ Implementation Steps : 

       The ext2 or second extended filesystem is a file system for the Linux kernel, and the ext3 is a journaled file system. The ext3’s main advantage over ext2 is journaling which improves reliability and eliminates the need to check the file system after an unclean shutdown. Journaling process file system log convert file system during disk, if any problem arise it will be reconstructed it will be done by tune2fs tune to ext3 file system,While the power failure occur, Journalism File system restore pre-crash data store on the disk. It will also restore unsaved data.

1. unmount hda1 and tune it by journel like :

2.  Enable journalling : 

$ tune2fs -c 0 -i 30 -j /dev/hda1

3. then mount it.

NOTE :
c : number of mounts after which the filesystem will be checked by e2fsck. If it's is 0 or -1, the number of times the filesystem is mounted will be disregarded by e2fsck and the kernel
i : Adjust the maximal time between two filesystem checks. Use it with c option.


Wednesday, November 10, 2010

How to enable swap space on xen VPS?

■ Requirement : Enable swap space on xen VPS
■ OS Environment : Linux[RHEL, Centos]
■ Application:mkswap
■ Implementation Steps : 

$ dd if=/dev/zero of=/swap bs=1024 count=1048576
$ mkswap /swap
$ chmod 0600 /swap

Edit /etc/fstab & put following entry :

/swap swap swap defaults,noatime 0 0

$swapon -a
$ free -m

Tuesday, November 9, 2010

Why I did encounter error " ftp: connect: Connection refused" ?

■  Error  : "ftp: connect: Connection refused"
■ OS Environment : Linux[RHEL, Centos]
■ Application: pure-ftpd, iptables
■ Resolution : 

    If you get this type of error message, please check the server's firewall first. I have faced this error message during connecting to the FTP server. In my case, passive ports ranges were not enabled in the FTP and iptables firewall.

PassivePortRange 30000 50000

Add the above line in the ftp configuration file,

Enable them in the iptables like :

iptables -A INPUT -p tcp --destination-port 30000:50000 -j ACCEPT
iptables -A OUTPUT -p tcp --source-port 30000:50000 -j ACCEPT

Execute following commands 

$service iptables save
$ service iptables restart
$ /etc/init.d/pure-ftpd restart

       Another important point is that you may connect to the server through "active mode [server will connect to the client]" through the FTP client(like filezilla). Just enable the option a the FTP client and retry to connect.

Monday, November 8, 2010

How to stop core file generation in the server from php?

■ Requirement : stop core file generation in the server from php
■ OS Environment : Linux[RHEL, Centos]
■ Application: ulimit
■ Implementation Steps : 

          A core file records memory image of running process.when a php process is killed, apache creates core files under your account.These core files take too much of space on server.There is no harm on deleting these files.You can get rid off these core files by modifying the httpd start up file.

Edit /usr/sbin/httpd and make ulimit like below :

ulimit -c 0 



eth0 errors +WARNINGS packets is + outside range

■ Error : eth0 error "WARNINGS: packets is outside range"
■ OS Environment : Linux[RHEL, Centos]
■ Application: ethtool
■ Symptom  :

  Following messages had been received from munin monitoring service :

eth0 errors
WARNINGs: packets is 1.52 (outside range [:1]).

■  Investigation : 
            My basic concept is, either eth0 is being overloaded or isn't compatible with kernel or OS. So, I checked the settings of the eth0 and RX(receive) and TX(transmit) packet errors and I found that there is error at RX. It looks like below :

$ethtool eth0
[...]
RX packets:162432463 errors:3770202 dropped:0 overruns:0
frame:3770202
TX packets:258975594 errors:0 dropped:0 overruns:0 carrier:0
[....]

You can use other commands to check the continuous traffic statistics of the card like :

$ watch -n 1 cat /proc/net/dev
$ sar -n DEV|more
$ netstat -plan --interfaces=eth0

I contacted the owner of the server and he assured me that the maximum speed of the NIC is 1GB/sec.

■ Resolution :

Increased speed to 1 Gbs. 

$ethtool -s eth0 speed 1000 duplex full

Sunday, November 7, 2010

How to access the webalizer from the outside of the cpanel?

■ Requirement : How to access the webalizer from the outside of the cpanel
■ OS Environment : Linux[RHEL, Centos]
■ Application:cpanel
■ Assumption : domain is domain.com
■ Implementation Steps : 

$ /scripts/whoowns domain.com
domain
$  cd ~domain
$ cd public_html/
$ pwd
/home/domian/public_html
$ ln -s /home/domian/tmp/webalizer stats
$ chown domain. stats
$ chmod 755 ~domain/tmp -R

Now access http://domain.com/stats