Thursday, 28 January 2010

umount trouble

Small note that I keep forgetting and I end up looking for it again and again:

If a mounted volume is used this is how we will find who is the bad boy that is using it:

The problem:

umount /media/disk/
umount: /media/disk: device is busy

The solution:

fuser -m /dev/sdc1
or
fuser -c /mnt/disk

will give us

/dev/sdc1: 538

so we can

ps auxw|grep 538

and

kill -9 538


woohoo! :)

an rpm repo in the making (quick)

Ok.. since we build the rpms we want.. lets build the yum repo we will distribute them from.

on the server side:

mkdir -p /srv/www/htdocs/custom-rpms
cp /usr/src/packages/RPMS/x86_64/*.rpm /srv/www/htdocs/custom-rpms/
cd /srv/www/htdocs/custom-rpms/
createrepo -v .
gpg --gen-key
gpg --list-keys
gpg -a --detach-sign --default-key repodata/repomd.xml
gpg -a --export > repodata/repomd.xml.key
from the client side:
(SLES 10)
zypper --no-gpg-checks --non-interactive sa http://your-smt-server/custom-rpms/

(or the recommended way)
rug set-prefs security-level checksum
rug sa http://your-smt-server/custom-rpms/ Custom-RPMS


more will come... :)

Thursday, 21 January 2010

an rpm in the making (quick)

Lets see....

We have /usr/src/packages/
In there we got:
BUILD -- (where the build process happens)
RPMS -- (where we will find the resulting rpm ... in x86_64 or other)
SOURCES -- (where the files mentioned as sources in the .spec file live)
SRPMS -- (we dont care about you) and
SPECS -- (where the .spec files live)

so...

we create the .spec file (dont ask how)

and we put the sources where they need to go

change to the /usr/src/pacakges/SPECS/ directory and run

rpmbuild --bb package-name.spec

and if your spec file is correct we should get an rpm ready in the /usr/src/packages/RPMS/x64_64/ directory

Have fun :)

Thursday, 14 January 2010

Useful netbackup commands

You are stuck using netbackup (which is a great product but nevertheless not fun!), do not despair! Here are some commands that might make your life easier:

Get the names and the number of backups saved for a client
bpimagelist -client -d 01/01/2007 | grep IMAGE | awk '{ print $6 }'

Find and eliminate all backups for a client
for i in $(bpimagelist -client -d 01/01/2007 | grep IMAGE | awk '{ print $6 }')
do
bpexpdate -backupid $i -d 0 -force (or not -force to ask y/n)
done


Get a list of the clients
bpplclients

Check out the netbackup processes running
bpps -x

Force quit all netbackup processes
bp.kill_all

Run an (expired) image cleanup
bpimage -cleanup

Predict the schedule for a policy
nbpemreq -predict -date 01/17/2010 -policy_filter

 

Thats all for now :)

Wednesday, 13 January 2010

force fsck

For whatever reason you would like to do this, this is how to:


Set the mount count to maximum of 1 mounts

tune2fs -c 1 /dev/sda1


fsck the partition

fsck -a /dev/sda1


and dont forget after you finish to set it back to 35

tune2fs -c 35 /dev/sda1


Thanks for playing :)