I had to revert to Wheezy after trying Jessie on a brand new 32 GB SDcard.
So I took a used 32 GB Sdcard (had previously been used in my Android phone and was full of images and movies). Onto this I imaged the Raspbian Wheezy 2015-05-05 distribution and then did all of my usual setup things including a very lengthy process of installing Free-Pascal and Lazarus and tightvncserver.
Then I wanted to make a backup image of this working installation using Win32DiskImager.
Surprise! The img file turned out to be 30 GB in size and it would not compress either. I had expected something like 4 GB. In order to use the new card I then wrote the image onto the Jessie SDcard and continued from there.
Now I realize that the image contains the data from old movies and images from my phone in the unallocated area and therefore the image does not compress.
And I have written this crap to the new SDcard as well...

So is there a way to actually zero out all of the unused blocks on the SDcard or on the image file?
Best something running on the live file system in the Pi or else on the image file in Windows7.
I have googled and found a utility named zerofree, but that is apparently used in Linux on a file system that is mounted read-only, which is not what I can do here.
EDIT:
I found another page with a solution, but I don't know if it is the right way...
Anyway from his post I created this file using /dev/zero instead of /dev/urandom as input and /dev/root as filesystem:
Code: Select all
#!/bin/bash
# Source:
# http://www.linuxquestions.org/questions/linux-software-2/a-faster-way-to-wipe-free-space-701435/#post3514139
# Author: erikalm
#
# This script wipes the unused area of the disk by writing
# a file full of zeros until disk space is used up, then
# it erases said file to return the sectors to the system
# Enter the filesystems to process in the FSLIST variable
# Separate each with a space.
#
FSLIST="/dev/root"
SCRATCH_FILE="DELETE_ME"
for FS in $FSLIST; do
set +e +u;
dd if=/dev/zero of="${FS}/${SCRATCH_FILE}";
sync; sync;
rm "${FS}/${SCRATCH_FILE}";
sync; sync;
done