Replace a hard drive

From Organic Design
Jump to: navigation, search
Procedure.svg Replace a hard drive
Organic Design procedure

These instructions apply to Ubuntu, but could be used with the Ubuntu live CD if the drive is being replaced on a Windows machine.

  • Put the new drive in as A secondary slave or as an external USB device
  • Start gparted
  • Copy the partitions on the old drive to the new one (they may need to be resized)
  • Shutdown and swap the drives (ensure link positions match the removed one)
  • Start up off the new drive

Replacing a damaged drive

Often the reason for replacing a drive is that it is already damaged and files may be inaccessible. Worse still in these situations, file or partition copying processes may fail or freeze preventing the operation from completing. in these circumstances, a different procedure is needed allowing selective copying of content a region at a time.

It's risky copying a filesystem over the top of an existing root structure because some processes use directory scanning for there startup configuration like the way the processes are launched in /etc/init.d or how Apache handles enabled/installed sites and modules.

  • Replace the drive with the new one and install Ubuntu on it as you would a fresh system
  • Put the old drive into an external USB case and connect it to the system
  • Use the copy-system-files.pl script to copy the main linux structure across from the external drive. The perl script is used because it can complete the transfer of the OS without accessing any external libraries.
  • turn the machine off (with the power button not the shutdown script since the env in RAM no longer matches the FS
  • the machine should reboot into the copied OS
  • manually copy remaining selective user data etc from the external drive

Example of using Perl to do the copying procedure

perl -e "rename '/lib','/redhat/lib'; rename '/debian/lib','/lib';"

See also