Making disk imaging a little easier

Greetings everyone. I recently created a Linux bash script that will add a text based user interface to one of the oldest disk imaging tools out there. The idea behind this was I tend to fat finger a bit so instead of typing out all of the command I would rather have a script handle the command syntax for me and all I would have to do is enter a few bits of data. After that the script would handle the rest.

This script uses the dd command for imaging. First let’s start off with the normal way dd is used.

checking for mounted devices
Before I use the dd command I check on which location in the file system the drive I want to image is located.
image being taken
This is the way the dd command is used on the command line.

Here’s the breakdown of the command:

sudo = this command provides the user with temporary root privileges

dd= the invocation of the dd command

if= This is the location of the disk that is to be imaged. In this case it’s /dev/sdb

of= the name of the output file. In this cases it’s image.dd

bs= this is the block size. DD takes data in chunks called blocks. The smaller the block the less errors you may have during imaging but it will take longer. The block size for this image is 2048K

Here’s the script in action.

This is the invocation of the dd script
This is the invocation of the dd script
Entering the location
Next the script will display a list of what devices are mounted to the OS The blkls command is used in the script to show this data. From this data a location of a mounted drive can be entered in.
entering output file name
The script is then going to ask for a file name for the image
Selecting the block size
After the file name is entered the script is going to ask for a block size. All the user has to do is enter a number 1-4 and a corresponding block size is selected
imaging started
Next the script will show what options the user selected and the imaging will begin. The script is still a work in progress. This is evident with the blank output in the current location field. The image is always located in the current working directory.

I plan on making tweaks and changes to this script. Once everything is done I’ll put the completed script in another post. Thanks for reading!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s