Linux Server Diary

The trials and tribulations of a Linux newbie trying to setup a home server.

Saturday, February 23, 2008

Replacing the Hard Drive

As I mentioned in the last post, I've been having troubles with the hard drive on my server. After receiving a shipment from NewEgg, I'm ready to install a new drive. I found this page from Encodable Industries the other day that outlines a way to transfer the files and boot from the new drive.
I find it disturbing that I'm sometimes ables to access the drive without difficulty. Since the new drives arrived, I haven't seen an error on the old one. I hope that the drive is problem, and not something else that will continue to bother me once the replacement is complete. We'll see.
Anyway, I connected the new drive the same way I've used a CD ROM drive in the past, making the cable connections with the drive resting on top of the opened case. Not the most elegant solution, but it works.


Next, I booted to the old drive, and ran partman to partition the drive. I wish I would have documented what commands I ran, but I can say that I ended up with a large ext3 partition and a small swap partition. Just what I needed.
Interesting note: After a power reset following the partition, the machine wouldn't boot. The reason was that the BIOS was trying the boot from the first drive found, and the new drive is slave on the first IDE interface, while the old drive is primary on the second. A quick BIOS reconfiguration took care of it.
Next, it was time to mount the new drive. As root, I created a mount point
sudo mkdir /mnt/newdrive
And added a line to fstab to make the connection:
/dev/hdb1 /mnt/newdrive ext3 defaults 0 0
Finally, I remounted all connections
sudo mount -a
With both drives connected, operational, and mounted, it's time to copy the contents from old to new. The Encodable page linked above gave me this rsync command that will do the deed:
rsync -av --delete --exclude /mnt/newdisk / /mnt/newdisk
(Several hours later)

All of the files copied to the new drive without incident. Still, I'm worried that the old drive isn't really bad, and that something else is causing the problem. Finally, after a couple more hours of accessing the drive, I finally got a failure. Time to move on.

Next, I removed the ailing drive and replaced it with the new one. To boot to a CD, I connected an old CD ROM drive where the new drive had been hanging. After a little experimentation, I found the steps I needed to get things going.
Boot to a Ubuntu 7.04 Live CD
Open a Terminal Window
Fix GRUB using the method outlined in an earlier post
Mount the new drive
sudo mkdir /mnt/hd0
cd /mnt/hd0
sudo mount -t ext3 -o defaults /dev/hdc1 /media/hd0
(use your own partition name)
Get the UUID for the main partition
CD to /dev/disk/by-uuid and find the entry
Modify menu.lst and fstab to use the correct UUID
Do the same to update the UUID for the swap partition in fstab
Reboot and enjoy the new drive

I've been using it for the past several hours without incident. I'll let things burn in for a few days before calling it done.

Next time, we install the other new drive in the backup server. Stay tuned!

Labels:

Saturday, February 16, 2008

Hard Drive Troubles

The hard drive in my server (this blog's namesake) seems to be going down for the count. It works for a while, but then gives errors and requires a power off and on to come back to life.

It is times like these where a man learns if his backup procedures are sufficient. My grade on this exercise is maybe a B-. Here's the status:

The directories setup for each member of the family, plus the one containing photos are backed up fine. I was able to grab a second copy of all of this from the ailing disk that I put on some spare desktop space. This is the stuff that would be difficult to replace (although all of the photos - save the past month - are also backed up to DVD and stored offsite).

Our music files, some 15GB, are not included in the nightly backup because of disk space reasons. Most of the files that I've put there are backed up at work. Many others come from CDs in the house. Losing these files would not be horrible, but it would be a pain to reconstruct. Plus, my kids don't backup their music, so that stuff would be lost. (Most of their stuff wouldn't be a big loss, in my opinion) I was able to copy all of this to another location.

I'm also a podcast listener, and I have a big cache of unlistened to files. Since I don't really keep track of what I move to the MP3 player, I'd have to guess a new starting point for each podcast. Once again, I was able to suck these files off the injured soldier.

Amongst these podcasts are downloaded TV shows that I haven't yet watched. I'm trying to copy these now, but I've been through a couple of reboot cycles without getting them all. The fact that they are large files (250MB+) doesn't help.

Here's the tough part, the system files and configuration don't seem to be backed up. Not sure why I left that stuff out of the backup routine. While I have good notes in this blog on my decisions and steps, it will take a lot of time to reproduce once the drive is replaced. Hopefully, I'll be able to keep the old drive working long enough to copy the files over. I've found a website with instructions to help this process (recover disks, grub configuration, and UUID changes are involved). Of course, I may want to upgrade to a newer Ubuntu version. We'll see.

Labels: