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 have a machine running Ubuntu Server that has been presenting some HD-related problems. Instead of reinstalling and reconfiguring everything (and to save time) we'd like to copy everything from the current hard drive to a new one and start using it. We only have a single hard drive with a main partition and a swap partition.

What tools or methods would you recommend for replacing a hard drive with minimum difficulty and chance of problems?

Thank you.

share|improve this question
    
Are you using LVM? Post the output of fdisk -l and vgdisplay. Is the new hard drive already in the machine? –  Steven Feb 12 '11 at 18:08

4 Answers 4

  1. Boot up the server from some liveCD
  2. Dump the entire harddrive image to other host (you can use dd and netcat for that) or tape
  3. Change the harddrive
  4. Restore the image on that new harddrive.

But the real solution would be: Never use single harddrive in any server. On every new installation use raid+LVM to be prepared for inevitable HD replation. For this particular system - reinstall it using at least two harddrives and RAID on them.

share|improve this answer

I have done this numerous times and always with the following steps.

  • Boot linux from a livecd.
  • Mount the filesystem.
  • Make a backup of the filesystem (tar czf mybackup.tgz /) to an external disk
  • Replace the hard drive
  • Boot linux from livecd
  • Format new drive with a root partition and a swap partition
  • Unpack the backup onto the new root partition
  • reinstall the boot manager (i assume grub)

The tricky part is the last one: reinstalling the boot manager. This can sometimes give problems. If you use the livecd from the Ubuntu version that is installed currently on the disk, it shouldn't give any problems though.

share|improve this answer

This is going to sound obvious sorry but you'll need to back it up, then either install the base OS and restore or boot from a live CD and restore. It depends on how much data you need to backup and what backup hardware you have (i.e. external drives/tapes etc.)

In terms of what software to use, well sbackup is fine ("sudo apt-get install sbackup").

share|improve this answer

How about using a free liveCD like Clonezilla? I think this will make your migration a snap. http://clonezilla.org/

share|improve this answer

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.