1

I am looking for commands or methods whereby I can just write all zeros to the free space on a Pen drive on Windows OS. The existing files should not be affected.

There's a built in command called 'cipher' but it runs in 3 passes, first 0's then 1's and then random. So it defeats my purpose.

There might be Linux solutions using 'dd' but I am not much comfortable with Linux and would prefer a way on Windows.

There is a third party tool called CCleaner but it's not very clear if its Wipe mode writes all 0's or random data in its single pass.

Any further help would be great. I am using Windows 7 Ultimate 64 bit.

Hashim Aziz
  • 11,898
  • 35
  • 98
  • 166
rajeev
  • 1,596
  • 8
  • 34
  • 53
  • http://www.chrysocome.net/dd – Kamil Maciorowski Aug 16 '18 at 12:29
  • @KamilMaciorowski Does `dd` can figure out occupied space that it shouldn't touch ? @OP Why not to save content of flash drive then format it with unchecked `Quick Format` and then restore content back? – Alex Aug 16 '18 at 12:55
  • 1
    @Alex With a help of the filesystem, yes. `dd` can write to a new file until "no space left". Then you somehow `sync`, delete the file and `sync` again. – Kamil Maciorowski Aug 16 '18 at 13:04
  • @KamilMaciorowski Ohh, it interesting approach... Thank you ! – Alex Aug 16 '18 at 13:11
  • This looks like an [XY problem](https://meta.stackexchange.com/a/66378/355310). I remember your (now deleted) other question that I think is the X part, and [my link to the Linux version of Y](https://superuser.com/a/1097391/432690) under it. It's now irrelevant whether it was good or not to delete the other question; but I think *this question* would benefit if you revealed your destination (X), not only one obstacle on the chosen path (Y). – Kamil Maciorowski Aug 16 '18 at 14:23
  • 1
    My earlier question was how to create an image of only the used space from a pen drive. I did not find any easy approach for that and I am dropping that requirement altogether hence I dropped the question. It was anyways marked for closure. I wish to just zero out free space on pen drive so that when I create an entire compressed image using suitable apps, the all zeros get compressed to a very tiny space. So effectively I am achieving what I want. I hope the idea in my mind is clear. – rajeev Aug 16 '18 at 18:20
  • 1
    @Alex I already have a huge file of 16GB image of which only I believe 10 GB is used data. What I want to do is write it on a pen drive again, then zero free space and using a separate tool create a new compressed image. The 5GB of free space with all zeros gets reduced to then a very tiny size rather than random 1's and 0's that take still more compressed space. – rajeev Aug 16 '18 at 18:24
  • @Kamil Maciorowski -Can you please help me further with the approach that you have mentioned i.e. write a file and sync? So that once I come up with a solution we can document it here in Answer section? – rajeev Aug 16 '18 at 18:28
  • I'm not familiar enough with Windows and its tools. I don't even use Windows, except at work. No, sorry. You've got my Linux solution and that's all. – Kamil Maciorowski Aug 16 '18 at 18:33
  • @Alex - Also it's a bootable pen drive with BIOS + UEFI mode. So just copy may not copy the bootsector and the resulting new image may be unbootable. So I wish to avoid that approach. – rajeev Aug 16 '18 at 18:39
  • Formal note about the other question and site mechanics: You said 'It [the other question] was anyways marked for closure'. This was just one vote. What's more important, when you put Linux out of scope, your question was no longer a duplicate of the Linux-centric one. For this reason the question would most certainly stay open, unless someone found a Windows-centric duplicate with useful answers. Even this wouldn't be so bad because it would solve your problem. – Kamil Maciorowski Aug 16 '18 at 18:54
  • Yes I agree, but I have totally changed my approach, so I opted to drop it. Thanks for your support. I will certainly try your solution when I get a chance to spend more time with Linux system. – rajeev Aug 16 '18 at 19:00
  • Actually you can write simple native windows program that can use concept that Kamil suggested, - open a file and write zeros to it until system will be filled completely. It could be done even with simple bat file – Alex Aug 16 '18 at 20:01
  • 1
    I finally used the Linux dd command https://superuser.com/questions/1097210/clone-only-space-in-use-from-hard-disk and it worked well. Only small different thing I had to do was to create multiple files of 2GB each since a single file would have resulted into some failure after 4GB limit on FAT32 formatted pen drive. I had almost 6GB free space on it. Now with 6GB free spaced zeroed my compressed 16GB pen drive image comes to just 10GB saving almost 6GB space on my backup drive. Thank you Alex & Kamil Maciorowski. – rajeev Aug 18 '18 at 07:29

1 Answers1

0

In the Microsoft Windows Family of Operating Systems, we can use "Symantec"'s (formerly NORTON_Peter's) "Norton Utilities" Suite of Software Optimizers. One of its functions is called as "Bleach Free Disk Space".

The "_Bleach Free Disk Space_" Function