Ziemowit C. Pierzycki

13Apr/100

EXT4 and XFS on RAID

Tuning the file systems should be done from the beginning.  Especially when dealing with RAID devices.  Remember what your RAID stripe size is.  Then do the following:

For EXT4 you need to calculate the stride size based on your planned file system block size and RAID stripe size.  Use the following formula:

stride size = stripe size / block size

Most of the time the block size is 4K or 4096 bytes.  For example, my RAID stripe size is 128K or 131072.  So my formula looks like:

128 / 4 = 32

Now, format the device with the following:

mkfs.ext4 -b 4096 -E stride = 32 /dev/sdb

For XFS it's a little more complicated.  You need to calculate SUNIT and SWIDTH.  The formulas are as follows:

sunit = stripe size / 512
swidth = sunit * number of drives that stripe

Again, since my stripe size is 128K, or 131072, my configuration it would be:

131072 / 512 = 256
256 * 2 = 512

And the command would look like so:

mkfs.xfs su=512 sunit=256 swidth=512

13Apr/100

FakeRAID and DMraid on Linux

A lot of people are still using mdadm and such to create Linux-based RAID.  I kind of like fake RAID.  It works pretty well.  You can even set it up on a non-fake RAID server:

Lets say you have four SATA drives and you want to create fake-RAID 0+1 from it.  Execute the following:

dmraid -f nvidia -C Raid0 --type 01 --stripe 128B --disk "/dev/sda /dev/sdb /dev/sdc /dev/sdd"

This will write NVIDIA fake RAID metadata to the beginning of each drive.  When the Linux server boots up and detects the metadata it will automatically threat the drives as part of the raid called "Raid0".  No need to mess around with mdadm or Linux software RAID.

Filed under: Uncategorized No Comments
9Apr/101

Linux and MTU 9000 (Jumbo Packets)

Jumbo Packets are bread and butter of network  block protocols like iSCSI and NFS.  When setting up MTU of 9000 you may need to increase the following kernel parameter:

vm.min_free_kbytes

My Fedora 12 was set to 7044.  When turned on Jumbo Packets:

ifconfig eth0 mtu 9000

I would get a lot of memory allocation errors.  So to keep that from happening I quadrupled the kernel parameter to:

vm.min_free_kbytes = 28176

Remember to save both settings:

echo "MTU=9000" >> /etc/sysconfig/network-scripts/ifcfg-eth0

and:

echo "vm.min_free_kbytes = 28176" >> /etc/sysctl.conf

Done.  No more memory allocation errors.

8Apr/100

CentOS 5 and OpenQRM

OpenQRM is a pretty neat datacenter management tool.  You can use it to provision and manage servers.

Seems like the installation of OpenQRM is kind of confusing.  I added few Yum repositories that helped me so here  is how I installed it on my CentOS 5 server:

1. Install OpenQRM repo.  This is where OpenQRM packages will be coming from:

cat <<EOF > /etc/yum.repo.d/openqrm.repo
[openqrm]
name = Red Hat Enterprise $releasever - openQRM
baseurl = http://packages.linuxfellaz.net/centos5
enabled = 1
protect = 0
gpgcheck=0
EOF

This bit was taken from the following website:

http://www.openqrm.com/?q=node/101

2. DAG repo contains certain packages such as Nagios.  According to:

http://dag.wieers.com/rpm/FAQ.php#B

This is how you should install the repo:

rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

3.  OpenQRM will require Zabbex.  The only place I found that has Zabbex RPMs is here:

http://fedoraproject.org/wiki/EPEL/FAQ#howtouse

And you can install the repo by:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

4.  OpenQRM will require ASH to be installed.  Unfortunetly this package no longer comes with CentOS 5.  You'll have to steal it from CentOS 4 package repository:

http://mirror.nexcess.net/CentOS/4/os/x86_64/CentOS/RPMS/

Or simply:

rpm -Uvh http://mirror.nexcess.net/CentOS/4/os/x86_64/CentOS/RPMS/ash-0.3.8-20.el4_7.1.x86_64.rpm

5.  Now you need to execute the following:

yum install openqrm-server

It will install all the required dependencies and execute the configuration script.

6.  Login to the server by visiting the following:

https://<ip address>/openqrm/

The username you'll need to login is "openqrm" and password is also "openqrm".  Enjoy.

28Mar/100

SMTP server and Google Apps

Sure, it works for most part but you need to be aware of the following fact:

Google Apps (aka GMAIL) overwrites the mail headers!  Especially the "FROM" header so you can't fake it.  It replaces the "FROM" header with your own email address that's attached to your login information.

So, you're better off setting up your own SMTP server.  Since you own a domain name and should have access to DNS records.  I called my Internet Service Provider (ISP) to get port 25 unblocked and went ahead to setup my own outbound SMTP server.  You need port 25.  Port 587 is used for email submission... as in submitting email from a client.  Port 25 is still used for for email exchange between servers.

I use Fedora.  These steps should work for Redhat and CentOS also.

1. Install Postfix:

yum install postfix

2.  Then remove sendmail:

yum remove sendmail

3.  Edit /etc/postfix/main.cf configuration file:

myhostname = server.domain.name
mydomain = domain.name
myorgin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost
relay_domains = $mydestination
sender_canonical_maps = hash:/etc/postfix/sender_canonical
recipient_canonical_maps = hash:/etc/postfix/recipient_canonical

Those are the ones you have to add or change.

4. Create /etc/postfix/sender_canonical and /etc/postfix/sender_canonical:

touch /etc/postfix/sender_canonical
postmap /etc/postfix/sender_canonical
touch /etc/postfix/sender_canonical
postmap/etc/postfix/sender_canonical

I use them for re-writing local usernames to email addresses.  Here is my /etc/postfix/sender_canonical:

root                            webmaster@domain.name

5.  You need to update your SPF record in DNS.  It's as simple as adding a TXT record to your domain name.  You should have something like this already:

domain.name.          43200   IN      MX      10 alt1.aspmx.l.google.com.
domain.name.          43200   IN      MX      15 alt2.aspmx.l.google.com.
domain.name.          43200   IN      MX      5 aspmx.l.google.com.

Now you need this:

domain.name.          3503    IN      TXT     "v=spf1 ip4:111.111.111.111 include:_spf.google.com ~all"

You need to create something like that except 111.111.111.111 would internet visible IP address of your server.  So this would be the IP address the internet email server would see when your server is connecting to them.  If your server is behind a firewall then this might be your firewall's IP address.

SPF is used by SPAM filters to allow emails from your domain.  Here if official Google Apps explanation how to use it:

http://www.google.com/support/a/bin/answer.py?hl=en&answer=33786

28Mar/100

Pierzycki Family Tree

Once upon a time I was on vacation in Poland visiting family.  My aunt got on a subject of a family tree that she had compiled.  I thought "cool".  Maybe I can post it on the internet so all Pierzycki family members can see.

I asked for a copy of it and she told me all I have to do is ask my father because he has a copy of it already.  Great.  Leave it to my father to keep me informed about things like this.

So when I came home I created an application in PHP that draws <TABLE> based family tree with information out of MySQL.   Eventually people started asking for a copy it of it in .GED format.  So I re-wrote the application to draw <TABLE> based family tree with information out of a GEDCOM file.

Here is the result!