David Hedges

  • Home
  • About
  • Contact
  • Business Blog
  • IT Blog

Clearing open files on NSS volumes in OES Linux

July 24, 2011 by dhedges Leave a Comment

No matter how you do this it’s a pain if you have a lot of users. You would think you could run ncpcon and grep for the file or user, but you can’t. If you choose to do this from the command line, this is how I think the easiest way.

start with a ssh terminal app like putty, and set your buffer to something much higher than the default ( I usually choos 2000).

after you connect to the server, run the following:
ncpcon files list v=volume

this will list all of the open files, from here I copy the entire list and paste it into a file. At this point you can grep for the file name and find the and verify the file is open, and get its full path. Copy the full path to the file, or if it’s easier, the connection number

at this point to close the connection run:
ncpcon files close f= (if there are spaces, you will need to escape the spaces in the name (ex. /media/nss/vol/program\ files/file.txt )

or if you are just killing all of the users open files:
ncpcon files close c=

all of this can also be done using Remote manager too: http://<server IP>:8008 >Manage NCP Services>Manage Connections

Free Perl Book!

July 12, 2011 by dhedges Leave a Comment

I’ve been working on learning Perl lately. I have found a free book on perl by Simon Cozens at perl.org. I have not made it through the entire book yet, but of what I’ve seen so far, if you are beginning to learn Perl it is pretty good.

What does this book cover?

Installing Perl on Windows and UNIX
Making use of online Perl resources like CPAN
First principles in programming and the Perl syntax
Working with files and databases
Writing web pages in Perl
Using Perl as an object-oriented language

http://www.perl.org/books/beginning-perl/

A script to migrate cluster volumes for backups

July 11, 2011 by dhedges Leave a Comment

I’ve been a lot of linux work lately. We had an issue in the linux cluster if the volumes migrate to other servers in the cluster than where the backup server is that they either skip the volume or perform a full back of the volume. I didn’t see much out there about what others had done to do this, so I threw this together.

here is a script I put together to migrate a set group of volumes back to the server if they are not already mounted:

—beginning of script————

#!/bin/bash

#Enter the volumes that are to be migrated to this server

# if you need more than 10 also add an echo command as listed below (echo $VXX >>$TMPDIR/vars.$RAND1)

V1=

V2=

V3=

V4=

V5=

V6=

V7=

V8=

V9=

V10=

#Get the date

DATE=`time ‘+%b %d %T’`

#set temp directory

TMPDIR=/tmp

#set counting varialbe

NVC=1

# Get the hostname

HOST=`hostname`

# generate a random key

RANDOM=`date ‘+%s’`

RAND1=$[($RANDOM % 999) + 1]

echo $V1 >$TMPDIR/vars.$RAND1

echo $V2 >>$TMPDIR/vars.$RAND1

echo $V3 >>$TMPDIR/vars.$RAND1

echo $V4 >>$TMPDIR/vars.$RAND1

echo $V5 >>$TMPDIR/vars.$RAND1

echo $V6 >>$TMPDIR/vars.$RAND1

echo $V7 >>$TMPDIR/vars.$RAND1

echo $v8 >>$TMPDIR/vars.$RAND1

echo $v9 >>$TMPDIR/vars.$RAND1

echo $V10 >>$TMPDIR/vars.$RAND1

sed ‘/^$/d’ $TMPDIR/vars.$RAND1 > $TMPDIR/vars1.$RAND1

#number of volume variables

NV=`wc -l $TMPDIR/vars1.$RAND1 |awk ‘{print $1}’`

cluster status |grep $HOST | awk ‘{print $1}’

while [ $NVC -le $NV ]

do

LINE=`head -$NVC $TMPDIR/vars1.$RAND1 | tail -1`

VTEST=`cluster status |grep $HOST | awk ‘{print $1}’ |grep $LINE`

if [ “$(echo $LINE)” == “$(echo $VTEST)” ]; then

echo “$DATE already mounted on this server… skipping $LINE”

else

echo “$DATE not mounted on this server.. .need to migrate $LINE”

cluster migrate $LINE $HOST

sleep 30

fi

(( NVC++))

done

#clean up temp files

rm $TMPDIR/*.$RAND1

————–end of script————-

How to move the /boot partition in Suse Linux 11.x

July 9, 2011 by dhedges Leave a Comment

I was wanting to test moving the boot partition from where is it placed by default in SuSe (suse places it in /dev/sda1 and makes it 70MB by default… way to small). The problem I found was I was having a lot of trouble finding a good document on this. I thought I would post the procedure I used as an example. Hopefully it will be helpful to others.

1. start by creating you new partition:
yast2 -> partitioner
Add a partition -> primary partition -> choose a partition size -> format partition, do not mount -> finish
2. create a temp directory and mount the partition
#mkdir /mnt/newboot
#mount /dev/sdax /mnt/newboot
3. copy /boot partition data
#cp -dpR /boot/* /mnt/newboot
4. unmount your partitions and swap them around
#umount /boot
#umount /mnt/newboot
#mount /dev/sdax /boot
4. update the menu.lst file
#vi /boot/grub/menu.lst
change all of the hd(0,0) references, or whatever the default was to the correct drive. (ex. /dev/sda1 = hd(0,0) | /dev/sda3 = hd(0,2) | /dev/sdb1 = hd(1,0))
5. update fstab
#vi /etc/fstab
edit the line with /boot in it, and change the reference /dev/sdax to the correct partition
6. delete the old /boot partiton ( I had found that unless you remove the old one it will continue to try to boot from it)
yast2 -> partitioner
delete the original boot partition
**** DO NOT REBOOT AT THIS POINT ****
7. fix the boot loader (suse will not let you run grub-install so you need to do this with yast)
yast2 -> bootloader
select “boot loader installation”

Choose custom boot partition and specify the partition used (ex. /dev/sda3)
save, and reboot

At this point it should be booting from your new boot partition.

« Previous Page
Next Page »

Copyright © 2025 · Beautiful Pro Theme on Genesis Framework · WordPress · Log in