Solved Unmount when device is busy

On ubuntu servers trying to unmount a frozen nfs mount, I see “device is busy”.

When I try ‘df’ I see an Input / Output error for this partition.  When I try ‘ls -la’ I see question marks ? where information should be.

To get it unmounted I used the first comment on this page;

umount -l /dev/sdwhatever
umount -l worked like a charm.  Note that the original post with fuser cmd didn’t work for me.

After unmounting, I was able to remount it right away without any error.

Posted in Uncategorized | Leave a comment

Resolved: My Tortoise CVS icons disappeared!

After installing DropBox, my CVS icons disappeared. Here is where I found a good summary and potential solutions to the problem. In my case the solution was simply to remove the DropBox program, and voila.

Posted in Uncategorized | Leave a comment

Adjust Nav spacing in WordPress Twentyeleven

Depending on how many pages you have, your navigation might not (probably won’t) line up evenly.
To fiddle with it, i add this to my custom theme’s style.css file and vary the number (15) until it looks right:
.page_item {
margin-left:15px;
}

Posted in Uncategorized | Leave a comment

Connect WordPress to a second database

While building a wordpress site and needed to work with a separate existing database.
Added a function in wp-includes/functions.php like this:


function my_query($sql){
$db = @mysql_connect("my_DB_host", "DB_usr", "DB_pass");
mysql_select_db("my_other_database");
$result = mysql_query($sql) or die('Did not get required database result');
return $result;
mysql_close($db);
}

Then wherever I need to connect to this database I can use the function like this:


$sql = sprintf("SELECT blah FROM table");
$result = my_query($sql);

Posted in Uncategorized | Leave a comment

Reboot Windows XP via Remote Desktop

I work on remote machines fairly often. Sometimes a software install will ask for a reboot. But when you click the “Start” button, the options aren’t there!

Right click on the task bar at the bottom and go to task manager, look for the menu named ‘Shutdown’ and choose ‘Restart’

that’s it!

Posted in Uncategorized | Leave a comment

Convert MSSQL dates to MySQL

I’m moving a database from MSSQL to MySQL, I was cruising along with CSV files until I hit a table that has some date columns. They weren’t showing up right no matter what, until I found this post:

http://abbyandwin.net/blog/2007/08/14/how-to-convert-mssql-date-format-to-mysql

Here’s the query to run on MSSQL:

SELECT CONVERT(VARCHAR(40),[date_column_name],120) AS new_date_format FROM [table_name]

Thanks Abby & Win!

Posted in Uncategorized | Leave a comment

How Long does it take to copy VMs with VMWare vCenter Converter Standalone?

Still considering whether it will be worth purchasing vCenter software, for now I am getting by with the free tools supplied by VMWare. To clone a new VM from one ESXi host to another, I powered it down and used vCenter Converter to do a VM to VM copy.
The VM I’m copying was about 350GB. When I launched the Task, the Estimated time was 1 hour. After the progress achieved 1%, the estimated time jumped up to 1 day, 18 hours. It remained there as progress reached 2% about an hour later. I came back the next morning about 15 hours later, and the conversion was completed successfully. Very glad it didn’t take more than 1 day or I would’ve had to stop the process and find another way.

Posted in Uncategorized | Leave a comment

Moving Repository: cvs checkout: Codepage transformation not supported by server. Results may not be correct

We have a CVS repository on linux and Tortoise CVS users on windows. Sometimes we need to move our repository and users start seeing the subject error. Wasted time looking into it, has to do with UTF-8 stuff going from linux to windows… Apparently it can be safely ignored in the modern versions of Tortoise CVS, don’t waste your time with it!

Another issue with the CVS move is changing all the CVS Root files to reflect the new hostname; this blog post has the right answers. Created the changeroot.sh file and updated our newly located branches to know where they belong.

First off we need to change the CVS Root for the working copy. Here’s the script that will do the job:

#!/bin/bash
# Test whether we got an argument for the new CVS Root value - exit if not
# -z is a bash conditional experssion that returns true
# if the has a zero length
if [ -z "$1" ]; then
echo "

You must supply a new value for CVSRoot
usage: $0

Examples:
To change to an external repository accessed via ssh:
./changerepository.sh :ext:crb@webdevcvs:/Users/Shared/cvsrep

To change to a local repository:
./changerepository.sh /Users/Shared/cvsrep
"
exit
fi
# if we were passed a new CVS Root value on the command line, assign it to
# the newRoot variable
newRoot=$1
# walk the current directory (find . ) and if the path matches */CVS/Root,
# slap the new CVS Root into the files found
find . -path "*/CVS/Root" | while read f; do
echo $newRoot > $f
done

To run this script and change the root, copy and paste the code into your favourite text editor, save it as changeroot.sh in the root directory of your working copy and chmod it to be executable. You can then run it using

./changeroot.sh [newcvsrootvalue]
Where [newcvsrootvalue] is the name of your new CVS Root, for example:

./changeroot.sh :ext:me@newrepository.net:/usr/local/cvsrep
If its just the host name of your repository that has changed, you’re done

thank you solarorange 🙂

Posted in Uncategorized | Leave a comment

How To Install HandBrake Command Line Version on Ubuntu Server 10

Handbrake is a great tool for encoding video. Best of all it is open source and free. If you are running Ubuntu server, here are the steps to install it quickly and painlessly!

$ sudo su
# apt-get install python-software-properties
(hit Y to continue)
# add-apt-repository ppa:stebbins/handbrake-releases
# apt-get update
# apt-get install handbrake-cli
# HandBrakeCLI -u
HandBrake 0.9.6 (2012030100) – Linux x86_64 – http://handbrake.fr
Your version of HandBrake is up to date.

Find your encode settings then start encoding, woohoo!

Posted in Uncategorized | Leave a comment

Format USB on Ubuntu Server

I have a brand new USB drive and I want to backup some contents on my server. I hooked up the drive and type “mount -t ext3 /mnt/usb /dev/sdc1” but the drive is not formatted so this gave me an error.

The steps to format the new USB from Ubuntu server command line are as follows:
type “dmesg” to find / make sure you have the correct drive letter (in my case, sdc)
type “fdisk /dev/sdc” (this returns a menu listing)
type “n” for new
type “1” for partition number and use the defaults for start and end points.
Then type “w” to save the changes.
now to format the new partition, type “mkfs -t ext3 /dev/sdc1”
then the mount command works.

Posted in Uncategorized | Leave a comment