Disk zeroing utilities.

6 replies [Last post]
Offline
Joined: May 27 2009
Posts: 922

Disk Zeroing utilities. Are there any for the Apple 2 series?

A Disk Zeroing utility works pretty much like it sounds. It looks at the un-used space on a disk and writes zeros. On the PC there are plenty of these utilities, sold under the premise they provide security and prevent data recovery & undelete.

And what about defraggers? I know (and use) something called Beach.Comber, I believe this program puts all the information on a disk at the front and in a contiguous form. Similar to a modern-day defragger and file placement utility. But it doesn't do anything to erase un-allocated / un-used sectors, and it's for PRODOS only.

I took it upon myself to write a simple utility. And the task can be done entirely in Applesoft Basic. It zero-fills the un-used sectors on a DOS 3.2, 3.3, or PRODOS disk. But I want to know if there are other utilities out there, or even if this has been done before.

My motivation here isn't security, but instead saving space when compressing disk images or even hard drive images.

__________________

On a clear disk you can seek forever..

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Offline
Joined: Apr 11 2006
Posts: 1013
Re: Disk zeroing utilities.

Keatah wrote:

Disk Zeroing utilities. Are there any for the Apple 2 series?

ADFS (http://www.lazilong.com/apple_II/adfs/) has this feature, but I've found it to be a little unreliable - sometimes making disk images unusable. And it's no longer maintained. I would very much like a reliable zero utility.

Offline
Joined: May 27 2009
Posts: 922
Re: Disk zeroing utilities.

Interesting tool set. But like you say, reliability is king.

I suppose I'll stick with the little basic program I did, it gets most of the "orphaned" data. Or just copy the files via Copy II+ or something to blank image.

__________________

On a clear disk you can seek forever..

Offline
Joined: Apr 11 2006
Posts: 1013
Re: Disk zeroing utilities.

So... are you going to post it somewhere?

I'd be interested to know the approach you took. You could follow file chains, or you could follow the allocation bitmap, or both. Really, if you didn't do both, that could lead to problems because one or the other could potentially be wrong. (I had ProDOS in mind just then... I'm less familiar with how DOS marks allocation.)

gsmcten's picture
Offline
Joined: Oct 4 2005
Posts: 2609
Re: Disk zeroing utilities.

Keatah,

I think David is right.
You should post the program up here.
I'm sure everyone would want to try it.

Steven Smile

__________________

Steven (gsmcten)

"Apple ][.....It's ALIVE!!!!!"

Offline
Joined: May 27 2009
Posts: 922
Re: Disk zeroing utilities.

It's really very simple, I did something like this when I was 6 years old and just learning BASIC. And since I could only afford a 300 baud modem, disk compression was of utmost priority.

All you do is clear a portion of memory, and BSAVE it to disk. Increment a filename-counter, and do it again.

When I viewed the contents of a heavily used disk, it was mostly full of "........" and it compressed much better. When I was compiling a hi-res picture disk, I made a 5MB PRODOS HD image. And worked with it, saved, loaded, edited, and deleted programs and pictures to get it just right. When I was done. It compressed to about 3.8MB with WinRAR.

I ran my little zero'er and re-compressed it. This time it was just under 1MB.

Since I'm not at home this week. I will type it here for you. It isn't optimized or clean and has no REM statements.

It basically clears memory area, writes cleared memory to disk as zeros, increments the filename counter, and saves another one. When the disk generates disk-full-error, it goes and deletes the files.

Of course, one could always copy to a freshly formatted disk and get the same (or better) results.

Anyhow:

10 HGR2 :D$ = CHR$ (4): ONERR GOTO 100
15 TEXT : PRINT : HOME : PRINT D$"PR#3": PRINT
20 A = A + 1
30 B = B + 8184
40 PRINT D$"BSAVE CZ";A;",A$4000,L$1FF8"
45 HTAB 1: VTAB 20: PRINT "BYTES CLEARED ";B;"."
50 N = B
60 GOTO 20
100 PRINT D$"DELETE CZ";A
110 B = B - 8184
120 A = A - 1
130 HTAB 1: VTAB 21: PRINT "FREEING SPACE FOR RE-USE. ";B;" BYTES LEFT TO GO. "
140 IF A = 0 THEN GOTO 200
160 GOTO 100
200 PRINT "APPROXIMATELY ";N;" BYTES HAVE BEEN ZEROED OUT.."
500 END

Eventually I'll do something that is more intelligent and operates off of VTOC at track $11.

__________________

On a clear disk you can seek forever..

Offline
Joined: Apr 11 2006
Posts: 1013
Re: Disk zeroing utilities.

Oh! Just use the OS to do the zeroing for you - by re-filling the whole disk with zeroes! I was imagining schemes where you replace non-zero data with zeros wherever they were and only writing where necessary, but this avoids all decision making by just filling the whole thing up no matter what (and then erasing it again). The only drawbacks - performance and some extra cruft in the VTOC.

And the benefit is that it would work in DOS 3.2. I was reserving judgement because if you try to inspect a never-used area of a 3.2 disk, you will find it essentially unformatted. But your approach will have the effect of formatting every area of the disk as it visits, eliminating that problem. An intelligent chain-following algorithm will also avoid the unformatted areas because there will not be any old or new references to never-before-allocated sectors, but brute-force works too.

Come to think of it, for sectors that had been used but later completely disconnected from any chain and have no other references to them, there is no other way to find them but brute force... and there's no way to avoid the 3.2 problem unless you write first anyway. Looks like simpler is better!