Friday, June 24, 2011

How-TO: Troubleshooting the "device is busy" Error Attempting to umount a Disk


Before attempting to dismount a filesystem, it must be inactive. If "any user" has one of the filesystem's directories as their current directory or has any file within the filesystem open, you will receive an error message, like the one below, when attempting to unmount the filesystem:
# umount /dev/dsk/c0t2d0s7
  umount: /dev/dsk/c0t2d0s7: device is busy
Well, the fuser command to the rescue. The fuser command may be used to determine which files or directories within a filesystem are currently in use and to identify the processes and users that are using them. fuser is available on all major flavors of UNIX with the exception of Digital UNIX. The fuser command can take two types of arguments:

  • normal filename: You can pass a normal filename or directory to the fuser command. In this case, it reports on that file or directory alone.
  • special disk: You can also pass in a special disk name as an argument to fuser. In this case, it reports on all files and directories within the corresponding filesystem.
You can use the -u option to the fuser statement to display the user ID's as well as PID's in its output.
Lets look at a few examples. The following command will display all processes and their associated users that are using files/directories on a specified disk on a Sun Solaris system:
# fuser -u /dev/dsk/c0t2d0s7
  /dev/dsk/c0t2d0s7:     1313co(oracle)    1223c(root)
In the above example, there are two processes using the filesystem mounted on /dev/dsk/c0t2d0s7 (which in my example is the /db filesystem) at the time of running the command. The User ID's are root, and oracle. The c being printed after the PIDs indicate that this is their current directory. You can use the -k option to kill all processes using the specified file or filesystem. In the following example, the UNIX PIDs 1313 and 1223 will be killed:
# fuser -k /dev/dsk/c0t2d0s7
  /dev/dsk/c0t2d0s7:     1313co    1223c
In Linux, you can use the -m option to allow you to specify the filesystem by name. On Solaris and IRIX, the -c option performs the same task.

Monday, May 30, 2011

HOW-TO: ifnconfig (HP-UX) as ifconfig (Linux)

To be able to see lan cards in HP-UX and its ip address similar as in Linux with ifconfig command, it is needed to make a little script:

1. make a new file:

vi /bin/lanshow

2. fill it with following data in it:

#!/bin/sh
netstat -ain | awk '$1 ~ /^lan/ && $1 !~ /:/ {print $1}' | sort | \
while read i
do
ifconfig $i
done

3. start it:

/bin/lanshow (or only lanshow)

Primer:
bash-4.2# /bin/lanshow
lan0: flags=2000000000001843
inet 192.168.1.1 netmask ffffff80 broadcast 192.168.1.255
lan1: flags=2000000000001843
inet 192.168.1.2 netmask ffffff80 broadcast 192.168.1.255



Friday, May 27, 2011

HOW-TO: Enable Appear Offline / Invisible in Office Communicator 2007

1. Open regedit (start -> run -> regedit)
2. Find location:
\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Communicator
3. Add REG_DWORD value (in case of Windows7 64bit, add a 32bit DWORD) with name
EnableAppearOffline
3. Set value to 1
4. stop and start Office Communicator

Wednesday, April 6, 2011

Capturing and replaying console/terminal sessions with script and scriptreplay

Have you ever wondered how you can easily capture a console session on Linux (and probably most other Unix-like OSes) without the need for special video recording software?

Here's how: you can use the script(1) command (part of the bsdutils package).

  • Start the script command. Without parameters the sessions will be logged to a file called typescript. You can also supply a filename on the command line: script mysession.log.
  • Type whatever you want to record...
  • End the recording session with exit or CTRL-d.
  • You can now view the file with less -r mysession.log (it contains line feeds, escape sequences etc., so a simple text viewer will probably display garbage). You can even print it with lpr(1). Or simply display it on the terminal with cat mysession.log.

An even cooler feature is that you can replay a script with the correct timing information:

  • First you have to also record the timing information using the -t switch: script -t 2>mysession.timing mysession.log.
  • You can then replay the script: scriptreplay mysession.timing mysession.log.

See the script(1) and scriptreplay(1) manpages for more details.

Sunday, April 3, 2011

VMware Tools installation cannot be started manually while Easy Install is in progress.

I created a Virtual Machine using VMWare's Workstation version 7. I did not install the tools right away, and I think that because of a hurry I really did not pay attention during the install, so I think I installed it using the simple mode, maybe not. Not that is bad doing it that way, but I never usually do it that way.

Whatever happened, later, when I went to install the tools, I got this message:
"VMware Tools installation cannot be started manually while Easy Install is in progress."

Now, I did not have time to do extensive research. One web site said something about the floppy drive config. I did find something referring to simple mode floppy, but removing it from the config file did not help.

Here is the quick simple way I fixed it: Delete the *.vmx config file. Then create a new machine but point it to the same folder. You will get a "warning" about creating a machine in the same folder as an existing machine, but no worry. Just make sure you use an "existing disk", and point it to the original.

This fixed it for me and it only took me a few minutes.

Tuesday, March 15, 2011

HOW-TO: Remove ILO2 license

You can remove license without reverting back to factory setting by logging into iLO2 using command line (telnet/secure shell) and execute command

"delete /map1 license"

Friday, March 4, 2011

HOW-TO: Mount a Windows share with smbmount

Make the directory you want to mount the share to.
mkdir /mnt/share
Next either...

Mount the share with user/pass:
smbmount //winpc/shared /mnt/share -o username=user,password=pass,rw
Or mount the share without a user/pass (this is true if Everyone is still set)
smbmount //winpc/shared /mnt/share -o rw
Hopefully thats it. Now you can use the share. You cannot create symbolic links or chmod the system (this is restriction on the WinXP side).

If you wish to allow users on the linux side access to the share then you will need to alter the options. Adding in uid= or gid= to allow access to users or groups respectively by mounting the drive with there permissions. Here's an example:
smbmount //winpc/shared /mnt/share -o rw,uid=znx
This will mount the drive as if user znx had done it. Thus he will have rw access to the shared.

How to use DiskSpd to simulate Veeam Backup & Replication disk actions

This HOW-TO contains information on how to use Microsoft© DiskSpd to simulate Veeam Backup & Replication disk actions to measure disk pe...