| Huvudsidan | Blog | Kontakt | English | Wordpress widget |

Backing up Windows to computer with SSH

Sunday 20th August 2006 (viewed 21608 times)

Working on the computer department, UNIT, of the University of Linköping taught me many things, but one of the most important was the following:

To create backup of your data!

There were numerous disasters averted by having backups, I tell ya! When I started working there, there were hardly any backups at all. When I left the place, we had a backup robot.

A backup robot is perhaps not the best solution for your home needs, but there are other solutions you can use. Since I run Windows at home and have access to a Linux-server, I chose the following solution:

Rsync over SSH

Rsync is a program to remotely synchronise files between two computers. SSH stands for Secure SHell and is a protocol which specifies how to connect to another computer with a crypted connection, which also allows you to transfer data, such as files, without having others listen to your traffic, especially people who might have malicious intentions.

Step 1: To help me with this task I installed cwRsync, which is a package that contains Cygwin and Rsync software. Cygwin is a UNIX-like enviroment for Windows, which allows you to run UNIX-like programs, such as Rsync. cwRsync comes with an installer, so you proceed installing it as any other windows program.

Step 2: I created a file that contains the directories I wished to backup from my computer. I named it standard_backup.cmd, which I placed in the cwRsync installation directory, and it looks like this:

@ECHO OFF
REM A cmd-file to create backup of my files! /Mika, 2006-01-08

SET CWRSYNCHOME=C:\PROGRAM\CWRSYNC
SET CYGWIN=nontsec
SET CWOLDPATH=%PATH%
SET PATH=%CWRSYNCHOME%\BIN;%PATH%
set HOME=C:\Program\cwRsync\bin
REM set CYGWIN=binmode tty
REM set TERM=ansi
set USERNAME=mika
set RSYNC_RSH=ssh.exe

rsync -e ssh -av –delete –rsync-path=/usr/bin/rsync “/cygdrive/C/Program/cwRsync” mika@remotehost:backup/
rsync -e ssh -av –delete –exclude=Bilder –rsync-path=/usr/bin/rsync “/cygdrive/D/Filarkiv” mika@remotehost:backup/

This assumes that cwRsync is installed in C:\Program and that your name on your remote host is mika ) You can easily change those parameters.

The rsync parameters are quite easy. -e stands for what program it should use to connect to the remote host, ssh in this case (this comes in the cwRsync-package). -av stands for archive and verbose, which means I want it to make a copy of my current directory structure on my computer and to display information about the sync-process when I execute it. –delete says it should delete the files on the remotehost which have been removed on my computer. –exclude is very handy to exclude directories/files with certain words. I exclude my images-library since it’s too big. I backup that via DVD-RW instead. –rsync-path is where the rsync-program is located on your .

After that you specify the directory to backup. The notation for this is /cygdrive/”disk letter”/path. As last parameter you specify the remote directory, using SSH-notation which is username@remotehost:remotepath.

Step 3: If you don’t want to enter your password on the remotehost everytime you do a backup, I recommend to create a public-key that you copy to your remotehost. This you do by fireing up yor cmd-window and going to your cwRsync-directory: cd C:\Program\cwRsync\bin\. While there, you execute the following:

ssh-keygen -q -b 1024 -t dsa -f identity -N ”

This will create a file called identity and a file called identity.pub. I created a directory called .ssh in the cwRsync/bin-directory and put these files into it (needed for ssh to correctly find them). The content of identity.pub you have to copy to a file on your remotehost called .ssh/know_hosts.

Then you need to establish the first connection to your remotehost via SSH to get the host approved:

  1. Fire up a cmd-window
  2. Go to the C:\Program\cwRsync\bin-directory
  3. Execute: ssh username@remotehost
  4. Answer yes to the question that pops up about allowing connection to that host.

If everything is set up ok you should now be logged onto your remotehost.

Step 4: Create your first backup. Do this by:

  1. Fire up a cmd-window
  2. Go to the C:\Program\cwRsync-directory
  3. Execute the standard_backup.cmd file

This should start the backup of your files!

If you’re like me, lazy, you will find it tedious to fire up the cmd-window and change directory to the cwRsync-directory. I searched for good solutions for this, and the one I found was to create a shortcut of the cwRsync-directory on my desktop and then install the Windows XP PowerToy named CmdHere. This allows you to right click on the shortcut on your desktop and choose ‘Open Command Window Here’, which saves you the trouble of changing directory )

Hope someone finds this whole approach, or some of the information in it, useful )

Technorati Tags: , , ,

Modified: Wednesday 6th September 2006

Fixing my bike

Tuesday 15th August 2006 (viewed 5351 times)

