Saturday, 29 January 2011

RAID Performance

CHUNK

Calculate the chunk size by using iostat

#iostat -x

Device:         rrqm/s   wrqm/s   r/s   w/s             rsec/s   wsec/s    avgrq-sz avgqu-sz   await  svctm  %util
dm-0              0.00     0.00       0.00 4548.51     0.00 36388.12    40.00   203.91       44.83   0.02  10.69
Take the average request size and times it by 512 then divide by the amount of disks in the RAID array. So if you have a raid 5 with three disks you would divide by 2 as one of the disks is for parity, for example

(40*512)/1024/2=10
So the optimum chucnk size for this would be 8K because you always round down to the nearest 2 to the power. You can create the array with this chunk witht he following commamd

#mdadm -C /dev/md1 -l5 -n3 --chunk=8/dev/sd[def] -a yes


STRIDE
The optimum stride is calculated using chunk divided by block size so for the above array it will be

8/4=2

mke2fs -j -b 4096 -E stride=2 /dev/md1

Friday, 28 January 2011

Filesystem Journaling

Journal Options

There are 3 possible settings for Journaling. They are ordered, journal and writeback

These can be set at mount time
#mount -o data=TYPE

ordered is the default and writes only the metadata

journal writes metadata and data at the same time

writeback is just metadata but there is no garuntee on commits

It is also possible to change the frequency of journal commits, the default is 5 seconds
#mount -o commit=30

Journal Placement

It is possible to put the journal on another device which can improve performance

remove the journal
#tune2fs -O ^has_journal /dev/sda1

Create the external journal
#mkfs -O journal_dev -b blocksize /dev/sdb1

Tell the FS to use the new journal
#tune2fs -j -J device=/dev/sdb1 /dev/sda1

Fragmentation

Check file fragmentation
#filefrag -v /filename

Check the state of a filesystem
#dumpe2fs /dev/sda1

Fragmentation can be avoided by having reserved space available on a filesystem
#tune2fs -m reserved-percentage

#tune2fs -m reserved-block-count

Sysstat

add alias sar='LANG=C sar' to bashrc for better sorting of date
#yum install sysstat -y

add disk stats to collecter

#vim /usr/lib/sa/sa1

        exec ${ENDIR}/sadc -d -F -L 1 1 -
else
        exec ${ENDIR}/sadc -d -F -L $* -

run 3 times to get results

#/usr/lib/sa/sa1
#/usr/lib/sa/sa1
#/usr/lib/sa/sa1

shows device names with p option
#sar -dp

Friday, 21 January 2011

SNMP

chkconfig snmpd on

Firewall port 161

semanage port -l  | grep snmp
sealert -a /var/log/audit/audit.log

/usr/share/snmp/mibs

yum install net-snmp*

snmptranslate -On -TB hrSystemUptime
.1.3.6.1.2.1.25.1.1
snmptranslate  -TB '.*memory.*'
UCD-SNMP-MIB::memory
HOST-RESOURCES-TYPES::hrDeviceNonVolatileMemory
HOST-RESOURCES-TYPES::hrDeviceVolatileMemory
HOST-RESOURCES-MIB::hrMemorySize
HOST-RESOURCES-TYPES::hrStorageFlashMemory
HOST-RESOURCES-TYPES::hrStorageVirtualMemory

snmptranslate  -On HOST-RESOURCES-MIB::hrMemorySize
.1.3.6.1.2.1.25.2.2

snmptranslate -Oq .1.3.6.1.2.1.25.2.2
HOST-RESOURCES-MIB::hrMemorySize



SNMPGET

When using Names always remember to use the index like this
[root@ex442-1 ~]# snmpget -v1 -c ex442 localhost ipForwarding.0

other wise

[root@ex442-1 ~]# snmpget -v1 -c ex442 localhost ipForwarding
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: IP-MIB::ipForwarding

SNMPD CONF

 #ro_versus_rw
rocommunity     lockeddown                   192.168.48.0/24                 .1
rocommunity     NOTSECRET     192.168.48.0/255.255.255.0      .1
rwcommunity     NOTGOOD

rocommunity  all 0.0.0.0 .1.3.6.1.2.1.1
rwcommunity  lockedDown 192.168.48.0/24
rwcommunity  admin localhost

#Custom Views defined here
group   demogroup       usm             demouser
view    demoview        included        .1

SNMP CONF

Use ~/.snmp/snmp.conf for settings per user level

defVersion (1|2c|3)
defCommunity public

create snmp v3 users

service snmp stop
net-snmp-config --create-snmpv3-user -ro -a password -x sharedsecret -X DES -A MD5 username

vim snmpd.conf

rouser rhr
rouser rh

#       groupName       secMod  secName
group   gr_limited           usm     limited
group   gr_unlimited          usm     unlimited

#       name           incl/excl     subtree
view    view_lm         included   .1.3.6.1.2.1.1
view    view_ul        included   .1

#               context secMod seclvl       prefix      read            write  notif
access gr_limited    ""      any       auth      exact       view_lm         none   none
access gr_unlimited   ""      any       auth      exact       view_ul        none    none

Sunday, 17 October 2010

Autofs Home Directories

First, as root, you have to edit the file: /etc/auto.master to include the following line:
/home   /etc/auto.home  --timeout=60

Then, create a new file called /etc/auto.home, and add the following line in it:
*          -fstype=nfs,rw,nosuid,soft     server:/home/&

Friday, 15 October 2010

Troubleshooting

restore context of all files from an rpm

rpm -ql NAME | xargs restorecon -v