Generating a list of dates for last month in Python

Posted in Python on April 1, 2013 by PonderingPenguin

Came up with the following to generate a list of dates for the previous month for a reporting script I’m making:

import datetime
dateList = []
now =
for i in range(1, (calendar.monthrange(now.year, (now.month-1))[1])):

     dateList.append(str(, (now.month – 1), i)))


Deadline IO scheduler tunables

Posted in Linux with tags , , on February 28, 2013 by PonderingPenguin

Deadline IO scheduler tunables

The documentation for the Deadline IO scheduler tunables at

SSH taking forever to connect?

Posted in Linux on February 26, 2013 by PonderingPenguin

If you SSH connections are taking forever to connect then find/change the following in your /etc/ssh/sshd_config file

UseDNS no

and restart ssh

/etc/init.d/sshd restart

You should find an instant and dramatic improvement

Very good guide on shrinking LVM PVs

Posted in Linux with tags , on February 22, 2013 by PonderingPenguin

Had to shrink a PV due to the virtual disk having to be resized, found this guide as i haven’t done this for some time, as i suspected the method is to shrink the VG then truncate the PV using fdisk or such. See the link for a better explanation

Rescanning buses to discover new drives

Posted in Linux with tags , , on February 20, 2013 by PonderingPenguin

So you’re in a Linux VM and you need to add a disk, how can you discover the new disk without restarting the machine?

Well first of all it depends on what controller you’re emulating:

SCSI Disks (/dev/sd?):

Disks starting with sd are SCSI disks, SCSI disks are very easy to discover all you need to do is issue the following command

echo “- – -” > /sys/class/scsi_host/host?

where ‘host?’ should be the scsi_adaptor your trying to rescan. However you could do it the lazy way and scan all of the hosts, this doesn’t come without risk and i have had machines hang on me after this

for device in /sys/class/scsi_host/host*; do echo “Scanning: ” $device; echo “- – -” > $device/scan; done

This method works for SATA and SAS disk as well.

IDE Disks (/dev/hd?):

Disks starting with hd are normally IDE disks, IDE disks can technically be refreshed but the methods to do so are a bit of a frig, I would not recommend doing them, better just restart the machine I’m afraid. But if you insist I’ve seen a few pages saying that hotplug might help, google if you must.

About Me

Posted in Misc on February 5, 2013 by PonderingPenguin



So as it says im a penguin, that is a linux guy, a Linux system admin, as well as a UNIX admin. I’ve been one for a little while and have also worked in a few positions within the IT industry. My aim for this blog is yet another blog where tips and interesting things will be stored. More for my own reference but if it helps somebody else then that just dandy