Messing with hard drives

Hard disk dissection
Copying these isn't that simple

I’ve been randomly offline a lot over the last few days. Partially because I’ve been visiting friends and family, partially as I’ve been migrating hard drives in my laptop. Again.

Currently I run Windows XP and Ubuntu Jaunty Jackalope (9.04) – predominantly the latter, though I keep the former around for a couple of utilities and for checking things when I’m doing support. I’ve also decided I want to install the Windows 7 release candidate I downloaded. However, disc space wouldn’t let me do that without ditching one of the other OS‘s so I turned to Amazon and ordered a 160Gb ATA drive (the largest available in 2.5″ format, I think) and an external caddy into which to place the soon-to-be-spare 120Gb device.

The procedure should be simple with the right tools:

  1. Attach new hard drive via USB
  2. Mirror internal 120Gb onto USB 160Gb
  3. Use some partition software to increase the size of data partition, leaving space for Windows 7 install
  4. Remove 120Gb and swap it with the 160Gb which becomes my internal drive

Of course, these are computers. So it wasn’t going to go smoothly. Especially with the mixed operating systems.

First up, the hard drive enclosure I bought didn’t seem to like the 160Gb drive. If I connected it under Ubuntu, it detected it fine. Windows, however, did not. It “bing”ed to say a USB device had been attached, then never let me see it. Not even through Disk Manager so it wasn’t the fact that it was empty. I couldn’t even create a partition. If I rebooted the machine while the device was attached, the reboot stalled on the BIOS screen.

I disassembled another enclosure I have and tried that with more success. Reboots were fine and the drive was detected under both OSs. Hopefully the new enclosure would have more success with the older 120Gb drive I was soon to have spare.

Next step was to mirror the drive. I tried Paragon Partition Manager’s imaging (which has worked for me in the past), but it kept getting partway through and then rebooting with only a fraction of the drive copied. I began to worry about the new disc, but an attempted surface scan looked like taking 24 hours+.

Instead, I downloaded the (simple and free) Easus Disk Copy program. Burn the ISO onto a CD, reboot with the disc in the drive and away you go.

Slowly. Very slowly indeed.

The initial estimated time was around an hour. The copy eventually took a smidgen under 21 hours.

I had planned on using GParted to shift the partitions around, but it seems it’s not capable of doing this. What I needed to do was to alot roughly half of the increased 40Gb to my FAT32 data partition and leave the rest unallocated so that Win7 could use this when I installed it. So, back into XP and Partition Manager Pro for this task.

Before the repartitioning would complete, I had to run checkdisk on the two FAT32 source drives. On my copy run, it had to come up with read errors. In all, there were 200 and PMP would not continue until these were cleared.

So off I went to play Lego Batman and Guitar Here while the checks and the data migration occured. Finally I had a hard disc with everything organised as required. Phew.

Out with the old, in with the new, reboot… and a screen full of flickering “GRUB“s. No boot menu, no progress. Ah. By moving all the partitions around, I’d shafted GRUB. And possibly the MBR on the boot drive. Here’s where it got technical.

Step one was to repair the MBR and this is where having a bootable CD/DVD with your operating system on is very useful. Laptop manufacturers can burn in Hell if they don’t supply these. If you don’t have one, download it via a Torrent. You’ve paid for a license, there’s nothing wrong in having a copied disc with the software on in case you need to fix it.

Quickly boot off the Windows CD, go to the recovery console, boot into the Windows install on the C: and run one command:

fixmbr

It takes less than a second and on reboot, the PC went right into Windows. A step forward, but still no GRUB so I couldn’t access Ubuntu. Out with the 8.10 CD that I have kicking around, and into a Live session. With a terminal open, the commands to fix things weren’t too hard (thankfully).

sudo grub
root (hd0,5)
setup (hd0)

Well, it would have been nice if it were that simple. First of all, finding the correct partition to use in “root” takes a little digging.

As I’d jiggled things around, what had been (0,4) in my old setup had been changed to (0,5) – this can be discovered by running the command:

sudo fdisk -lu

Assuming you only have one Linux install, only one of these will be labelled “Linux”. Take the number “x” from the left column “/dev/sdax”.

That gave me (0,5) as I used. However, I then got an “Error 12: Invalid device requested” when running the “setup” command. A lot of digging online got me a solution to this. First “quit” out of the grub program to the command prompt again. Then:

sudo fdisk /dev/sda

At the prompt that comes up, enter “w” (no quotes) and hit return. Then repeat the grub commands listed above.

Finally:

sudo gedit /dev/sda/boot/grub/menu.lst

And ensure all the menu entries are correct. As I said, I had to change all my (0,4)s to (0,5)s.

Save, reboot, clap with glee.

Next step is to install Win7, which is tomorrow’s little job. I fully expect to have to repair GRUB again afterwards. Windows (all versions) has a habit of deciding that all other boot loaders are “wrong” and places itself before them. At least I’m expecting it!

Reblog this post [with Zemanta]

Desktop web apps

Mozilla Prism
Mozilla Prism

One of Google Chrome‘s unique (until now) features was an ability to take any web page and turn it into a desktop application. Mozilla have responded with a new Firefox plug-in called Prism which does pretty much the same thing.

The advantages are more screen real-estate (no bars across the top as in a browser) and that the “application” is separate from other web processes. So if one page locks up or crashes, it only brings itself down and not all the other pages you might have open at the same time.

