# How to clone a distro to a new drive
Install drive in box (assuming IDE1 slave for examples) and ensure BIOS can detect it. Boot into Linux and login to your user's account. Open an x terminal and partition and format the new drive as you wish
Code:
[phil@fancypiper phil]$ su -
Password:
[root@fancypiper root]# fdisk /dev/hdb
Exit with
w to write the partition table.
Format the partitions with the chosen filesystems:
mke2fs /dev/hdbX -> ext2
mke2fs -j /dev/hdbX -> ext3
mkswap -> swap
mkreiserfs -> reiserfs
mkfs.xfs -> xfs
Make directories for source and destination mount points. You need these to keep out of an endless loop of copying itsself over and over.
Code:
[root@fancypiper root]# mkdir /mnt/source
[root@fancypiper root]# mkdir /mnt/destination
Mount your os partitions that you want to clone on /mnt/source
Mount your partitions on the new drive, making directory entries for your separate partitions (/boot, /home, /var etc.)
Now, cd to /mnt/source and pipe it over with tar
Code:
[root@fancypiper root]# cd /mnt/source
[root@fancypiper source]# tar cf - . | (cd /mnt/destination && tar xBfp -)
Edit /etc/fstab as needed, install the boot loader and it should work when stuck in it's new home.