Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, 5 November 2012

du vs df commands

A few days ago I learnt the difference between the du and the df commands, so I thought that I would write it here so that I can safely forget about it :)

df - report file system disk space usage
du - estimate file space usage

What does this mean?

Take an example of a 1 KB file on a filesystem with a block size of 1 MB.

du will display that the file had used only 1KB.
df would display that 1 MB had been used. This is because the block is not free anymore.

This can lead to discrepancies in what is reported by both commands. The bigger your block size the more likely it is that there will be big discrepancies.

Friday, 20 April 2012

Find installed location of RPM Package

I've been trying to run HPL on a homemade HPC (in the loosest sense of the word) cluster and I was struggling with some of the dependencies.

Rather than compile from source, I had decided to use the available binaries for various packages, so I needed to find out where the libraries where actually held, with the added problem of not being fully aware of the names of what I was looking for. Enter the rpm tool and its myriad options:
Usage: rpm [-aKfgpWHqVcdilsKiv?] [-a|--all] [-f|--file] [-g|--group] [-p|--package] [-W|--ftswalk] [--pkgid] [--hdrid] [--fileid] [--specfile]   [--triggeredby] [--whatrequires] [--whatprovides] [--nomanifest] [-c|--configfiles] [-d|--docfiles] [--dump] [-l|--list] [--queryformat=QUERYFORMAT] [-s|--state] [--nofiledigest] [--nomd5] [--nofiles] [--nodeps] [--noscript] [--comfollow] [--logical] [--nochdir] [--nostat] [--physical] [--seedot] [--xdev] [--whiteout] [--addsign] [-K|--checksig] [--delsign] [--import] [--resign] [--nodigest] [--nosignature] [--initdb] [--rebuilddb] [--aid] [--allfiles] [--allmatches] [--badreloc] [-e|--erase <package>+] [--excludedocs] [--excludepath=<path>] [--fileconflicts] [--force] [-F|--freshen <packagefile>+] [-h|--hash] [--ignorearch] [--ignoreos] [--ignoresize] [-i|--install] [--justdb] [--nodeps] [--nofiledigest] [--nomd5] [--nocontexts] [--noorder] [--nosuggest] [--noscripts] [--notriggers] [--oldpackage] [--percent] [--prefix=<dir>] [--relocate=<old>=<new>] [--replacefiles] [--replacepkgs] [--test] [-U|--upgrade <packagefile>+] [--quiet] [-D|--define 'MACRO EXPR'] [-E|--eval 'EXPR'] [--macros=<FILE:...>] [--nodigest] [--nosignature] [--rcfile=<FILE:...>] [-r|--root ROOT] [--querytags] [--showrc] [--quiet] [-v|--verbose] [--version] [-?|--help] [--usage] [--scripts] [--setperms] [--setugids] [--conflicts] [--obsoletes] [--provides] [--requires] [--info] [--changelog] [--xml] [--triggers] [--last] [--dupes] [--filesbypkg] [--fileclass] [--filecolor] [--fscontext] [--fileprovide] [--filerequire] [--filecaps]
Since I knew the package name I could run rpm -qi mpich2, which provides loads of information, but crucially not where the files are located:
Name        : mpich2                       Relocations: (not relocatable)
Version     : 1.2.1                             Vendor: CentOS
Release     : 2.3.el6                       Build Date: Fri 12 Nov 2010 05:23:32 AM GMT
Install Date: Wed 18 Apr 2012 10:29:31 AM BST      Build Host: c5b2.bsys.dev.centos.org
Group       : Development/Libraries         Source RPM: mpich2-1.2.1-2.3.el6.src.rpm
Size        : 7302214                          License: MIT
Signature   : RSA/8, Sun 03 Jul 2011 05:45:52 AM BST, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem <http://bugs.centos.org>
URL         : http://www.mcs.anl.gov/research/projects/mpich2
Summary     : A high-performance implementation of MPI
Description :
MPICH2 is a high-performance and widely portable implementation of the
MPI standard. This release has all MPI-2.1 functions and features
required by the standard with the exeption of support for the
"external32" portable I/O format.

The mpich2 binaries in this RPM packages were configured to use the default
process manager 'MPD' using the default device 'ch3'. The ch3 device
was configured with support for the nemesis channel that allows for
shared-memory and TCP/IP sockets based communication.

This build also include support for using '/usr/sbin/alternatives'
and/or the 'module environment' to select which MPI implementation to use
when multiple implementations are installed.
In order to find where the files are actually located I had to run rpm -ql mpich2, which provides the required information:
/etc/mpich2-x86_64
/etc/mpich2-x86_64/mpe_callstack_ldflags.conf
....
/usr/share/man/mpich2/man1/mpif90.1.gz

Thursday, 19 April 2012

Weird characters displayed in Linux

I was compiling HPL today and I was getting this error, among others:
 error: expected declaration specifiers or â...â before âMPI_Commâ
I have seen this encoding issue in some man pages too and had simply ignored it, but today I thought I've had enough so I looked for a solution. The solution is very simple:
export LC_ALL=C
 The output now is:
error: expected declaration specifiers or '...' before 'MPI_Comm'
Don't forget to add it to your .bashrc file (/home/username/.bashrc) to make the change permanent.

Monday, 16 April 2012

Add new disk to VMware linux guest without rebooting

I've been helping out jimmy with performance testing of the pmsapp and I was trying to rebuild the array for testing of RAID 5 performance when I found this little beauty to obviate the need for a reboot after adding a hard drive to an guest (VM) in linux.

In essence, once the disk has been added to the guest, run this:
echo "- - -" > /sys/class/scsi_host/host#/scan
substitute # with the appropriate number.

You can check that it has been successfully added to the system with: 
fdisk -l | grep MB