Categories
Sysadmin

checking who is connecting with nfs server

cat /var/lib/nfs/rmtab
Categories
Sysadmin

Fixed sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-iptables:

sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-iptables:

No such file or directory sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-ip6tables: No such file or directory

solution:

modprobe br_netfilter

Categories
Sysadmin

slashargument no image css appear issue in moodle 2.9+ nginx FIXED

location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000 (or your php-fpm socket); include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }

Categories
Sysadmin

ipmitool dev not found

modprobe ipmi_devintf
modprobe ipmi_si

You can add these to /etc/modules to have them loaded automatically (just list the module names):

ipmi_devintf
ipmi_si
Categories
Sysadmin

linux gateway

iptables -A FORWARD -i eth1 -j ACCEPT
iptables -A FORWARD -o eth1 -j ACCEPT

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 

#ETHO where internet is connected
Categories
Sysadmin

Get MD5 checksum hash of big files in Python

def checkHash(filename, blocksize=2**20):

    try:

        print(“need to creating hash of file ” +filename)

        m = hashlib.md5()

        with open(filename , “rb” ) as f:

            while True:

                buf = f.read(blocksize)

                if not buf:

                    break

                m.update( buf )

        hash1=m.hexdigest()

        print(“hash of above file is  ” + hash1)

        return hash1

    except :

        print(“Exception in hash code:”)

        print(“-” * 60)

        traceback.print_exc(file=sys.stdout)

        print(“-” * 60)

        return “error”

Categories
Sysadmin

cinder volume service down fixed

it is mostly date issue check date on both controller and cinder-volume server 

and do 

ntpdate 1.ubuntu.pool.ntp.org

Categories
Sysadmin

No space left on device: AH00023: Couldn’t create the rewrite-map mutex

To clear all semaphores owned by the apache user:

ipcs -s | awk -v user=apache '$3==user {system("ipcrm -s "$2)}'
Categories
Sysadmin

forcing apt-get to always use ipv4 instead of ipv6

echo ‘Acquire::ForceIPv4 “true”;’ | sudo tee /etc/apt/apt.conf.d/99force-ipv4

Categories
Sysadmin

Using tape Library PV114x or other with Linux

It is dead simple, make sure that when you plug in SAS cable the light on the SAS card comes up, I spent hours in struggling on Linux when drives did not appear and finally when i push the SAS connector bit inside all flashes 🙂

You only need a software name mt and tar which most of Linux OS already have.. It works same on Ubuntu and or Centos /Redhat flavours.

Replace /dev/st0 with your actual tape drive name.  Usually it is name like /dev/st0 /dev/st1 and so on ..

Rewind tape drive:

mt -f /dev/st0 rewindBackup

Backup any folder:

tar -czf /dev/st0 /anyfolder

Display list of files on tape drive:

tar -tzf /dev/st0

Restore /anyfolder directory:

 

cd /
mt -f /dev/st0 rewind
tar -xzf /dev/st0 www

Unload the tape:

mt -f /dev/st0 offline

Display status information about the tape unit:

mt -f /dev/st0 status

Erase the tape:

mt -f /dev/st0 erase

You can go BACKWARD or FORWARD on tape with mt command itself:

(a) Go to end of data:

mt -f /dev/nst0 eod

(b) Goto previous record:

mt -f /dev/nst0 bsfm 1

(c) Forward record:

mt -f /dev/nst0 fsf 1

To compare tape backup, enter:

tar -dlpMzvf /dev/st0 /anyfolder

To restore tape in case of data loss or hard disk failure:

tar -xlpMzvf /dev/st0 /anyfolder

Where,

d : find differences between archive and file system
x : extract files from an archive
l : list the contents of an archive
p : ignore umask when extracting files
M : create/list/extract multi-volume archive (multiple tapes)
z : Compress backup using gzip
v : verbosely list files processed
f /dev/st0 : Tape device name
/anyfolder : Backup /anyfolder file system