Blog O' Matty


Displaying a file or device in hex

This article was posted by Matty on 2009-12-05 10:03:00 -0400 -0400

A while back I came across the hexdump utility, which allows you to dump the contents of a device or file in hexadecimal:

$ dd if=/dev/hda count=1 | hexdump -x

1+0 records in
1+0 records out
0000000 48eb 1090 d08e 00bc b8b0 0000 d88e c08e
0000010 befb 7c00 00bf b906 0200 a4f3 21ea 0006
0000020 be00 07be 0438 0b75 c683 8110 fefe 7507
0000030 ebf3 b416 b002 bb01 7c00 80b2 748a 0203
0000040 0080 8000 e051 0001 0800 80fa 80ca 53ea

This is a super useful utility!

2.6.32 Linux kernel Virtualization memory De-Duplication

This article was posted by Matty on 2009-12-04 20:32:00 -0400 -0400

This is pretty sweet.  In the 2.6.32 Linux kernel released yesterday, a new feature of de-duplicating memory of virtualized instances, was introduced.

Modern operative systems already use memory sharing extensively, for example forked processes share initially with its parent all the memory, there are shared libraries, etc. Virtualization however can’t benefit easily from memory sharing. Even when all the VMs are running the same OS with the same kernel and libraries the host kernel can’t know that a lot of those pages are identical and can be shared. KSM allows to share those pages. The KSM kernel daemon, ksmd, periodically scans areas of user memory, looking for pages of identical content which can be replaced by a single write-protected page (which is automatically COW’ed if a process wants to update it). Not all the memory is scanned, the areas to look for candidates for merging are specified by userspace apps using madvise(2): madvise(addr, length, MADV_MERGEABLE).*

The result is a dramatic decrease in memory usage in virtualization environments. In a virtualization server, Red Hat found that thanks to KSM, KVM can run as many as 52 Windows XP VMs with 1 GB of RAM each on a server with just 16 GB of RAM. Because KSM works transparently to userspace apps, it can be adopted very easily, and provides huge memory savings for free to current production systems. It was originally developed for use with KVM, but it can be also used with any other virtualization system - or even in non virtualization workloads, for example applications that for some reason have several processes using lots of memory that could be shared.*

Getting a daily status report from your Netbackup infrastructure

This article was posted by Matty on 2009-11-30 22:16:00 -0400 -0400

I support a couple of Netbackup environments, and like to keep tabs on what is going on with my media and master servers. There are a slew of reports available in the GUI and CLI interfaces, and these reports cover everything from Netbackup errors to tape reports to what is occurring with vault jobs. The two reports I find most useful are the jobs report and the errors report. These reports can be access through the bpdbjobs and bperror commands, and produce a nice summary of the jobs that ran and any errors that occurred. I use these so frequently that I run a script to e-mail me the output each morning:

Summary of jobs on nbmaster
Queued: 2
Waiting-to-Retry: 0
Active: 4
Successful: 479
Partially Successful: 4
Failed: 6
Incomplete: 0
Suspended: 0
Total: 495

TIME SERVER/CLIENT TEXT
11/29/2009 20:32:34 media1 client1 backup of client client1 exited with status 13 (file read failed)
11/29/2009 21:10:50 media1 client1 socket read failed: errno = 62 - Timer expired

Configuring yum to use an HTTP or FTP proxy

This article was posted by Matty on 2009-11-29 12:11:00 -0400 -0400

I have been experimenting with squid at home, and recently configured yum to use the squid proxy server I set up. There are two ways you can get yum to use an HTTP or FTP proxy. First, you can make yum use a proxy for a single session by setting the http_proxy and ftp_proxy environment variables:

$ export http_proxy=http://proxy:3128

$ export ftp_proxy=http://proxy:3128

$ yum update

If you want to make the proxy settings permanent, you can add a proxy directive to /etc/yum.conf:

$ grep proxy /etc/yum.conf proxy=http://proxy:3128

If your proxy requires you to authenticate, you can add the credentials to the configuration file as well.

Adding 3rd party package repositories to CentOS Linux

This article was posted by Matty on 2009-11-28 13:56:00 -0400 -0400

As a long time CentOS user, I have grown accustomed to firing up yum to install my favorite packages. Periodically a package I’m looking for isn’t available, and I need to go out to a 3rd party repository to snag it. One awesome source for 3rd party repositories is the repositories section of the CentOS website, which contains the yum repository files for several extra package sources. If you are looking for a file that isn’t available in the stock CentOS distribution, you should take a look at that site!