Copying root filesystem from one media to another
This page describes the steps involved in duplicating the root filesystem from one disk to another
There are two ways of doing it: by making a raw copy of one media to another, or by re-creating partitions, and copying the contents.
Regardless of the method, switch to single-user runlevel, make sure no user-space processes are running beside init and the shell and remount the root filesystem read-only
mount / -o remount,ro
Raw copy
Use dd
Contents copying
Partition the new media (assuming it is on /dev/hda, and hda1 will be the root partition)
sudo fdisk /dev/hda
format the root filesystem. Use ext2 if it is a solid state device
mkfs -t ext3 /dev/hda1
Moun the new partition and, assuming it is mounted on /mnt/hda1, copy the contents to the new partition
copy -ar /bin /boot /etc /home /initrd /initrd.img /lib /lost+found /opt /root /sbin /selinux /srv /usr /var /vmlinuz /dev /mnt/hda1
mkdir /mnt/hda1/proc /mnt/hda1/sys
edit fstab and fix references to the new root file system and swap partitionsedit grub's config file and make sure the root parameter points to /dev/hda1
install grub
grub
> root (hdX,0)
> setup (hdx)
if swap partition doesnt mount properly, try
mkswap /dev//hdaX
swapon /dev/hdaX