Friday, March 7, 2008

DDClone

So one of the greatest aspects of Linux that I love is its powerful command line utilities. It's so powerful that I can rip entire dvd's with one command or mount an iso without any additional software. And so it was when I was in the process of migrating all the information from one hard drive to the other, that I found a very powerful command: "dd".

Essentially "dd" is a disk imaging tool that will make a byte by byte image of any disk. You can even make an entire disk into a single image file. This is built into Linux by default!

I was so impressed that I decided to write a very simple script that made it even easier to use; so that almost anyone of any skill level could use it.


So I present to you all my DDClone Script!:
Download

Instructions:
1. Download the script file.
2. Double click on the script file and select "Run in Terminal"
3. Be sure to double check which drives you are imaging because it will NOT prompt you with a warning before performing any operations.

or

1. Download the script file.
2. Open up a terminal window and navigate to the directory where you downloaded the file.
3. Type in: sh ddclone.sh

Screenshot


Source Code:
# Written by William Edwards
# March 05, 2008

clear
echo "DDClone Script"
echo "\033[1;34mDetected drives:\033[0m"
sudo fdisk -l | grep /dev
echo " "

echo "\033[1;33mEnter in the name of the source disk or location of the
disk image:
(e.g. /dev/hda1, /home/disk.img)\033[0m"
read source
echo "\033[1;33mEnter in the name of the destination disk or where you want
to create the disk image:
(e.g. /dev/hda1, /home/disk.img)\033[0m"
read destination

echo "\033[0;34mCloning disk...\033[0m"
sudo dd if=$source of=$destination
echo "\033[0;32m$source successfully imaged to
$destination!\033[0m"


No comments: