[comp.sys.next] 'rawdisk'

oneill@cs.sfu.ca (Richard Oneill) (06/28/91)

A while back I wanted to spread an archive over multiple floppies and
wanted a neat way to do it. Basically I wanted to use floppies like one
uses tapes. GNU tar almost did what I wanted but not quite, so I wrote
'rawdisk'. (One thing I wanted to was to compress my archives to minimise
the number of disks needed (even though compressed archives are less 'safe'
than uncompressed ones). GNU tar can't compress *and* do multi-volume
archives (It can't yet anyway).)

I use it like this:
        tar -cf - files | compress -c | rawdisk -w
  and   rawdisk -r | uncompress -c | tar -xvf -

rawdisk -w   reads stdin and writes to as many disks as required
rawdisk -r   reads disks and writes to stdout, reading until the pipe is
             broken or the program killed.

After sending it (by e-mail) to people who wanted it for a while, I've
come to the conclusion that there is enough demand for it for me to put
it on the archives. Thus I have submitted it to:

	nova.cc.purdue.edu
   and  cs.orst.edu

Enjoy it, but remember:

IF YOU CAN'T HANDLE THE FACT IT MAY HAVE BUGS IN IT AND SO COULD COMPLETELY 
SCREW YOUR BACKUPS DON'T BOTHER TO GET IT.

Heres the README:

   RAWDISK
  =========
  
  Overview
  
    Rawdisk is a program which enables you to write to the raw media of
    a floppy disk (or a series of floppies if need be). It makes most
    sence to put rawdisk at the start or end of a command pipeline.
      
  Licence & Warranty Information	

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 1, or (at your option)
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

  Installation Instructions
    
    Rawdisk needs to be able to open the /dev/rfd?a devices to read and
    write to raw floppies. You can do this by either installing it
    as setuid root or set-gid operator and modifying the /dev/rfd?a devices
    to be writable (as well as readable which they should be already) by 
    operator. Being of a nervous disposition, I did the latter, something
    like:
       su
    	 mkdirs /usr/local/bin
	 mv rawdisk /usr/local/bin
	 chown root.operator /usr/local/bin/rawdisk
	 chmod g+s /usr/local/bin/rawdisk
	 chmod g+w /dev/rfd?a
       exit
       rehash
  
  Using rawdisk
  
    Rawdisk spews directly to the raw media, hence its name. Doing this
    *destroys any filesystem on the disk* SO BEWARE. Do not try
    to put the disk in before running the program, when rawdisk wants
    a disk, it will ask for it. If outside of rawdisk you insert a disk with
    raw data on it, auto-mounter will think it's a damaged disk and offer
    to repair it. If there is already a disk in the drive when rawdisk runs
    it will be ejected (but not unmounted!).
    
    When spewing to multiple disks it writes *NO* markers for first, second,
    third disk etc. THIS IS UPTO YOU! Thus when reading disks, giving the
    disks out of sequence will happily shuffle your data in disk sized chunks.
    
    Rawdisk does not write end of file markers. When reading disks, it will
    read until it is killed or its output pipe is broken or cancel is clicked
    in the disk request dialog box. This is fine for use with programs like
    tar which know when they have reached the end.
    
    Example usage:
    
      Backing up
    
    	tar cf - myfiles | compress -c | rawdisk -w    	# write archive
	rawdisk -w | uncompress -c | tar tvf -		# verify archive
	rawdisk -w | uncompress -c | tar xvf -		# read archive
	
      Copying a disk
        - this seems to work, but don't use it for something vital!
      
	rawdisk -r > disk-image
		(click CANCEL when it asks for a second disk)
	rawdisk -w < disk-image
	rm disk-image
    
  Source Code
  
    I don't usually write C, so sorry if the code is a little strange. I wrote
    a wierd sort of exception handler (I didn't know about NX_RAISE) to 
    handle OS call errors and ensure that if a disk is in the drive it is
    ejected before the program terminates. It should have more comments,
    but I wrote it for me.
    
  Finally
  
    I hope you like it. It could do with a few tune-ups. If you make any 
    changes or find any bugs I'd like to hear from you. If you'd like to
    help me out, but don't want to hack code, write me a man page! 

    REMEMBER, RAWDISK MAY HAVE BUGS IN IT SO USE IT AT YOUR OWN RISK.
    
    
    	Richard O'Neill
	Computing Science Dept.
	Simon Fraser University
	Burnaby BC
	V5A 1S6	    CANADA

	oneill@cs.sfu.ca


  
-- 
Composing a suitably apt and witty .signature is left | oneill@fornax.UUCP
as an exercise for the reader.                        | oneill@cs.sfu.ca