Last week I discovered that I my bike had a flat back tire. This prompted me to look at my tires and I saw that both of them were pretty worn out. The tires were almost on the verge of breaking down completely! Especially the front one.

Ah, well, having no time to fix them, I put off the work for a whole week, and this morning I got upset about having no bike to run my errands with, since it would take me the whole day to run all my errands by foot or bus! So I decided promptly to fix them, even though I had to skip my workout, and that made me feel annoyed.

The first thing was to get new tires. I went to the local bicycle repair man (Bicycle Repair Man!), who has his shop only 50 meters from me, and bought myself two new sets of both inner and outer tires. I got a chock from the price. 400 kr for all of them! “Maybe”, I thought, “maybe it’s not that expensive after all? Maybe this is how much tires cost nowdays? Maybe they’re special tires that will last longer than the last ones? Maybe I’m so used to buying cheap stuff that it only looks expensive?”. That, and I really wanted to get my bike fixed today, made me buy them. But I was feeling alot vexed!

The front wheel came of easily and in a matter of minutes I had a brand new tire on it! Then came the back wheel… I usually fix my bike myself. From exchanging the chain, or hand breaks, or saddle or anything else that breaks down, or needs to be replaced, so I’m used to taking off the wheels and tires and know all the right moves to apply… until… until today. Today I ran into the Rust From Hell, when I tried to remove the last nut.

I used all my force and even a hammer to try to remove the nut, but it didn’t budge an inch. Finally I managed to get the wheel itself off by hammering on the bolt that the nut was stuck to. But the nut still stuck there, and I had to get it off or I wouldn’t be able to put the tire back!

Somewhere here I almost lost it. I was ready to send Hellspawns to tear the limbs off from anyone who was involved in designing my bike. I was ready to call forth the Hordes of the Undead and unleash them on anyone who so much as glanced in my direction! I was ready to scream until heaven wept and dead angels fell down on the earth, and the earth itself buckled, spewing out lava, starting earthquakes that shattered the cities and then sell my soul for the Legions of Hell to come forth and torture everyone to death!!! But I ended up taking my wheel to the bicycle repair man to see if there was anything he could do.

After waiting in line for 10 minutes it was finally my turn. I showed him the wheel, pointed at the nut, and he said: “Oh, so that things jammed, eh! One moment.” I followed him to his workshop where he applied some rust-be-gone spray and Lo and Behold, the nut came off! And he didn’t even charge me! Pweh! Was I happy that I hadn’t sold my soul to make the earth a living hell!

It took me only a few minutes to get the wheel back on and suddenly I was done! Without anyone ending up dead! Wuhuu! The next big surprise came when I tested the bike. It practically flew forward! I had no idea how much resistance a pair of almost broken down tires can offer someone riding a bike. Now I know! These new tires, packed with air, make me swooosh around the city with almost no effort! The only downside is that it now takes me only 10 minutes to bicycle to the Dojo, instead of 12.5 minutes, which means less exercise to enter into Funbeat)

Technorati Tags: , , , ,

Modified: Wednesday 16th August 2006

Upgrading wordpress

Wednesday 9th August 2006 (viewed 11393 times)

WordPress 2.0.4 was released 11 days ago, and I noticed it first time today! Naturally I plunged myself into the work of upgrading! Here’s the steps I took. Primarily I write it down here for my own future reference )

cd public_html
wget http://wordpress.org/latest.tar.gz
cp -a wordpress wordpress.backup
mysqldump -u root wordpress > wordpress.backup/wordpress.db

# Verified that the wordpress.db file looked ok!

# Went to my blogs admin page and turned all the plugins off.
# I currently use the following:

Akismet
Browser Sniff
Gravatar
LiveCalendar
More Smilies
SimpleTags
Sidebar Widgets
Executable PHP widget
Fuzzy Recent Updates
Simple Recent Comments Widget

# Packed up the latest release

tar zxvf latest.tar.gz

# Then I reactivated all the plugins. No problems there. The
# only thing I had to adjust was that More Smilies defaulted
# back to the Default instead of my smilies )

WordPress 2.0.4: http://wordpress.org/development/2006/07/wordpress-204/

Technorati Tags:

Visited Countries – Where have you been?

Wednesday 2nd August 2006 (viewed 5247 times)

Found this nice site on the web, where you can enter all the countries you’ve visited and get an image that shows it ) I’ve visited 12 countries, and according to the map-creators that is 5% of all the countries in the world. Once I had a dream of visiting atleast one country on each continent. I think I’ll hold onto that dream!

Here’s what my map looks like:

Worldmap

Create your own visited countries map

Technorati Tags: