From: mathog@seqaxp.bio.caltech.edu Sent: Monday, May 07, 2001 10:51 AM To: Info-VAX@Mvb.Saic.Com Subject: Re: What is the best way to erase SCSI disks? In article <009FBA9A.ABBD5597.13@decus.de>, Michael Unger writes: >> >> What about creating a file that has an allocation as big as the number >> of free blocks >> on the drive and then using DELETE/ERASE? Try the program after my signature. It works on a variety of OS's. But be sure you have no diskquota or it will only zero up that limit. It removes the file it writes when it's done, so that you should end up with an empty disk, other than whatever indices the OS uses. David Mathog mathog@caltech.edu Manager, sequence analysis facility, biology division, Caltech ************************************************************************** /* zerofill.c 19-AUG-1999, David Mathog, Biology Division Caltech This program fills all available space in a disk unit (partition or disk, depending on the OS) with a single file full of zeroes. The purpose of this is to clean the disk of any residual data remaining when files have been deleted but not erased. The main reason I run this is to allow disk copying programs that don't understand the native file format to do a better job of compressing the disk image. (Examples: Ghost, ImageCast, DiskCopy.) Do not rely on this program for security purposes - sophisticated disk recovery techniques might still be able to recover data from a disk entirely zeroed by this program. This program is freeware. No guarantees, warranties, etc. Use it at your own risk. */ #include #include void main(void){ FILE * fd; char block[512]; int i; size_t wrote; /* make a block of 512 zero bytes */ for(i=0;i<512;i++){ block[i]='\0'; } /* open a binary file named ZERO.DAT to fill with these blocks */ (void) printf("Zerofill: creating the file ZERO.DAT\n"); fd = fopen("ZERO.DAT","wb"); if(fd != NULL){ /* open was successful, fill the file */ (void) printf("Zerofill: filling the file ZERO.DAT (this may take a while)\n"); wrote=1; for(i=0; wrote == 1; i++ ){ wrote = fwrite(&block[0],512,1,fd); } (void) printf("Zerofill: wrote %d 512 byte blocks into file\n",i); (void) fclose(fd); if(0 != remove("ZERO.DAT")){ (void) printf("Zerofill: error while removing ZERO.DAT, delete it by hand\n"); } else { (void) printf("Zerofill: ZERO.DAT deleted\n"); } } else { (void) printf("Zerofill: fatal error, could not create the file ZERO.DAT\n"); } (void) printf("Zerofill: program completed\n"); }