Archive for March, 2008

inode 8

Here is a little jewel I came across when attempting to repair a disk with a corrupted journal.

# e2fsck /dev/hdb1
fsck 1.38 (30-Jun-2005)
e2fsck 1.38 (30-Jun-2005)
/dev/hdb1 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inode 8 has illegal block(s). Clear<y>? yes

Illegal block #8559 (1073741824) in inode 8. CLEARED.
Illegal block #8567 (1073741824) in inode 8. CLEARED.
Illegal block #8575 (1073741824) in inode 8. CLEARED.
Illegal block #8583 (1073741824) in inode 8. CLEARED.
Illegal block #8591 (1073741824) in inode 8. CLEARED.
Illegal block #8599 (1073741824) in inode 8. CLEARED.
Illegal block #8607 (1073741824) in inode 8. CLEARED.
Illegal block #8615 (1073741824) in inode 8. CLEARED.
Illegal block #8623 (925040641) in inode 8. CLEARED.
Illegal block #8631 (1073741869) in inode 8. CLEARED.
Illegal block #8639 (1073741824) in inode 8. CLEARED.
Too many illegal blocks in inode 8.
Clear inode<y>? yes

Restarting e2fsck from the beginning…
/dev/hdb1 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
….
Continues indefinitely

# tune2fs -f -O  ^has_journal /dev/hdb1
tune2fs 1.38 (30-Jun-2005)
Illegal block number passed to ext2fs_unmark_block_bitmap #1073741824 for block bitmap for /dev/hdb1
Segmentation fault

That led to a quite a chuckle. Thankfully debugfs did not exhibit the same insanity.

# debugfs -w /dev/hdb1
debugfs: feature -has_journal

# fsck -yf /dev/hdb1
# fsck -c /dev/hdb1

# tune2fs -j /dev/hdb1

Inode 8 contains the ext3 journel, so ripping it out allowed the fsck to run.

Installing APC

APC (http://us2.php.net/apc, http://en.wikipedia.org/wiki/PHP_accelerator) is a bytecode caching mechanism for php that greatly increase the performance of php applications. APC is available from pecl and easy to install on most LAMP platforms.


pear channel-update pecl.php.net
mount -o remount,exec /tmp
pecl install apc
mount -o remount,noexec /tmp
echo "extension=apc.so" >/etc/php.d/apc.ini
echo "apc.shm_size=128" >>/etc/php.d/apc.ini

Please keep in mind, apc.ini must reside in a directory that is scanned by php. Also, RHEL3-4 users may have issues updating pear.

On RHEL3, something like this will happen:

pear upgrade pear

pear install something

-bash: pear: command not found

pear will then need to be installed manually:
lynx -source http://pear.php.net/go-pear | php -q

On RHEL4, the issue is that the url had changed to grab packages from pear.php.net. This can be resolved by upgrading to the latest version of pear using the full URL:

pear upgrade http://pear.php.net/get/pear http://pear.php.net/get/dependency

TCP: drop open request from xxx.xxx.xxx.xxx

massive syn-floods can cause this. I have learned some tricks that can help mitigate these attacks.

echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout
echo 1800 > /proc/sys/net/ipv4/tcp_keepalive_time
echo 1 > /proc/sys/net/ipv4/tcp_window_scaling
echo 0 > /proc/sys/net/ipv4/tcp_timestamps
echo 0 > /proc/sys/net/ipv4/tcp_sack
echo 1280 > /proc/sys/net/ipv4/tcp_max_syn_backlog
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
echo 1 > /proc/sys/net/ipv4/conf/all/log_martians
echo 65535 > /proc/sys/net/ipv4/ip_conntrack_max

Useful mysql queries for plesk

Plesk FTP passwords

use psa;
SELECT
domains.displayName,
sys_users.login,
accounts.password
FROM
hosting,
domains,
sys_users,
accounts
WHERE
hosting.dom_id = domains.id
AND
hosting.sys_user_id = sys_users.id
AND
sys_users.account_id = accounts.id
ORDER BY
domains.displayName
;


#get plesk email user's username, pw, and redirect.
use psa; select domains.displayname,mail.mail_name,accounts.password,mail.redir_addr from domains,mail,accounts where domains.id=mail.dom_id and accounts.id=mail.account_id;


Catchalls:


select d.name as
domain, p.value as catchall_address from Parameters p,
DomainServices ds, domains d where d.id = ds.dom_id and
ds.parameters_id = p.id and p.parameter = 'catch_addr' order by d.name


select count(distinct(domains.name)) from domains,DomainServices,Parameters where domains.id=DomainServices.dom_id and DomainServices.parameters_id=Parameters.id and Parameters.value<>"reject";

Updating webmin passwords

Webmin provides a perl script for this, keep in mind, the path may vary:


/usr/libexec/webmin/changepass.pl /etc/webmin <user> <password>

WordPress install

Well, I have installed wordpress for grins at 7am on my work provided server. It seems slow so I installed apc to speed some things up. I am working on gentoo, as I have never used gentoo as a LAMP platform, somethings are taking some getting used to. For instance:

112364-www1 APC-3.0.17 # make install
Installing shared extensions: /usr/lib/php5/lib/php/extensions/no-debug-non-zts-20060613/

Now that is an odd place for my extensions, regardless, hopefully apc will speed things up a bit.

Return top