<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d11356004\x26blogName\x3dxception\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://openrent.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://openrent.blogspot.com/\x26vt\x3d-2179510228592399674', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Setup LVM on a blank disk

If you have a blank disk array, and want to prepare it for logical volumes, here's how you do it:

1) Create the physical volume.
$ pvcreate /dev/cciss/c0d1
Physical volume "/dev/cciss/c0d1" successfully created

2) Create the volume group.
$ vgcreate volgroup2 /dev/cciss/c0d1
Volume group "volgroup2" successfully created

3) Make the volume group active.
$ vgchange -a y volgroup2
0 logical volume(s) in volume group "volgroup2" now active

4) Create your logical volumes.
$ lvcreate -L 5G -n d01_lv volgroup2
Logical volume "d01_lv" created

5) Create an EXT3 filesystem on the logical volume.
$ mke2fs -j /dev/volgroup2/d80_lv

6) Create a directory on the Linux filesystem to use as a mount point for the volume.
$ mkdir /d01

7) Edit the /etc/fstab file, adding an entry for the logical volume device and mount point.
/dev/volgroup2/d01_lv /d01 ext3 defaults 1 2

[Note: this was done on an HP server, hence the /dev/cciss/c0d1 device references. Other servers might use a /dev/sda reference, for example]

Creating logical drives on HP servers at the CLI

Here's is how you create new logical drives on an HP server from the Linux command-line. The "Hpacucli" tool is installed as part of the HP PSP.
1) Show all controllers on the server:
$ hpacucli controller all show

Smart Array 6i in Slot 0

2) Show the status of the controller:
$ hpacucli controller all show status

Smart Array 6i in Slot 0
Controller Status: OK
Cache Status: OK

3) Show all physical drives:
$ hpacucli ctrl slot=0 pd all show

Smart Array 6i in Slot 0

array A
physicaldrive 2:0 (port 2:id 0 , Parallel SCSI, 36.4 GB, OK)
physicaldrive 2:1 (port 2:id 1 , Parallel SCSI, 36.4 GB, OK)

unassigned
physicaldrive 2:2 (port 2:id 2 , Parallel SCSI, 300 GB, OK)
physicaldrive 2:3 (port 2:id 3 , Parallel SCSI, 300 GB, OK)

4) Create a new RAID1 logical drive on the unassigned physical drives.
$ hpacucli ctrl slot=0 create type=ld drives=2:2,2:3 raid=1+0

[Note: All usable drive space will be used by default.]


5) Show the status of all logical drives:
$ hpacucli ctrl slot=0 logicaldrive all show status

logicaldrive 1 (33.9 GB, 1+0): Ok
logicaldrive 2 (279 GB, 1+0): Ok

6) Show all defined arrays:
$ hpacucli ctrl slot=0 logicaldrive all show

Smart Array 6i in Slot 0

array A
logicaldrive 1 (33.9 GB, RAID 1+0, OK)

array B
logicaldrive 2 (279 GB, RAID 1+0, OK)

When delete won't work

When you are trying to delete a large number of files in Linux, sometimes the rm command will fail with the error message "-bash: /bin/rm: Argument list too long"

This is due to a kernel limit, and the workaround is to use the "xargs" command to apply the delete command to a list of files. The find command bundles up the files, and xargs tells the rm command to delete them.

If you are in the directory you wish to delete files from, issue this command:

# find . -name '*' | xargs rm
OR
# find . -type f |xargs rm -f
OR
# find . -type d | xargs rm -rf

Disable the VNC HTTP server

For security and performance reasons, you may want to disable the HTTP/Java interface of VNC server. The normal VNC server process listens on port 5901, and the HTTP listener uses port 5801. You can see this echoed in the vnc log file:

vncext: VNC extension running!
vncext: Listening for VNC connections on port 5901
vncext: Listening for HTTP connections on port 5801
vncext: created VNC server for screen 0

To disable the startup of the HTTP listener, edit the /usr/bin/vncserver script, and scroll down to approximately line #138 where you will find this directive:

$cmd .= " -httpd $vncJavaFiles" if ($vncJavaFiles);

Comment out this line, and restart VNC server. You should now see only this in the log file:

vncext: VNC extension running!
vncext: Listening for VNC connections on port 5901
vncext: created VNC server for screen 0

Undocumented up2date command: --exclude

Do you need to exclude a package from being automatically installed by up2date? Simply add the "--exclude=" flag to the up2date invocation, like this:

# up2date -u --exclude=perl

wget via a proxy

If your server cannot contact the Internet except via a proxy server, you can still use the wget command. You simply tell wget how to use the proxy server. Here's how:

1) Open /etc/wgetrc
2) Scroll down to the section for HTTP and FTP proxy servers (approximately line #76 )
3) Add the URL and port of your proxy server for both FTP and HTTP transfers:
ftp_proxy = http://your. proxy.server:8080
http_proxy = http://your. proxy.server:8080

The next time you invoke wget, it will inherit these settings.

HP PSP can't find Red Hat kernel source code

The HP Proliant Support Pack (PSP) compiles a number of Linux drivers from source, and thus requires the presence of the Linux source code on the server. The HP install script (ex: install750.sh) will look for the presence of a symlink called "build" in the /lib/modules/ directory.

If if cannot find the source, code, the install script will fail.

To overcome this problem, simply make a symlink to the proper source code directory tree (usually found in the /usr/src/kernels/ directory.

For example,

ln -s /usr/src/kernels/2.6.9-34.0.2.EL-i686 /lib/modules/2.6.9-34.0.2.ELsmp/build

Java VM debugging flags

If you want to see what's going on inside a JVM, use these flags at a minimum:
-XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:+PrintHeapAtGC -verbose:gc -Xloggc:/path/to/logfile/gc.log

You can also add these options to obtain data from the JVM:

-XX:+PrintHeapUsageOverTime Print heap usage and capacity with timestamps
-XX:+PrintGCApplicationStoppedTime Measure the length of the collection pauses.
-XX:+PrintTLAB Trace all the operations on TLAB's (Thread Allocation Buffers)
-XX:+PrintGCApplicationConcurrentTime Measure the amount of time the applications runs between collection pauses
-XX:+PrintTenuringDistribution Gives the aging distribution of the allocated objects in the young generation.
-XX:+TLABStats
-XX:+PrintGCTaskTimeStamps

wchan

Use the command "ps xal" to see the "WCHAN" column. That column will show the name of the kernel function where the process is actually sitting (running tasks have a '-' in the column). To get more detail, examine the processes /proc entry:

cat /proc//wchan

Windows Administrator login via RDP

Place a shortcut to RDP on your windows desktop, and add the /console attribute to it. That will always log you in as the Administrator, assuming server permissions are set accordingly.

%SystemRoot%\system32\mstsc.exe /console