Jump to content











Photo
- - - - -

Dos tool to zero empty spaces for fat


  • Please log in to reply
16 replies to this topic

#1 xpt

xpt

    Frequent Member

  • Advanced user
  • 138 posts
  •  
    Canada

Posted 17 June 2010 - 03:43 PM

Hi,

Not entirely OT -- anyone knows a Dos tool that can zero out empty spaces for FAT? I have Norton Utilities, can Norton Utilities do that?

Not entirely OT because this is useful if the device on which this FAT file-system resides is a disk image -- I may zip up the image to reduce the size after the zero outs for my Grub4dos to load and boot from.

Thanks

#2 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 17 June 2010 - 04:01 PM

What does OT mean? How would you abbreviate its opposite?

You can make a DOS batch file that simply loops until an error condition and copies a file together with itself until the copy fails because you've run out of room. Then you can delete that file. You can create the initial dummy file with echo.>dummy.txt.

EDIT: Actually, it might be better to "slow-fill" the file by continually appending to it. The method above would be much faster, but could run out of room just past the half-way point. A happy medium might be repeatedly doing type 512.bin>>filler.

#3 TheK

TheK

    Frequent Member

  • Advanced user
  • 141 posts
  • Location:Germany (BW)
  •  
    Germany

Posted 17 June 2010 - 04:26 PM

If DOS means DOS box or CLI, then sDelete might be exactly what you're looking for.

#4 xpt

xpt

    Frequent Member

  • Advanced user
  • 138 posts
  •  
    Canada

Posted 17 June 2010 - 10:16 PM

Thanks TheK for pointing out sDelete.

In case anyone else is interested, basically, as the empty free space is concerned, it's method is exactly as outlined by Sha0, just filling the free space with zeros, as opposed to anything else:

You can make a DOS batch file that simply loops until an error condition and copies a file together with itself until the copy fails because you've run out of room. Then you can delete that file. You can create the initial dummy file with echo.>dummy.txt.

EDIT: Actually, it might be better to "slow-fill" the file by continually appending to it. The method above would be much faster, but could run out of room just past the half-way point. A happy medium might be repeatedly doing type 512.bin>>filler.


