LiquidObject

Ubuntu – Clearing up the /boot volume

For years Ubuntu has had the ability to automatically patch the system via crontab, however as kernel updates are applied old revisions are never purged (in the event there is an issue). However, if you have a smaller drive for your install say as a Virtual Machine the /boot volume can be sized pretty small. Eventually you’ll start to see upon login a message warning you the partition is over 80% full, in this case we need to go back and purge some old kernels.

Lets check to see how bad it currently is?

df -h /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       228M   190M  38M  83% /boot

So lets obtain our currently running build information

sudo uname -r

Now, lets take a look at what is currently installed.

sudo dpkg -l linux-image-\* | grep ^ii

Which returned for me returned

ii  linux-image-3.5.0-23-generic           3.5.0-23.35   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP  
ii  linux-image-3.5.0-36-generic           3.5.0-36.57   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP  
ii  linux-image-3.5.0-37-generic           3.5.0-37.58   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP  
ii  linux-image-3.5.0-39-generic           3.5.0-39.60   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP  
ii  linux-image-3.5.0-40-generic           3.5.0-40.62   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP  
ii  linux-image-3.5.0-44-generic           3.5.0-44.67   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP
ii  linux-image-3.5.0-45-generic           3.5.0-45.68   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP
ii  linux-image-3.5.0-46-generic           3.5.0-46.70   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP
ii  linux-image-3.5.0-47-generic           3.5.0-47.71   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP
ii  linux-image-extra-3.5.0-23-generic     3.5.0-23.35   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP  
ii  linux-image-extra-3.5.0-36-generic     3.5.0-36.57   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP  
ii  linux-image-extra-3.5.0-37-generic     3.5.0-37.58   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP  
ii  linux-image-extra-3.5.0-39-generic     3.5.0-39.60   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP  
ii  linux-image-extra-3.5.0-40-generic     3.5.0-40.62   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP  
ii  linux-image-extra-3.5.0-44-generic     3.5.0-44.67   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP
ii  linux-image-extra-3.5.0-45-generic     3.5.0-45.68   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP
ii  linux-image-extra-3.5.0-46-generic     3.5.0-46.70   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP
ii  linux-image-extra-3.5.0-47-generic     3.5.0-47.71   amd64     Linux kernel image for version 3.5.0 on 64 bit x86 SMP
ii  linux-image-generic                    3.5.0.47.63   amd64     Generic Linux kernel image

At this point everything has been stable for a few weeks, so I will purge anything below 3.5.0-47.

sudo apt-get purge linux-image linux-image-3.5.0-23 linux-image-3.5.0-36 linux-image-3.5.0-37 linux-image-3.5.0-39 linux-image-3.5.0-40 linux-image-3.5.0-44 linux-image-3.5.0-45 linux-image-3.5.0-46

After everything was removed, lets check again to see where we sit.

df -h /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       228M   29M  188M  14% /boot

In the end we ended up clearing up 69% of the /boot partition.

,
March 21, 2014 at 8:24 am Comments (0)

vSphere slotsfile 0x10000042 error

Every once and awhile when using SOIC (Storage IO Control) within ESXi the hosts will get out of wack with regards to reading and writing to the slotsfile. If you take a look at your syslog output you might see something like the below.

<14>2013-12-12T06:49:58.987Z vmsrv-13.uwgb.edu storageRM: open /vmfs/volumes//VM-LUN-1/.naa.60002ac0000000000000002900001234/slotsfile(0x10000042, 0x0) failed: No such file or directory
<14>2013-12-12T06:49:58.987Z vmsrv-13.uwgb.edu storageRM: Giving UP No such file or directory Error -1 opening SLOT file /vmfs/volumes//VM-LUN-1/.naa.60002ac0000000000000002900001234/slotsfile
<14>2013-12-12T06:49:58.987Z vmsrv-13.uwgb.edu storageRM: Error -1 in opening & reading the slot file
<14>2013-12-12T06:49:58.987Z vmsrv-13.uwgb.edu storageRM: Failed to read slot file

The correction to this is pretty fortunately is very simple.

Lets stop the SOIC service

/etc/init.d/storageRM stop

Now lets start it

/etc/init.d/storageRM start

Monitor the syslog entries for the next few seconds and you should see them clear up pretty quickly.

Original reference for this post came from Frank over at . Same issue, just seeing in a different area of vSphere.

, ,
December 12, 2013 at 1:03 am Comments (0)

Monitoring Exchange 2010 for Spammers

When using Exchange as your outside facing transport servers in either a dedicated Edge role under 2010 or within a multi-role setup finding out when you have a spammer from within historically has been done via blacklist notifications. What if we can catch the spammers in the act? What if we can stop the spam midstream? As a side benefit, you’ll get notification if mail is backing up for other reasons as well…ie random email providers being offline or if you end up having routing issues.

