Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Wednesday, January 16, 2013

Running Parallel Commands on a group of Linux boxes

I have been using a program called cssh for a while now and really appreciated the features of it.  Every once in a while I wanted to run commands from the command line and not spawn a bunch of new windows.  I recently ran across polysh which works very nicely and does exactly what I wanted.

Wednesday, September 12, 2012

What is taking up all this space?

We had a filesystem that kept growing in size even though the user was deleting the log files. du and df didn't match up and it was starting to be a problem. We restarted one of the apps and got back a little space so I figured there were still open file handles holding on to the space. 

>>lsof | grep deleted

 That showed me the app that was holding on to the space.

>>lsof | grep deleted | awk '{print $1, $2, $7, $9}'

 Then on the PID of the app I ran:

 >>kill -HUP 8787

 Presto, that freed up all the disk space.

Friday, July 10, 2009

Clock setting in Linux

In almost all applications time being in sync is very important. Even simple logging needs accurate time to keep the logs in tune.

Servers have a hardware clock and an OS software clock and both need to be in sync as well as in sync with a certified time source.

If you already use NTP to keep your software clock in sync with a certified time source it is pretty easy to keep your hardware clock up to date with the OS time.

Here are some basic commands:

To set the syste/OSm clock from the hardware clock:
#> sudo hwclock --hctosys

Likewise if your hardware clock is set incorrectly (for example, if you replaced the
CMOS battery on your motherboard), you can set the hardware clock from your system clock as follows:

Likewise, set the hardware clock from the software/OS clock:

#> hwclock --systohc

As always, there are a lot more options available so check out the man pages.

Tuesday, July 7, 2009

How to add a disk to a vmware linux guest without rebooting

I have a whole series of linux guests running on some ESX hosts off NFS shares.

Today I wanted to add another disk to a running guest and couldn't reboot it.
ESX let me add the disk but the CentOS 5.3 guests didn't see it automatically.

I ran this command:
echo - - - > /sys/class/scsi_host/host0/scan

"That is echo dash space dash space dash /sys/class/scsi_host/host zero /scan"

and then the disk showed up under fdisk -l

Put a new LVM on it, added a filesystem, and mounted it.