Clone a harddrive

From Initq
Jump to: navigation, search

This article will explain how to clone a drive for backup. This is not showing you how to make a raid, raid will be explained in another article.

Contents

Items needed

  • The second drive could be smaller or larger as long as it is larger than the data on the original drive.
  • rsync utility installed.

Attach the new drive

After attaching the new drive, boot up the machine. use fdisk -l to make sure you see the new drive. Use fdisk and create your swap 82 and linux partition 83 on the new drive. After that use mkfs.ext3 to create a filesystem on hdb2.

  • # mkfs.ext3 /dev/hdb2

Copy files

Mount the new drive.

  • # mkdir /mnt/hdb2; mount /dev/hdb2 /mnt/hdb2
  • # rsync -avH --delete --exclude 'mnt' --progress -x / /mnt/hdb2

Make disk bootable

  • grub --no-floppy
  • root (hd1,1)
  • setup (hd1)
  • quit

Boot

Boot up your new drive, if you have problems then edit your grub at boot time and see if your kernel is pointing to the new drive.

Personal tools