$servername = Get-Content env:computername
$mail_sender = "$servername@contoso.com"
$mail_server = "my_smtp_server.contoso.com"
$mail_recipient = "my_email@contoso.com"
$mailreport_subject = "Script: $servername Message Queues"
#At what level do you want to be emailed?
$maxinqueue = 40
$body = ""

Add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue

function SendEmailReport
{

    $msg = New-Object System.Net.Mail.MailMessage $mail_sender, $mail_recipient, $mailreport_subject, $body
    $client = New-Object System.Net.Mail.SmtpClient $mail_server
    $client.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
    $client.Send($msg)
}

$i = 0
while($i -lt 29)
{
	$mymessages = get-message -resultsize unlimited	
	#$mysenders  = $mymessages | select-object fromaddress
	if($mymessages.count -gt $maxinqueue)
	{
		$body = "Warning the current queue on $servername has exceeded the queue count of $maxinqueue and is currently at " + $mymessages.count
		$body += "`r`n"
		$body += $mymessages | out-string

		SendEmailReport
		$body = ""
	}
	$mymessages = $null
	write-host $i
	Sleep 60
	$i++
}

The $maxinqueue variable is the real trick, at what level of messages in the queue is normal for your organization?

Then all that needs to be done is configuration of a simple scheduled task say run every 30 minutes, the scripting logic is configured to run in a loop to cover at the per minute within a 30 minute window.

, ,
July 11, 2013 at 9:04 am Comments (0)

Backup Exec 2012 database cleanup

When using Backup Exec 2012 by default will install a rather dated at this point in time version of SQL Server 2005 Express Edition. As time goes with and install the database grows and eventually can lead to errors like: “The Backup Exec Database has almost reached the 4-GB limit that is allowed for SQL Server Express Edition. To ensure that Backup Exec continues to function properly, either clean up the Backup Exec Database or upgrade to the full version of SQL Server.”, also known as V-287-13257.

To correct this there have been two trains of thought one to use the built-in BEUtility and the other is to modify SQL directly. I don’t view this as an either-or approach, I view it as a try this first and if not then try that.

First option, use BEUtility. Why, because it’s using the built-in methods provided by Symantec. Run the following options from the utility:

1. Age database

2. compact database

3. repair database

4. rebuild db indices

5. check db consistency.

The second option is to use the SQL Management Studio to manually perform some cleanup. Usually the source of the problem is the BELog table which can grow to gigabytes in size all by itself.

Lets check and see how many records are older than 6 months old:

SELECT count(username) from [BEDB].[dbo].[BELog] where TimeStamp &lt; DateAdd(&quot;m&quot;, -6, getDate());

On larger environments don’t be surprised if it returns millions.

Now lets check and see if this is anything we still need.

SELECT * from [BEDB].[dbo].[BELog] where TimeStamp &lt; DateAdd(&quot;m&quot;, -6, getDate());

Ok, now lets purge logs older than 6 months

delete FROM [BEDB].[dbo].[BELog] where TimeStamp &lt; DateAdd(&quot;m&quot;, -6, getDate());
, , ,
July 9, 2013 at 12:35 pm Comments (0)

IIS website performance tuning

website-speed

After having some free time, to upgrade the underlying hardware running this site along with a few other things. The drive upgrades in particular helped a fair amount on the processing time, however going back and remembering to configure the output caching for IIS was a bigger help. In any event the site should be significantly faster loading for everyone. As IIS output caching is not new by any means, below are some links going over the feature within IIS.

IIS.Net – Configuring IIS 7 Output Caching

IIS.Net Dynamic Content caching

Technet – Kernel-Mode caching

While this feature has been available for years, many IIS websites still haven’t taken advantage of any of the newer features.

, , ,
July 2, 2013 at 7:18 pm Comments (0)

Clearing old Print Jobs

When using Windows Server as a print server over time the queues eventually begin to fill up. Print jobs are sent one day when a printer is offline and days later after the printer is turned back on sometimes dozens of print jobs start coming from the printer. The other issue that arises is caused by this backup of print jobs, slowly the print server will use disk space until in space cases it just runs out. Here is a simple PowerShell script to clear up the stale print jobs.

$TooOld = (Get-Date).AddDays(-2)
Get-WmiObject Win32_PrintJob | Where-Object { $_.ConvertToDateTime($_.TimeSubmitted) -lt $TooOld } | Foreach-Object { $_.Delete() }

This can be setup as an easy scheduled task to take of ever needing to worry about this issue in the future.

, , ,
June 25, 2013 at 11:41 am Comments (0)

« Older PostsNewer Posts »