Thursday, August 9, 2007

How SMART am I?

So I started getting a SMART error on my main hard drive, which means it is on its way out:



SMART Failure Predicted on Primary Master

WARNING: Immediately back-up(sic) your data and replace your hard disk drive. A failure may be imminent.


Scary enough, eh? I think it mostly has to do with the fact it is pretty hot in my office these days, now that I've moved it all the way downstairs. It stopped complaining for a little while, but then started again, so I hurried my replacement steps. Although reading the Wikipedia entry makes me wonder if it really is that big a deal? Maybe I'll use it as a backup drive or something.



Hardware-wise, it wasn't too big a deal. I have an old 800mhz overclocked machine (my Frankenstein machine) that I had pretty much given up on. In it, there are two 160gb hard drives, so I had plenty of disk options. So I cannibalized the Frankenstein machine and off to the dumpster it goes.



One thing I had hoped to use from it was the PC133 memory sticks. It had 768mb of RAM (3 256mb sticks), and my Asus P4S533 motherboard said it could take two DDR sticks and two DIMM PC133 sticks. As I've been limping along with "only" 1gb of RAM, I've been looking to upgrade for a while now. So I figured I would throw in two sticks and get up to 1.5 gb anyway. But no such luck. After I put in the sticks, it was only reporting that I had 512mb of RAM. So I looked more closely at the manual, and there, in small print, was the warning that you couldn't mix the memory types. Oh well, back to 1gb.



Lucky for my hard drive problem, I had one more slot for a hard drive and two more IDE connections via the Promise IDE controller. So after much squeezing and pushing, I wedged one of the 160gb hard drives into the case and proceeded to try and figure out how to best copy my failing partitions.



My first thought was to just format the partitions and use 'rsync'. But of course, that wouldn't work with my NTFS and my DOS partition. I have four partitions on the disk:



sudo /sbin/fdisk -l

Disk /dev/hda: 164.6 GB, 164696555520 bytes
255 heads, 63 sectors/track, 20023 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 261 2096451 6 FAT16
/dev/hda2 262 6629 51150960 7 HPFS/NTFS
/dev/hda3 * 6630 20023 107587305 f W95 Ext'd (LBA)
/dev/hda5 * 6630 10453 30716248+ 83 Linux
/dev/hda6 10454 20023 76870993+ 83 Linux


So looked into some partition copying software. It seemed like there were four possibilities:





Funny, while I was looking at this, I noticed a small article on Distrowatch comparing the GParted LiveCD and PartedMagic, I figured I'd also look into GParted, which I was going to use to originally partition my disk anyway. So I booted the GParted cd, repartitioned the new drive to match the old one (well, sort of, as the new one is 160gb and the old one "only" 120gb). Then I noticed you could copy/paste the partition right there in GParted, which I hadn't realized before, so I tried that. It took quite awhile but seemed to work. I rebooted into openSUSE, and /dev/hde looked pretty much like a copy of /dev/hda, which was good. The NTFS partition, however, didn't seem to copy very well.



So I decided to check out Clonezilla, but that experiment didn't last too long, as it refused to boot. A couple of lines of it uncompressing the image and then just hang city. So I tried the SystemRescueCd, which includes GParted. I had a problem with the refresh rates being beyond the ken of either of my monitors, but I tried the Ctrl-Alt-Keypad + trick to change the resolution and sure enough I eventually found one my monitors could deal with. It seems nice, but I'm not sure what it adds to the GParted package, so I tried PartedMagic. It too had a refresh rate problem, so I had to Ctrl-Alt-+ until I found a working one. But it is a pretty nice setup, as Distrowatch mentions. For whatever reason, GParted seemed to work slower on both SystemRescueCd and PartedMagic than on the GParted LiveCD. But still, all three are nice weapons to have in the rescue kit.



But none of them really made it clear to me what I should do next, so I went back to GParted and did the copy / paste thing again. It seemed to work a little better, and so I decided to play some GRUB games and see if I could get the /dev/hde partition to boot. I used the YaST->System->Boot Loader, but the "Suggest Configuration" option just generated a weird menu.lst file, so I didn't use it. Instead, I just copied the boot item for the /dev/hda5 openSUSE partion, changed the root options and booted away. My new entry looked like this:



title XEN -- openSUSE 10.2 - 2.6.18.8-0.5
root (hd2,4)
kernel /boot/xen.gz
module /boot/vmlinuz-2.6.18.8-0.5-xen root=/dev/hde5 vga=0x317 resume=/dev/hdb5 splash=silent showopts
module /boot/initrd-2.6.18.8-0.5-xen


But that didn't really work. It was weird, because the new partition, despite being on the third hard drive, insisted on being call /dev/hda after I booted it. After I changed the root= back to /dev/hda5 (which seemed weird), it would actually boot. I even created a test file, and sure enough, when I booted back into my original openSUSE, the test file was on /dev/hde5. So the drive letters aren't necessarily the "first" drive found (as that is the dying one), but the boot drive. So I went back into GParted, recopied the partitions, and started again.



This time, it seemed ready to try and boot. Oh, I also played some games with Super Grub Disk, which puts a prettier front end on GRUB, as I couldn't seem to get the boot to work correctly. But that just seemed more confusing that the grub commandline, so I gave up after it trashed the MBR for my BootITNg boot manager. After I removed the dying one, and plugged the new one into the old spot, I rebooted. Due to my Super Grub messing around, it booted directly into my openSUSE menu. I picked the default option, and voila, I was into my replacement openSUSE. Woo Hoo!



But my elation was short lived when I re-installed BootItNG. When I selected my openSUSE partition, I got the dreaded "GRUB..." in to the top left corner, then nothing. So I tried to find my page that told me how to re-install grub onto the openSUSE partition, but they seemed to have gone and ruined it on the Ubuntu wiki. There was a very short, concise, formula for installing GRUB onto any ol' partition, but now it has pages and pages of verbose instructions with nary a word as to what is going on. But I dug deep into my Google-fu and found the correct instructions. They are actually pretty straightforward, so I booted the PartedMagic CD, went to the commandline, and:



# grub
grub> find /boot/grub/stage1
(hd0,4)
(hd1,5)

grub> root (hd0,4)
Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0,4)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0,4)"... failed (this is not fatal)
Running "embed /boot/grub/e2fs_stage1_5 (hd0,4)"... failed (this is not fatal)
Running "install /boot/grub/stage1 (hd0,4) /boot/grub/stage2 p /boot/grub/menu.lst "... succeeded
Done.

grub> quit


The first line finds all the partitions that have GRUB installed on them. The second line sets GRUBs root to a partition. The third line tells it to install the changes into the correct partition (as opposed to hd0, which overwrites the main MBR again). Then you quit and reboot. Once again, I was back in business.



So the end result was really just to use GParted. Like I said, I thought the GParted LiveCD seemed to work faster, although I'm pretty sure all the rescue CDs had the same version of GParted. I liked PartedMagic as a rescue CD and will continue to use that. Windows XP booted okay, but now it is hanging somewhere, so I'm not sure what to make of that. I just boot into it to play games, but I need to figure that out.




No comments:

Post a Comment