Thing is, isn’t this just the same as opening a new (Firefox, Chrome, IE, Safari…) window via a URL shortcut then opting to display it with no toolbars? Or full-screen? I honestly don’t see anything actually new. Especially given that Firefox 3.5 promises and Chrome already delivers discrete memory use in each tab, so that if one fails it doesn’t down the whole browser.

As for differences between the two, Mozilla have the edge – Chrome is still not available for Linux whereas Prism is, although they don’t make it clear on the standalone application download link.

Reblog this post [with Zemanta]

Waste-of-time site of the day

Conceptis Puzzles
Conceptis Puzzles

OK, I admit I have a lot of spare time at the moment but this site may interest a lot of you – especially those with kids and spare printer ink. Conceptis Puzzles is a free site with loads of logic and classic games on. Layout is good and the varierty of puzzles is excellent. You have the option of printing the games out for play in your own time, or in some cases you can play online. This seems to be being rolled out with some available and some not as yet.

I’m looking forward to seeing more of them available online, and as your progress is saved in your account (free registration and virtually no information to fill in – even the Ts&Cs take up less than a quarter of a page) you can come back to a partially completed puzzle any time. Instructions are well presented with sample videos for some of them as well.

There are, at present, twelve types of puzzle available – five picture and seven number. So if you’re bored of sudoku, have a look and see if there’s a new type that takes your fancy.

I might print out a few of the join-the-dots puzzles for my little cousin. Even they come in three different varieties including multi-coloured ones. A shame they’re not online-enabled as yet (the puzzles and my cousin’s family!).

Reblog this post [with Zemanta]

Step through directories in Linux

Screenshot of a sample Bash session, taken on ...

This is a post mainly to remind myself how to do something that I discovered after a bit of a dig, but it may come in useful for anyone with a repetitive task to do under Linux.

What I had was a flat set of directories, each with a number of files in. What I wanted to do was to go through these and, where the contents were jpegs, archive them into a zip file and erase the jpegs. Then move the resultant zip file up a level into the parent directory and erase the resulting empty one.

I managed to work out a fairly simple solution, although with one failing – it doesn’t take into account directories which didn’t have jpegs in. What I did was move those which contained non-jpegs (there were no mixtures, in this instance – directories were either 100% jpeg or 100% not) into another folder for safe keeping before I ran the routine. This means I could keep the command as simple as possible.

Do note, though, that I specified “rm *.jpg” rather than moving the zip and deleting the directory contents. Just in case I was wrong and a directory had a non-jpeg in it, I specified jpeg deletion. That way, if something else random was in there I could easily see when the directory couldn’t be deleted. If necessary I could then manually edit the resultant zip file and remove the offending item before manually erasing the directory.

Having said that, it wouldn’t have been dangerous to run it as-is without moving them. The command would simply have created archives I didn’t want, failed to have erased the non-existent jpegs, and therefore not have been able to erase the directories in question. “rmdir” cannot erase a non-empty directory without specific qualifiers (-rf, for instance) so the remaining data would have been safe. And I could simply have deleted the unwanted zips. However, as they were often from folders full of large movie files, this would have slowed down the whole process a lot and also have caused possible hard drive capacity issues.

The resultant command was as follows:

for dir in *;do (cd "$dir"; tar -c -z -f "$dir".zip *; rm *.jpg; mv * ..; cd ..; rmdir "$dir"); done

Note that this can also be re-written as a script. Simply line-break it where it makes sense and ditch the semi-colons. Of course, it can also be used as th ebasis for anything else that involves whipping through a flat directory structure.

Before some UNIX guru tells me my solution is inelegant and nasty, I know you’re probably right. But it did what I need and I’m not an expert! By all means, furnish me with something more professional – I’m always happy to learn.

Reblog this post [with Zemanta]

Windows 7 Release Candidate

Windows 7
Windows 7

Well the Windows 7 Release Candidate is available for download. For free. If you want it, it’s a 2.3Gb DVD ISO file and available from this link to the download information page. You’ll need a Microsoft Live ID of some description, if you don’t already have one. Your free license key is linked to this ID so if you lose the key, it’s easy to get it back again.

Note that though it’s a DVD image, it is possible to install it using a USB stick should you not be able to use DVDs for some reason.

As my copy trickles down at a meg a second (!), I’m sat waiting for some kit I ordered yesterday – a 160Gb internal IDE hard drive for my laptop and an external drive enclosure into which I’ll put the soon-to-be-replaced 120Gb drive I’m taking out. Sadly it looks like 160Gb is the largest drive I can get for my laptop due to IDE/ATA being superceded by SATA drives.

Still, the extra 40Gb will be enough space for another partition big enough for Win7 testing. Yes I know I don’t like Microsoft as such, but I still maintain that XP was excellent… up to a point. That point, generally, was about a year of hard use and application installs – and failed uninstalls. The chaff left behind by badly-written apps (and Windows updates) is the biggest problem faced by XP as it slows the system down incredibly and without a lot of forethough and know-how can drag system performance right down.

It’s one reason I prefer Ubuntu right now. It seems to do a much better job of getting rid of this bumph, even going so far as to clearing the /tmp (temp) folder every reboot. In fact, it deletes files on-the-go as it determines you no longer need them, such as if you close the web page that YouTube video’s on. Windows, as far as XP – I can’t comment on Vista as I’ve avoided it deliberately – didn’t seem to understand the definition of the term “temporary”…

Anyway, in a couple of days I should have the equipment I need to mirror my existing drive, add a partition and install the Release Candidate. I guess we’ll find out in a few weeks if I reckon it’s a worthy successor to XP.

Reblog this post [with Zemanta]