Linux
For a lack of LSOF
by sudo on Aug.28, 2012, under Linux
When you have to deal with system that lacks lsof and cannot be easily installed, you can run the following to show information regarding currently open file handlers.
ls -l `ls -l /proc/*/fd/ 2>/dev/null | grep ">" | cut -d ">" -f 2 | grep "/" | sort | uniq`
If the culprit of disk space usage has already been deleted, you’ll find the following in your output.
ls: /var/log/openvswitch/ovs-vswitchd.log.1: No such file or directory
ls: (deleted): No such file or directory
———
Teran came up with the following.
for file in `ls -l /proc/*/fd/* | grep deleted | awk '{print $9}'`; do echo -n "$file "; ls -l $file | awk '{print $11}' | tr -d '\n'; stat -L $file | grep Size; done
Error accessing XVP java console
by sudo on Aug.04, 2012, under Linux
If you see
Network Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilder
when attempting to connect to an XVP console, update your SSL crt/key, restart (apache|nginx) and stunnel.
More information can be found here.
XVP troubleshooting guide
Unable to connect to Xen Console
by sudo on Mar.29, 2011, under Linux
If you encounter the following error when trying to connect to an instance with Xen, xenconsoled is not running.
xenconsole: Could not read tty from store: No such file or directory
To rectify, start /usr/sbin/xenconsoled.
Display configuration options for an RPM
by sudo on Mar.31, 2010, under Linux
rpm -q --queryformat="%{NAME}: %{OPTFLAGS}\n" packagename
Fast large file finder
by sudo on Jan.20, 2010, under Linux
The following will display all files over 100MB in size on the server except for those in /proc.
find / -path /proc -prune -o -type f -size +102400k -printf "%s %h/%f\n" | sort -rn -k1 | head -n 50 | awk '{ print $1/1048576 "MB" " " $2}'
For a specific case, multiple paths.
find / -path /images -prune -o -path /var/run/sr-mount -prune -o -path /proc -prune -o -type f -size +102400k -printf "%s %h/%f\n" | sort -rn -k1 | head -n 50 | awk '{ print $1/1048576 "MB" " " $2}'
Urchin : Unable to retrieve local file listing / Permission denied
by sudo on Dec.10, 2009, under Apache, Linux
A common issue with occurs when apache is updated. Red Hat Enterprise Linux will revert /var/log/httpd to 0755 with root:root as ownership resulting in the following error.
WARNING: (****-****-****) Unable to retrieve local file listing
DETAIL: /var/log/httpd/access_log : Permission denied
A temporary fix until the next apache update, which are few and far between, is to ‘chmod 0755 /var/log/httpd’. Then ensure the current access logs are readable to the urchin user, 0644 should work. A permanent work around is to specify a log directory that will not be touched by the httpd rpm and give urchin sufficient permissions to access it.
Display Physical Memory in Server
by sudo on Nov.13, 2009, under Linux, Server
The following is useful in the event that the wrong version (32 vs 64bit) of linux or non-SMP/PAE kernel is installed and you’d like to verify how much RAM physically is in the server.
dmidecode | awk '/\tSize: [0-9]+ MB/ {SUM=SUM+$2} END {print SUM}'
Force SSL with mod_rewrite
by sudo on Oct.15, 2009, under Apache, Linux
Create a .htaccess within the document root with the following.
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
You must ensure AllowOverride is set to All within the apache configuration or it will not read the .htaccess.
Parse single table from mysqldump
by sudo on Oct.08, 2009, under Linux
If you wish to pull a single table from a large mysqldump, the following commands will accomplish this.
# grep -n "CREATE TABLE" databasedump.sql
If the table you want starts on line 100, and the proceeding table is on line 150, run the following commands to parse the dump.
# head -n 142 databasedump.sql > parsed.sql
# tail -n 100 parsed.sql > table.sql
Do not use the exact line number returned from grep as you will have the create table statement from the next table.
Display SAN information with powermt
by sudo on May.28, 2009, under Linux, Server
powermt display dev=all
This will display all information relevant to connected SAN devices.
# powermt
Usage:
powermt[class=all|clariion|ess|hitachi|hphsx|hpxp|invista|symm] powermt check [force] [hba=
|all] [dev= |all]
powermt check_registration
powermt config
powermt disable hba=
powermt display nonvirtual {dev=|all} [every=<#seconds>] [class=invista|all]
[width=<#col>]
powermt display [ports] [dev=|all] [every=<#seconds>]
[width=<#col>]
powermt display hba_mode
powermt display latency [dev=|all] [every=<#seconds>]
[width=<#col>]
powermt display options
powermt display paths [every=<#seconds>] [width=<#col>]
powermt display port_mode
powermt display unmanaged
powermt enable hba=
powermt load [file=]
powermt manage {dev=| class= }
powermt release
powermt remove [force] hba=|all | dev= |all
powermt restore [hba=|all] [dev= |all]
powermt save [file=]
powermt set mode=active|standby [hba=|all] [dev= |all]
powermt set path_latency_monitor=on|off
powermt set path_latency_threshold=
powermt set periodic_autorestore=on|off
powermt set policy={ad|bf|co|lb|li|nr|re|rr|so} [dev=|all]
powermt set port_disable={true|false} dev=
powermt set priority=[dev= |all]
powermt unmanage {dev=| class= }
powermt update lun_names
powermt version