Wednesday, December 29, 2010

Linux to the Rescue: Data Recovery

I had a user bring a machine running Windows to me earlier today that wasn't working right. I did something that I've done a bunch of times before to recover the data off of it. Here's what I did.

First I took a live Linux boot disk (I typically use OpenSUSE) and booted from it.

Once it's booted fire up a terminal. Using the live KDE version of OpenSUSE I pressed Alt-F2 and typed 'konsole'. Once the terminal is up type:

cd /dev

then:

ls

look for sdaX where 'X' is number. These are partitions on the first hard drive. If there's more than one hard drive in the machine check sdb, sdc, and so on. In the case from this morning there was an sda1 and an sda4. Being a Windows XP laptop sda1 was the primary partition on the first hard drive and sda4 was the 'recovery' partition put there by the people who put the laptop together. So what we've got to do now is mount that primary partition so we can get at the data. First I needed to created a directory to mount the partition on so I typed:

su

this made me root. There wasn't a password needed because it was a live disk boot. Then:

md /media/hd

This command created the directory to mount the partition on. The next step is to mount the thing. This I did by typing:

mount -o loop /dev/sda1 /media/hd

This mounts the device /dev/sda1 as a loopback device at the directory that was just created in /media/hd.

Once mounted you can go into the mounted partition and get at the data. So...

cd /media/hd
ls

will show you the contents. Now in my case I had a NAS on the network so I could copy the data off to that. I did this by again pressing Alt-F2 and typing:

dolphin /media/hd

This opened the default graphical file manager in KDE and pointed it at the freshly mounted hard drive partition. In my case the data that I was after was in "/media/hd/Documents and Settings/" so I navigated there. Once there I was able to see the files in the user's Desktop, My Documents, etc. folders. At this point I needed the connection to the NAS so I pressed Ctrl-t to get me a new tab in Dolphin. Then I did Ctrl-l so I could type the address I wanted to access. Again, in my case I typed in

smb://username@nas-hostname/sharename

A moment later the NAS responded asking me to enter in the password to access it. I entered it and created a folder by right-clicking-->new-->folder and called in FROM_OLD_MACHINE. Then I went into that newly created folder and flipped back to the first tab in Dolphin where the files that I wanted were. I clicked on the files and folders that I wanted to recover then dragged them to the tab in Dolphin that was showing the folder on the NAS; hovered there for a moment. When it switched over to that second tab I moved the cursor into that folder and let go of the mouse button. I then selected 'copy' and it started copying the files into the folder on the NAS.

As it turned out in this case the fix was relatively straight forward on the Windows side and I didn't need this backup but at least I had it.

Also, I know this wouldn't work if there was something screwie with the filesystem on that partition that I mounted. Never the less, in a large majority of cases where I'm given a Windows machine that won't boot I've been able to recover the data with this method. Even if I do end up having to re-install I've got the data from the original install.

Thursday, December 16, 2010

Time of Use Energy Billing

I just wrote to my MPP Peter Tabuns after hearing about a consultant's report delivered to the Ontario Energy Board that suggested a wider gap between 'On Peak' and 'Off Peak' times. Call me cynical but that sounds like higher on-peak rates rather than lower off-peak rates to me. The print version of the story I heard on the radio can be found at the CBC here.


