Monthly Archives: July 2011

You are browsing the site archives by month.

Find file sizes Linux / Unix

I had issues a few weeks ago with trying to find which files were being written to in a system where the disks were being filled up. I got this from one of my colleagues Roger (follow on twitter:@_rogerc).

The following command is based upon “du” a fuller explanation can be found here or by typing the following into a terminal on a Linux or Unix system (where available).

man du

So to the useful command I was given which was:

du -sh /* 2> /dev/null

So breaking this command down “du” is the actual command and after the – we have “s” that for a summarised output and “h” to tell it output in a human readable format. Currently this command is looking at the folders and files that exists from root. The “2> /dev/null” part of the command will hide errors from the command in this case it is generally stuff that you cant access with the user that you are logged in as. The following would give you the file sizes in the home directory:

du -sh /home/* 2> /dev/null

Basically you need to supply the file path with a /* at the end and it will list all the files and folders in that directory. You can then change the command to the interesting directory and repeat the command on that directory.

Hopefully this will help you find those pesky files that are filling up your system.

DB2 Licensing – db2licm

Back in the day DB2 9.5, IBM introduced data compression. This was the time I was first starting with DB2 having moved job and from SQL server 2000/2005, and nearly straight away I was put on a project to migrate the old DB2 V8.1 Linux machine to V9.5 Unix architecture. Being new and being told my the senior team member to use the wonderful Control Centre, and I noticed in the create table dialog box a lovely little check box that said “Compress Data”. Apparently though this is a paid for extra!!

Obviously this was not something I wanted to fall foul of again, I think having soft licensing is a very bad thing, it is equally an education and knowledge thing that I now know. DB2 soft licensing something you have to be very aware of so you do not fall foul of it to that end you need to get the db2licm command in your servers life!

To this end I have hopefully some useful advice here on using the db2licm command, the full official command can be found here and some more here. So the first one I always use now is:

db2licm -e db2ese HARD

This command above will not let your DB2 enterprise server edition use any features that you have not applied a licence key for, so to apply a licence key:

db2licm -a db2ese.lic

So this will apply your licence file for your DB2 enterprise edition. This can be used with any licensing file you just have to supply the full path to the file, if you are not running the command from where the file is being held. Finally you may want to produce a report to make sure that you are compliant:

db2licm -g db2lic-report.txt

So this will generate a report at the file path specified. You must be a DBA user or have SYSADM. The final command just tells you the version and level of the product that is installed and so is especially useful for servers that you have just taken over or some developer “has set up for you”:

db2licm -l

Hopefully this will have given you a quick overview of the command and what it can do for you and the costs it could save.