Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been running a BlueQuartz CentOS 4 system (Nuonce.net distro) for a few years now and although the hard drive (Deskstar) has always been a bit noisy, on a few recent occasions I've heard it having trouble spinning up. Basically, I want to clone this drive to a similar sized one (80 Gig).

I've spent many hours reading upon dd, dd_rescue, rsync, clonezilla and LVM mirroring yet the sheer number of options and nightmarish accounts has left me frozen - unable to make an informed decision as to how to start.

I've made a few attempts. dd failed after about 2 hours, as, although the drives appeared to be identical on the surface (ATA Seagate Barracudas, Thai not Chinese), the destination drive is slightly smaller.

My most recent attempt involved using a Debian CD to format the new drive and then rsync-ing everything over and editing the new drive's grub and fstab to reflect the changes. No joy here either as I hadn't chosen LVM when partitioning the destination drive and it wouldn't boot.

As you can probably tell, I'm out of my depth here and a panic-invoking mixture of caution and frustration has prompted me to sign up here.

The server itself, although not strictly a production environment, has a very specific installation of Festival, LAME and ffMpeg and provides the back-end for a Text-to-Speech jQuery plugin that I've built over the last 2 years. I'm also planning to rebuild the whole TTS system on Debian as the existing CentOS system still has PHP4 etc.

For now though, I'd really like to just shift everything over to a new drive.

As this is my first post, please feel free to lay any house rules on me that I might've overlooked; I've been hovering around StackOverflow for a while now but have only just signed up.

Many thanks.

Update:

Thanks for your responses so far - it's much appreciated and makes me feel a little more confident when I can double-check things here.

I had the idea of doing a fresh install of CentOS (from the original disk) on the new drive so the partitions and LVM were all set up correctly (after disconnecting my source drive to prevent painful mistakes).

I then booted into rescue mode from the same CD, and, to avoid a conflicting label, changed the /boot partition's label using e2label to /bootnew. I then changed the VolGroup name using lvm vgrename from VolGroup00 to VolGroup001. I could then boot with both drives in.

After mounting the new drive (via its VolGroup001 alias) into /newhd, I rsync-ed over everything I could to the new drive, using -avr switches and backslashes. Like mentioned here.

I then disconnected my original source drive again, booted from the liveCD again, changed back the boot partition label from /bootnew to /boot using e2label and then renamed the VolGroup back to VolGroup00. I then rebooted and it went through the familiar start-up routine only to not find a host of files in proc, usr, lib, var etc.

The boot did complete but there were lots of red 'FAILS'. I could log in with my existing creds, but the network was kaput, I couldn't startX (desktop GUI) and there were also a few (a lot) of error messages pertaining to iptables. Back to square one. I naively thought I'd nailed it.

Shall I just buy a bigger hard drive and attempt the dd route? I've read that this can mess with LVM setups and there's the added risk of working on two unmounted drives at once with a low-level tool.

Thanks again.

share|improve this question

2 Answers 2

dd failed after about 2 hours, as, although the drives appeared to be identical on the surface [...], the destination drive is slightly smaller.

Well, there's your problem. If you get a destination drive that is at least as large as the source drive, then a drive-to-drive image with dd should work like a champ---unless your source drive has bad sectors. For the best results, you really need to image the drive while all of its partitions are unmounted, which means you'll want to boot from alternate media, like a CD/DVD-ROM or USB key. I like System Rescue CD for just this sort of work.

If your source drive does have bad sectors, then you'll need to resort to tools like ddrescue or dd_rescue (yes, they are different) that are able to work around disk sector errors. The aforementioned System Rescue CD includes dd, ddrescue, dd_rescue, and many other disk and filesystem imaging tools, besides.

share|improve this answer
    
I've just downloaded the System Rescue CD you mention and shall put it to use. I'm going to pick this up later as I don't want to work on it whilst tired. Cheers. –  Hegelworm Jan 29 '11 at 12:11

Depends on what you're trying to do. Completely mirroring a drive, blocks 'n all, is a job for dd, and not for the faint of heart; the drives will need to be block-for-block identical in size for that to work, and it's not an especially friendly tool to work with.

That said, if you've got the majority of your data (hopefully everything except /boot) in an LVM Volume Group on an LVM Physical Volume partition, then you can easily drop in another drive, add it as a new Physical Volume to your existing volume group, and then pvmove the LVM physical extents from the old drive to the new. See 'man pvmove' for details. You'll still have to deal with the contents of any non-LVM partitions by either dd or a straight-up logical copy.

Hope this helps!

share|improve this answer
    
Thanks for these replies - I've updated my original question with my progress. Is this the right way to respond on here? –  Hegelworm Jan 29 '11 at 11:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.