Sponsored Content
Full Discussion: Updated drive image utility
Top Forums Shell Programming and Scripting Updated drive image utility Post 302273253 by cfajohnson on Saturday 3rd of January 2009 02:45:01 PM
Old 01-03-2009
Quote:
Originally Posted by jwzumwalt
I do a complete drive copy of my 250gb drive in about 2-1/2hrs with this program.

I can do a full backup of my 250GB drive (about 230GB occupied) in about 2-1/4hrs with this command:

Code:
tar czf music.tgz /public/music

It has the advantage over your script in that it doesn't require an second identically sized partition to copy it to.

Another advantage is that it will use less space than using dd.
Quote:
Feel free to offer suggestions Smilie
brain@removed by reborg

Code:
#! /bin/bash 
# name: drive-image.sh, disk image copy script
# by:   Jan Zumwalt - www.neatinfo.com 
# ver:  01/01/09
# remarks:
# -e = enable interpretation of backslash codes
# -n = disable newline at end of line (i.e. user input prompt)

IMAGE_FROM=hda  # the drive or partition we will copy (save). 
IMAGE_TO=hdc    # the target (were it will be saved)


I find it very strange that you hard-code the partitions in an interactive script.
Quote:
# Pretty ANSI writing

OFF="\033[0m"

Code:
OFF=$'\e[0m'

Quote:
BOLD="\033[1m"
DIM="\033[2m"
YELLOW="\033[1;33m"

The yellow text is illegible in my terminal windows.
Quote:
while :
do
clear
echo -en "\n"

Bizarre!

Why do you suppress the newline and then add one?

What's wrong with a simple echo?

Code:
echo

Quote:
echo -en "\t\t\t$BOLD Drive Image Copy\n"
echo -en "\t\t\t by:Jan Zumwalt\n"
echo -en "\t\t\t$YELLOW NeatInfo.com - Ver 01/01/09$OFF\n\n"
echo -en ".----------------- Here is your mounted media -----------------.\n"
echo -en ". .\n"
df[/code]

Why bother displaying all the partitions when you don't offer the user a way to select any of them?
Quote:
Code:
####snip####
read ANSWER
   case $ANSWER in 
      [1])


You don't need the brackets.
Code:
   case $ANSWER in 
      1)

And you don't need to redirect every line. Either use printf:
Code:
 
           printf "%s\n" \
              "[Desktop Entry]"                 \
              "Comment="                        \
       #### snip ####
              "X-KDE-SubstituteUID=false"       \
              "X-KDE-Username="                 > "dr-image.desktop"
           chmod  ugo+x "dr-image.desktop" # make shortcut executable

Or braces:

Code:
           {
           echo "[Desktop Entry]"
           echo "Comment="
           echo "Comment[en_US]="
       #### snip ####
           echo "X-KDE-SubstituteUID=false"
           echo "X-KDE-Username="
           }  > "dr-image.desktop"

 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

rdsk vs dsk for image drive

what is the difference between using the following commands to image a drive besides one taking 9hours and the other 15min? dd if=/dev/dsk/c0t5d0 of=/dev/dsk/c0t4d0 bs=1024k dd if=/dev/rdsk/c0t5d0 of=/dev/rdsk/c0t4d0 bs=1024k Is there reliability issues in one over the other. I have read... (3 Replies)
Discussion started by: aicjofs
3 Replies

2. HP-UX

Image My Drive

After a month of searching I've been completely unable to find replacment 10.20 install media. Would anyone be willing to image my drive for me with a fresh install of 10.20? I'd pay for shipping etc. of course. Mine is a 712/80 Thanks in advance. (0 Replies)
Discussion started by: ErikTheHAck
0 Replies

3. UNIX for Advanced & Expert Users

Create an Ignite image on tape from Online IgniteUX image

Hi, (HP-UX 11.11) I need to create a tape image of an igniteUX image created on our igniteUX server. That is to say. I have a "Online" image of the igniteUX of the targeted system but I now need to copy it to a useable TAPE (igniteUX) image so i can build an other server from it that is not... (3 Replies)
Discussion started by: Andrek
3 Replies

4. Shell Programming and Scripting

How to Unzip a file using unzip utility for files zipped without zip utility ?

Hi, I need to zip/compress a data file and send to a vendor. The vendor does have only unzip utility and can accept only .ZIP files. I do not have zip utility in my server. How do I zip/compress the file so that it can be deflated using unzip command ? I tried gzip & compress commands, but... (1 Reply)
Discussion started by: Sabari Nath S
1 Replies

5. Hardware

How to Clone a Drive with 512 byte Sectors to a Drive with 4096 bytes/sector (AF)?

I have a 320 GB drive which dual boots Windows and Debian: Disk /dev/sda: 320.1 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal):... (0 Replies)
Discussion started by: phillipsoasis
0 Replies

6. Shell Programming and Scripting

matching image files to create one image

Hi, I have two sets of image files. Both sets have names A to Z but set 1 ends with .cdt.png and set 2 ends with .matrix.png. I want set 1 to match with set 2 if the names match (i.e. A.cdt.png will match with A.matrix.png) and with the convert image tool (program for images), it will merge the... (6 Replies)
Discussion started by: kylle345
6 Replies

7. UNIX for Dummies Questions & Answers

Need help to move .csv file from UNIX path to windows shared drive or c:\ drive

Hi Guys, Can any one help me on this. I need help to move .csv/.xls file from unix path to windows shared drive or c:\ drive? Regards, LKR (1 Reply)
Discussion started by: lakshmanraok117
1 Replies

8. Solaris

How to make an exact image copy of a SCSI hard drive in Solaris 8 OS?

To Solaris 8 Experts, Please let me know what's the best method / procedure as well as the Solaris 8 commands for accomplishing the following tasks on a production Sun Enterprise 250 Server running Sun Solaris 8 Operating System: 1. Make an exact image/copy of the SCSI Hard Drive in the... (3 Replies)
Discussion started by: ssabet
3 Replies
All times are GMT -4. The time now is 11:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy