Centos

From KeegansWiki
Revision as of 13:15, 18 February 2014 by Keegan (talk | contribs) (→‎General)
Jump to navigation Jump to search

bugs

NFS mount permission denied

Error:

[root@traderdirect ~]# mount 10.93.138.18:/nfs-shares /mounts/tdstorage/
mount: 10.93.138.18:/nfs-shares failed, reason given by server: Permission denied

Solution: /bin/mount -t nfsd nfsd /proc/fs/nfsd See: this bug report

df and du do not match

When a disk is full but nothing shows up as taking up a lot of space (according to du) then it's possible files were deleted before they were closed.

To determine if this is the case, run this command: lsof 2>/dev/null | grep deleted then restart the offending process.

NFS filesystems won't mount

[root@dds-gaprodweb04 ~]# mount -a
mount: wrong fs type, bad option, bad superblock on dsnetapp01-dds:/vol/vol10_dsna1_nas/tol_systems,
      missing codepage or helper program, or other error
      (for several filesystems (e.g. nfs, cifs) you might
      need a /sbin/mount.<type> helper program)
      In some cases useful info is found in syslog - try
      dmesg | tail  or so
  • Running by hand gives this:
[root@dds-gaprodweb04 ~]# mount -t nfs dsnetapp05-dds:/vol/vol8_dds_gaprodweb_shared_dsna5_nas/www_shared /www/files/ga_shared
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified
[root@dds-gaprodweb04 ~]# yum search rpc

Solution: make sure rpc.statd is running.

Unable to bring up eth0 after cloning

This is annoying. After cloning a centos 6 vm with an active eth0, the interface in the new VM will only work as eth1. To fix it, edit /etc/udev/rules.d/70-persistent-net.rules, and delete the eth1 line.

General

Add New Disk

  • #scan for disks:
  • echo "- - -" > /sys/class/scsi_host/host0/scan
  • fdisk it to create a partition, then mkfs

Resize existing disk

  • If mounted, unmount
  • fdisk it, delete the primary partition
  • fdisk, add new partition
  • resize2fs /dev/sdc1

Add Swap

TO add a 4 gig swap:

  • dd if=/dev/zero of=/swapfile bs=1M count=4096
  • mkswap /swapfile
  • swapon /swapfile

Then add the following to /etc/fstab:

  • /swapfile swap swap defaults 0 0

Install Oracle Instant Client

  • download rpm here
    • install it
  • add /usr/lib/oracle/11.2/client64/lib/ to /etc/ld.so.conf.d/oracle-x86-64.conf
    • run ldconfig

Kernel Parameters for Oralce

  • Put in /etc/sysctl.conf
  • sysctl -a will list current parameters
  • sysctl -p /etc/syscth.conf will reload new parameters
kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576

fs.file-max = 6815744

See more here


Changing hard & soft file limits

  • Edit /etc/security/limits.conf

Ethernet Interface Details

[root@host ~]# ethtool eth0
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: d
        Link detected: yes

Add EPEL Repo

Check High Mem Usage

ps auxf | sort -nr -k 4 | head -10

Set up X11 Forwarding

  • yum install xorg-x11-apps xorg-x11-xauth
  • Verify X11Forwarding yes in /etc/ssh/sshd_config
  • ssh -X hostname

Add NFS export

/etc/exports

/db    dsdevdb02-tol-oracle.traderonline.com(rw)

/etc/sysconfig/iptables

#NFS
-A RH-Firewall-1-INPUT -p udp -m udp --dport 2049 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 2049 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 111 -j ACCEPT

Start services

exportfs -a
service nfs start

Issues

  • Check selinux
  • Check that the shared dir is not already an nfs mount from another server
  • See the Permission Denied bug above
  • If you get the error nfs mount: mount: /mnt: Not owner, then add o vers=3 to the mount command. Happens with solaris 10 mounting something from centos.

Enable NFS Client

  • yum install nfs-utils
  • yum install rpcbind
  • /etc/init.d/rpcbind start
  • /etc/init.d/nfslock start
  • turn those on with chkconfig

SNMP

Disable logging

Add OPTIONS="-Lf /dev/null -p /var/run/snmpd.pid" to /etc/snmp/snmpd.options on centos5, /etc/sysconfig/snmpd on centos 6.