Howto copy linux os to new hard drive with GPT partition table.

This method was tested on linux lubuntu. All debian like system schould do the same.

Use gparted to create partitions on new hard drive. Remember to create first partition 100 MB in size fat32 (vfat) as type, and set boot flag to it!

We assume that You have connected new hard drive to your working linux machine and created 1 partition (arround 100 MB efi vfat/fat32) and 2 partition (root) and formated them. Everything can be done with mouse in gparted. Also if new disk is ssd the check that start cylinder of first partition is 2048 or multiplication of this number otherwise You will hit performance penalty.

Now under your current running os that You want to duplicate mount partitions from new hard drive to /mnt dir.

First mount root partition, eg:

mount /dev/sdb2 /mnt

then mount efi partition

mkdir /mnt/boot/efi

mount /dev/sdb1 /mnt/boot/efi

 

Now copy all files from current system to /mnt folder. You can use mc (midnight commander), remember to preserve permissions!

You will encounter problem copying /proc and /sys folder ignore this folders, you dont have to copy it just create them. This folders are created dynamicly by linux kernel.

After copy is done shutdown computer, unplug old disk and boot from cd, then mount new disk to /mnt folder and do the following:

We assume that whole new system is mount in /mnt folder:

now type:

mount –bind /sys /mnt/sys

mount –bind /proc /mnt/proc

chroot /mnt

update-grub

grub-install /dev/sdX

Now your grub schould be installed.

Comments are closed.