Hi Peter,
I'm just hearing a story on the CBC's morning show news about a report from a consultant suggesting that there be a greater difference between energy rates depending on the time of use. (http://www.cbc.ca/canada/toronto/story/2010/12/15/ontario-electricity.html)

I don't suppose that the intention is to lower the off-peak time?

I'm concerned because like many I'm employed in a job that I don't have much control over what time I show up at so that tends to dictate what time I'm using energy.

It's kinda funny, I seem to remember reading a book that proposed something radical. Public power at cost. Humm, who wrote that... Howard something. Seems like a good idea. Too bad so many throw their votes away by voting Conservative and Liberal.

Anyway, I just felt that I needed to say something after seeing that story.

Keep up the good work.

kev.

The book I referenced is Public Power by former Ontario NDP leader Howard Hampton.


Later in the afternoon yesterday I got this reply from Peter's office:

Kevin, thanks for passing this along. The price is like a balloon. You
push in on one side and the other side bulges out. Any price change they
make affects all the others. You are in the same position as many -
their ability to change consumption at key times is really limited. Take
care. Peter

Doesn't really change anything. I guess there's a reason it's called 'peak'; because people are using it. Still, pretty good turnaround time on a random constituent's email.

Saturday, December 4, 2010

Farewell Transit City... We Hardly Knew Ye

Earlier this week the new mayor of Toronto announced that he had killed the plan to vastly expand the city's light rail network called Transit City (see the map below for the proposed routes). All the studies had been done and the shovels had gone into the ground. So instead of bringing rapid transit lines to areas all over the city the mayor has elected to go back to the drawing board and start another study; pretty much guaranteeing that it is going to be years before we get to see any substantial improvements to the public transit system. The preference for subways pretty much guarantees that any expansion will not be as extensive as that called for in Transit City. Personally I find this decision disappointing to say the least. Earlier today I went to the site of construction of the first line to say goodbye to Transit City.




Farewell Transit City... We Hardly Knew Ye

Saturday, November 13, 2010

Camp X

In December of 1941 Camp X was established on the shore of Lake Ontario. 69 years later (2 days after Remembrance Day here in Canada) I went there and took these photos in remembrance of some who aren't usually thought of when people think of Remembrance Day:

Camp X

Sunday, November 7, 2010

A November Sunday in Port Credit and Back

Went out to Port Credit in Mississauga this afternoon and took some pictures. I took a couple shots of Diwali celebrations in the Gerrard India Bazaar on my way back. Here's the route I took:


View A November Sunday in Port Credit and Back in a larger map

and the pictures:

A November Sunday in Port Credit and Back

Saturday, October 30, 2010

Walk through the Don Valley

Took my my new camera for a walk through the Don Valley today. Went from the Science Centre down to Gerrard St. It was too bad we had a bunch of wind earlier this week. I suspect it would've been a lot more colourful last weekend but at any rate. Here are the results.

Here's the Map as recorded with the MyTracks app for Android:

View Saturday Walk in the Don Valley in a larger map

And the photos:
Saturday Walk in the Don Valley


kev.

Saturday, October 2, 2010

Resizing the /boot Partition in OpenSUSE Linux

So after a couple of weeks (it was my home machine not a critical production server) of seeing the latest kernel update failing on my OpenSUSE 11.2 system because there wasn't enough space on the /boot partition I finally had to deal with this. Trouble is I had no idea how to deal with this. I've resized /home before but /home is right at the end of the drive array so shrinking it and growing it is relatively easy with the disk partitioning tool in YaST.

So with the help of this article http://www.timelordz.com/blog/?p=456 here's what I did.

From the command line I went into init 1 with the command:

su

Then the root password.

init 1

It'll shut down just about everything running and bring you to a prompt asking for the root password to enter maintenance mode. I again entered the root password then unmounted /home with:

umount /home

Then I brought up the command line version of yast with

yast

and brought up the partitioning tool and changed the size of the partition that gets mounted at /home (I brought it down by 1.5 GB). I've been caught in yast resizing partitions before with not entering the GB (or MB or TB) after the number. It took a while with this operation as the /home partition is fairly large but in the end I had 1.5 GB of unpartioned space.

Once done I went back into run level 5 by typing

init 5

The next step was to create a 1.5 GB partition and following the article in the link above I named it newboot. This was easy enough again using the partitioner in yast.

Once that was done again following along with the article I copied the contents of /boot into /newboot as root

cp --verbose --recursive /boot/* /newboot

The next step was to edit the /newboot/grub/menu.lst file. Trouble was that it wasn't immediately clear to me what to change it to. After a bit of trial and error (not really advisable when dealing with bootloaders I know!) I found that the newboot partition was at (hd0,9) in grubspeek (the old one was hd0,4). So, I got them changed over in menu.lst, crossed my fingers and typed 'reboot'.

When the thing booted I was quite pleased with myself until I realised that it was still booting from the old /boot partition. The fix was easy if a bit scary. I hadn't done the bit from the article where it says to:

# grub
grub> root (hd0,9)
grub> setup (hd0)
grub> quit
# reboot

So again crossed my fingers and typed reboot.

This time it booted but didn't have the fancy grub menu that openSUSE comes with. I then saw that I hadn't modified the gfxmenu line. I changed that to match the (hd0,9) of the kernel image I was wanting to boot from and all was good....

Well, at least until I tried to run the kernel update with:

zypper -n up

It was still erroring out saying there wasn't enough space on /boot to install. So, it's trying to install to /boot rather than /newboot. Makes sense, the standard place for it is /boot. No developer has any idea that I've gone and told my machine to boot from /newboot. So, back into the yast partitioning tool. I changed the mount point of /boot to /oldboot and that of /newboot to /boot saved the changes and rebooted just for good measure.

When the system came back up it booted from hd0,9 as written to the master boot record when I ran the commands at the grub prompt before. This time however the partition at (hd0,9) was being mounted as /boot rather than /newboot. So again I ran the update:

zypper -n up

This time with all the pieces in place the new kernel installed on my new 1.5GB /boot partition.

So thank you Pete Eby for the article that pointed me in the right direction.

Saturday, September 25, 2010

Saturday Morning

It's funny how when you get up at a certain time every day for work when the one day that you've got to sleep in arrives you get up around the same time as you would have the rest of the week.  When I got up this Saturday at around seven in the morning I went for a walk and took some pictures of a Saturday morning starting at Trinity Bellwoods park; walking up to Dundas St. then south along Manning back to Queen St.  I then stopped off at City Hall to see the revitalization construction at Nathan Phillips Square and the roof-top gardens.

Have a look at the album in Picassa here: Saturday Morning

Tuesday, September 21, 2010

Add a Network Printer for All Users

If you've got a windows machine that multiple people log in to and a printer that's shared via windows printer sharing on  the network you've probably noticed that you have to go in to the add printer wizard for each user who logs into the workstation and add the network printer.  There is a way to add the printer globally so that--like a local printer the network printer is available for anyone who logs into the machine.

To add the global network printer log in as a user with administrative rights then open up a command prompt and type:

rundll32.exe Printui.dll,PrintUIEntry /ga /n"\\printServer\printQueName"


(Substitute 'printServer' for the hostname or ip address of your print server and 'printQueName' with the name of the printer as defined on the server.)


Don't worry if there's no output that's normal.  Then restart the print spooler windows service in the control panel --> administrative tools --> services.


That's it.  You're network printer should now be available to all users who log into that machine.


If at some point you want to remove the globally added printer you'll need to re-run the command from the command line.  Just change /ga to /gd then again restart the print spooler service.

Monday, September 6, 2010

TTC Short Turning Vehicles

Hi All,

I thought I'd share a note I just wrote to the Toronto Transit Commission (TTC) after being on 3 street cars that got short-turned within a two day period:



A quick comment about short-turning.  Three times between Sept. 3rd and 4th (once westbound and twice eastbound) and got caught on a car that was short-turned (the westbound one at Bay, and the eastbound one at Broadview) short of the stop I needed.

Now I realize that it could just be bad luck on my part and that there is track construction preventing cars from short-turning at Gerrard and Coxwell but I need to at least ask that for streetcars and buses that aren't malfunctioning please stop short-turning them.  Or at least keep it to a minimum.

When I board a ttc vehicle that says it's destination on the front I'd like to believe that it will make it to that destination.  To be fair it does most of the time.  Or at least as far as I need it to go.  For this route I guess the people who live past Landsdowne in the west or Gerrard in the east experience this more often than I do.  It's always disappointing to hear that box start beeping at the front.

It's easy to get frustrated with the driver but it really has nothing to do with them.  If you agree and want to let the TTC know how you feel please address the right people (http://www3.ttc.ca/Contact_Us/Complaints_Compliments_Suggestions/Suggestions_complaint.jsp) and not rant at the drivers.  Between hauling our asses around the city and dealing with traffic they're jobs are hard enough as it is.  I suspect that drivers don't particularly like being short-turned either.  It's not like the drivers get to go home early when their vehicle gets short turned; they've got to go back 'round the other way again.  If you work for the TTC you may be able to comment on this better than I can.

Friday, August 27, 2010

An Open Letter to Her Majesty The Queen

Okay, as I mentioned in my first post to this blog I started after a trip to Ottawa where I had some thoughts but no outlet for them so let me start with the first and probably most interesting/important--at least in my own mind. One of the most interesting aspects of my trip was the references to democracy by the various guides of the National Capital Commission that were made and it got me thinking... there are 2 aspects of Canadian democracy that I find problematic.

First, our democracy is predicated on an antiquated electoral system (see http://en.wikipedia.org/wiki/First-past-the-post) where the popular vote (i.e., the percentage of votes for a particular party vs. another party) is entirely irrelevant.  And, second that all of our bills which either do or do not become laws in this country have to first be passed through an unelected assembly namely the Canadian Senate.

In the last federal election to the House of Commons one of the Conservative party's election promises was to reform this Senate.  Now although I'm not a particular fan of the Conservative party I have to admit this was an area where I thought we could find common cause.  Several years on no actions have been taken on this matter.  Now I could sit here behind my keyboard and lambaste Steven Harper and the Conservative party for breaking one of their election promises; but I won't for one very simple reason: It wasn't their fault.  No member of the elected House of Commons--regardless of the potential flaws in the electoral system which has elected them--has the necessary authority to reform the "Upper House" including the Prime Minister.

That being said I submit this open letter to Her Majesty The Queen who is the only one (or through her representative in this nations capital the Governor General) who does have any authority over the Canadian Senate.

To: The Private Secretary of Her Majesty the Queen.


Please communicate the following to her royal person.  


I, as a citizen of Canada noting the deficiency in democracy brought about by the electoral system used to elect representatives to the House of Commons where by a majority can be elected to the House by virtue of the riding assignments regardless of the overall popular vote hereby request that actions be taken to remodel the Canadian Senate such that the members of the Upper House be elected by strict proportional representation.


Yours Sincerely,
Kevin Lucas




Okay, maybe a bit drastic and dramatic.  But, there it is.  In one sentence--albeit a grammatically questionable one--the solution to the democratic deficit in Canada.  Think of it.  Really, the Canadian Senate is a rubber stamp on the decisions of the House of Commons.  Senators typically don't do all that much.  They're appointments are political rewards from the leading parties.  


There are only 2 organizations that I can think of that would oppose the election of the Senate by Proportional Representation (See:  http://en.wikipedia.org/wiki/Proportional_representation).  One is the Senate itself.  After all, hey, we've got a good thing going, why shoot ourselves in the foot.  The other is Elections Canada who would end up with extra work.  Aside from those two institutions who would oppose this idea?  Okay, so really it shouldn't be referred to as the 'Upper House' any longer but on an equal footing as the House of Commons but really--practically, the power in Canadian federal political resides in the House of Commons now so what have we got to lose save for an outdated House of 'sober second thoughts' that acts as little more than a 'feel good' connection to the past and a place to put political favorites for the government of the day?


Electing the Senate; and electing them by P.R. makes sense for a modern democracy.  Putting the Senate on a par with the House of Commons makes sense for a modern democracy.  This way we get the best of both worlds.  One of the major problems with Proportional Representation is that there is no locality associated with an individual member (just ask an Italian).  Having one House elected under one electoral system and the other by another just makes sense for a modern democracy.  


Okay, so there's my piece.  It may sound out there a bit but like Michale Moore said "...this is a democracy, we can make any sort of crazy laws we want...."


kev.



Senators Only

Thursday, August 26, 2010

Champlain and the Sun



I may be blowing my own horn but I really like this picture of the statue of Champlain and the sun on a hill overlooking the Ottawa river that I took the other day:


Hot Pepper Packages

I'd like to share a message I just sent via the contact us link at shopnofrills.ca.  Granted it's a small thing but an irritating one, to me anyway.  I'd encourage anyone else reading this to do the same.  If not for me then perhaps for the ecological reasons regarding packaging....

<snip>

Hiya,

Quick comment about the hot peppers sold at Rocca's No Frills (269 Coxwell Ave. in Toronto):  A few months ago the hot peppers (Jamaican peppers and chillies) started to be sold in packages rather than loosely in the produce section.  Trouble is, that I--like I'm sure many people in the area--live on my own and even though I like to cook spicy foods I really can't do much with a package of 8-10 scotch bonnets.  Inevitably the left over peppers rot in my fridge (or my curries end up so hot as to be inedible).

For the most part this isn't a problem as the store is located next to a large Indian bizarre with lots of other stores selling individual peppers but it would be nice to be able to buy all the ingredients I'm looking for in one spot.

Would it be possible to start selling the peppers loosely again?

Thanks in advance.
kev.
 
I realise that the No Frills stores are franchises (or are otherwise operated at arms length from Loblaws and PC and whoever owns and operates the website) so please forward this message as appropriate.
</snip>

Now I know, I know.  Perhaps I should be buying all my ingredients in the Bazaar anyway and forgetting the big corporate grocery store.  Well, at least corporate affiliated.  After all as far as I can tell they're a franchise.  Hold on, I'm getting derailed <picks up train of thought and put's it back on the rails>.  Trouble is that the afore mentioned Jamaican peppers aren't typically available in the Bazaar; at least I've never seen them.  But they are tasty for doing West Indian dishes.

Okay maybe I should haul ass to the nearest West Indian grocer for them but I don't know of any in the area. Any suggestions?  Or maybe they should just go back to selling the peppers individually like they used to.

kev.

Hi All

Hi All,

I just got back from a trip to Ottawa last night.  I just went on my own and did some sightseeing.  I found thoughts and ideas occurring to me while I was there and I realised that I didn't have a platform to put them out there.  Well, at least not if they're more than 140 whatever characters (I am on Identi.ca and Twitter)  After all a thought (good, bad or indifferent) is useless if it stays in your head.

So, that being said, go ahead and get those thoughts out of your head.  And welcome to my blog.

P.S. You may be wondering about the 'yu210148'.  Like many I went to York University in Toronto and while there was assigned an email address.  At the time--I graduated in 2002--named ones were reserved for faculty.  Undergrads like myself were assigned numbers prefixed by 'yu'.  I've stuck with it for most of my online stuff simply because it's unique and usually available as a username.  Even here I tried a couple of different variations of my name when signing up and of course they were taken.  It may not be the easiest thing to remember but that's why there are bookmarks (favourites if your speak IE).

kev.