Harddisk upgrade


How I cloned and changed a disk in a Thinkpad T42p running Debian 5.0 and booting with grub, using Knoppix 6.0 on a cd.

It assumes the boot loader is grub. Work as root.

Alternative solutions: dd, Clonezilla.

1. Initialize the new disk

Put the new disk in a usb-enclosure and attach to computer.

Create the partitions on the new disk with fdisk or another partition editor. Remember to make the new root partions bootable.

Create the file systems, e.g.:

mkfs.ext3 -c -m1 /dev/sda1
mkfs.ext3 -c -m0 /dev/sda2
mkswap -c /dev/sda3

2. Rsync

Boot the Knoppix or other live dist and rsync from the old disk to the new


mount /dev/hda1 /mnt/hda1
mount /dev/hda2 /mnt/hda2

mount /dev/sda1 /mnt/sda1
mount /dev/sda2 /mnt/sda2

rsync -avHx --delete --progress /mnt/hda1/ /mnt/sda1/
rsync -avHx --delete --progress /mnt/hda2/ /mnt/sda2/

To shorten the time you cannot use the computer, you can do the rsyncs under Debian running from the old disk while using the machine for other tasks to. You still need to do the rsync again after booting Knoppix, but it will take only a short while because only a few things will need update.

3. Grub

Find out the uuid on the new disk, e.g.:

vol_id /dev/sda1      

This will find something like:


You might also find the uuid of the old disk in the same way.

Now edit /boot/grub/menu.lst on the new disk, this would be something like:


Change all the old uuids with the new one, you can use this simple script (after filling in your old and new uuid):




Like this:

perl ./update-uuid.pl < menu.lst > menu.lst-new

Check the new file looks right and then move it to menu.lst.

Start grub and use setup to set root, e.g.:

root (hd1,0)

You can tab on the devices.

Install grub:

setup (hd1)

That is it! Now you can install the new disk and it should boot.


Just to be sure, you might want to run an update-grub after a successful boot:




1. prepare new disk

2. change disk

You need a small torx to remove the old disk from the slid-in enclosure and mount the new, but you can improvise with a small pair of plyers and a normal screw driver.


Time Machine

I've done it before using Time Machine and it was easy:

Assuming you've already got everything on your old hard drive backed
up via Time Machine onto a separate external hard drive...

With a new hard drive in your computer, boot up using an OS X install

Choose your language.

When you get to the Mac OS X Installer, instead of proceeding with an
install, go up to the menu at the top, click on Utilities and choose
"Restore System from Backup". It even has the Time Machine icon next
to it.

It will walk you through the restore process.

From: http://discuss.gdgt.com/apple/macbook/13-inch/aluminum-unibody/tips/Best-Way-to-Clone-Restore-your-OS-after-swapping-in-a-new-hard-drive/

On Tue, Nov 10, 2009 at 10:00:58PM +0100, Thomas Boesgaard wrote:

> Carbon Copy Cloner er nemmest - så kan man også teste at man rent
> faktisk kan boote fra den nye disk inden man sætter den i.
> Hvis man i samme anledning vil lave en reinstall, så kan det bedre
> betale sig at bruge timemachine.
> Det er nemmere at skifte harddisken end at skifte ram.