[101803] in RedHat Linux List

home help back first fref pref prev next nref lref last post

Re: diskcopy for linux

daemon@ATHENA.MIT.EDU (Fred Smith)
Sun Nov 29 15:22:35 1998

Date: Sun, 29 Nov 1998 14:51:51 -0500
From: Fred Smith <fredex@fcshome.stoneham.ma.us>
To: redhat-list@redhat.com
Mail-Followup-To: redhat-list@redhat.com
In-Reply-To: <Pine.LNX.4.04.9811291541200.747-100000@alpha.computers.org>; from Iztok Polanic on Sun, Nov 29, 1998 at 03:41:44PM +0100
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com

On Sun, Nov 29, 1998 at 03:41:44PM +0100, Iztok Polanic wrote:
> Hello !!!
> 
> Is the diskcopy for linux???

There is no 'diskcopy' command as such, but it's not hard to create
one with a shellscript.

Here's a little hack of a shellscript you could use, written off the
top of my head just for you:

	#!/bin/sh
	dd if=$1 of=$2 bs=10240

which will work if source and destination drives are the same capacity
but different drives. If you're copying from one drive to another 
diskette in the same drive, try:

	#!/bin/sh
	dd if=$1 of=/tmp/dd.$$ bs=18432		# copy to temp file
	echo "Insert destination diskette then press ENTER..."
	read kb
	dd if=/tmp/dd.$$ of=$1 bs=18432		# copy the tmp file to diskette
	rm -f /tmp/dd.$$ 2>&1 > /dev/null	# delete the tmp file

Note that the 18432 used as the value of 'bs' is not critical, it could be
almost anything, bigger is generally better. Best is if it is a whole-
number multiple of the diskette track size (for 3.5HDdrives 18 sectors * 
2 sides * 512 bytes = 18432). The only difference it makes is in the
speed of the read/write operation.

In each case, the parameter(s) to the program are the /dev/fdxxx 
special files describing your diskette/drive combination. E.g., if
you're copying a HD 3.5" diskette using the second sample, and the 
sample program was in a file named "dcopy" (which has been given
execute permission):

	dcopy /dev/fd0H1440

Also, as a freebie, here's a shellscript I use for formatting DOS
diskettes under Linux:


	#!/bin/sh
	# low-level format a diskette and write a validated DOS
	# filesystem on it.
	fdformat -n $1 
	if [ $? = 0 ] 
		then
		/sbin/mkdosfs -vc $1
	else
		echo Format failed!
	fi
	echo
	echo done...
	echo format another?
	read kb
	case $kb in
		y|Y)
			exec $0 $*
			;;
		*)
			;;
	esac

to use this one you need '/sbin/mkdosfs' which came on my old Red Hat 4.1,
I don't have any idea if they still ship it or not.

Fred
-- 
---- Fred Smith -- fredex@fcshome.stoneham.ma.us ----------------------------
    "Not everyone who says to me, 'Lord, Lord,' will enter the kingdom of
     heaven, but only he who does the will of my Father who is in heaven."
------------------------------ Matthew 7:21 (niv) -----------------------------


-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
		http://www.redhat.com http://archive.redhat.com
         To unsubscribe: mail redhat-list-request@redhat.com with 
                       "unsubscribe" as the Subject.


home help back first fref pref prev next nref lref last post