Actually, all above can be done with a single command under Linux (no wonder I wasn't able to find such tools under Linux):

dd if=/dev/zero of=filler ...

The following is taken from the description from zerofree package, which zero free blocks from ext2/3 file-systems:

The usual way to achieve the same result (zeroing the unused
blocks) is to run "dd" do create a file full of zeroes that takes up
the entire free space on the drive, and then delete this file. This
has many disadvantages, which zerofree alleviates:

* it is slow;
* it makes the disk image (temporarily) grow to its maximal extent;
* it (temporarily) uses all free space on the disk, so other
concurrent write actions may fail.


I guess ordinary Windows user would have a hard time trying to under this because they don't have the concept of a sparse file.

From http://wiki.archlinu...php/Sparse_file

The advantage of sparse files is that storage is only allocated when actually needed: disk space is saved, and large files can be created even if there is insufficient free space on the file system.


Anyway, I think this brain-dead brute-force method works for me.

> What does OT mean? How would you abbreviate its opposite?

OT: Off-topic; And no, normally people don't abbreviate "on-topic".

thanks

#5 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 17 June 2010 - 10:52 PM

Thanks TheK for pointing out sDelete.

I would have pointed out DD for Windows[1] by John Newbigin and Chrysocome, but you said DOS, which is != Windows. This is the FreeDos and Dos area.

In case anyone else is interested, basically, as the empty free space is concerned, it's method is exactly as outlined by Sha0, just filling the free space with zeros, as opposed to anything else:
...
Actually, all above can be done with a single command under Linux (no wonder I wasn't able to find such tools under Linux):

dd if=/dev/zero of=filler ...

I believe that recent versions of DD for Windows will accept the above command exactly. If not, you can install the Zero and Random Device Driver[2] by Olof Lagerkvist, then do dd if=\\.\zero of=0 and fill up your empty space.

Always a good idea to defragment and make all files as contiguous as possible, before-hand. Also, you can use bs=XXX to [hopefully] increase the filling speed.

Using DD every single day (on UNIces and Windows, both) is where the cheap idea for a DOS environment came from. A repeating sequence of two characters 0x0D, 0x0A will surely compress pretty close to what you'd get for one character 0x00.

...I guess ordinary Windows user would have a hard time trying to under this because they don't have the concept of a sparse file...

Windows's NTFS filesystem supports sparse files. Look for mksparse.exe, for example.

[1] dd for windows
[2] Tools and utilities for Windows

#6 xpt

xpt

    Frequent Member

  • Advanced user
  • 138 posts
  •  
    Canada

Posted 18 June 2010 - 12:33 AM

I would have pointed out DD for Windows[1] by John Newbigin and Chrysocome


thanks, Sha0. I did mean DOS.

#7 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 18 June 2010 - 02:14 AM

thanks, Sha0. I did mean DOS.

Ask and ye shall receive FILL.COM[1]. Note the speed difference between byte-at-a-time and 512-bytes-at-a-time. I hope this file is OT for this thread. :thumbup:

[1] FILL.COM with source code

Also see direct download below, whose MD5 hash is D16BCD44BB88847B00219A9AE00BDAD4.

Attached Files

  • Attached File  fill.zip   6.98KB   829 downloads


#8 wendy

wendy

    Frequent Member

  • Lady
  • 290 posts
  • Location:one mile from the QR main line
  • Interests:Operating systems, Weights and Measures, Geometry
  •  
    Australia

Posted 18 June 2010 - 07:15 AM

Of course, you could build the image from new, and load the files into the image.

For example, you could use something like bfi.exe ( http://nu2.nu/ ) to create a boot disk with the required files. The balance of the fat and the diskette will be entirely empty, which makes the appropriate zip entirely empty.

I wrote a rexx script for appending a tail to a boot sector (based on the boot sector), for making a perfectly empty diskette, complete with empty fat and data blocks.

#9 xpt

xpt

    Frequent Member

  • Advanced user
  • 138 posts
  •  
    Canada

Posted 18 June 2010 - 08:21 PM

For example, you could use something like bfi.exe ( http://nu2.nu/ ) to create a boot disk with the required files.


Any direct link please?

I've checked

- hompe page
- UTILITIES
- BOOT DISK

but didn't find that bfi.exe

thanks

#10 xpt

xpt

    Frequent Member

  • Advanced user
  • 138 posts
  •  
    Canada

Posted 18 June 2010 - 08:29 PM

Any direct link please?

I've checked

- hompe page
- UTILITIES
- BOOT DISK

but didn't find that bfi.exe

thanks


http://www.nu2.nu/bfi/

#11 roytam1

roytam1

    Member

  • Developer
  • 99 posts
  •  
    Hong Kong

Posted 17 December 2010 - 08:23 AM

ZAPEMPTY from WIPEUTIL package is the tool that I used to zero-filling free spaces of disk images. (for super-floppy images, I have to use grub4dos map it to (fd0) and load freedos and run speedisk to defrag it and then zapempty it)
http://reimagery.com...l2.htm#filewipe

#12 xpt

xpt

    Frequent Member

  • Advanced user
  • 138 posts
  •  
    Canada

Posted 21 December 2010 - 11:50 PM

ZAPEMPTY from WIPEUTIL package is the tool that I used to zero-filling free spaces of disk images. . .


Exactly what I was looking for! Thanks!

#13 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 01 April 2011 - 10:14 PM

WinImage - Image - Defragment seems to do something similar because when I zip an image after running Defragment it makes a much smaller file.

#14 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 01 April 2011 - 11:33 PM

WinImage - Image - Defragment seems to do something similar because when I zip an image after running Defragment it makes a much smaller file.

I am afraid very few people will be able to run Winimage from DOS or FreeDos....;)

:thumbsup:
Wonko

#15 xpt

xpt

    Frequent Member

  • Advanced user
  • 138 posts
  •  
    Canada

Posted 28 April 2011 - 02:56 PM

I am afraid very few people will be able to run Winimage from DOS or FreeDos


But still good to know.
Thanks Steve.

#16 nando4

nando4

    Frequent Member

  • Advanced user
  • 112 posts
  •  
    Australia

Posted 02 March 2012 - 07:41 PM

ZAPEMPTY from WIPEUTIL package is the tool that I used to zero-filling free spaces of disk images. (for super-floppy images, I have to use grub4dos map it to (fd0) and load freedos and run speedisk to defrag it and then zapempty it)


I mount my15.6MB image using IMDISK in windows, winrar it's contents to a file, delete ALL the files on the image, run Microsoft's sdelete -z [image drive], then restore the contents from the rar backup file. Run another sdelete -z [image drive] for good measure. These steps defrag the image and ensures empty space is zeroed out.

After that I unmount my image, compress my image source file into a SFX EXE (RAR) file, then run UPX over the SFX to get the smallest possible SFX file for distribution. Works great but you can see that I'm doing all of these operations from within Windows rather than the FreeDOS boot image.

#17 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 02 March 2012 - 08:03 PM

Have you tried this?
http://www.cezeo.com...f=disk-redactor
It can run from the command line or GUI and is free.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users