Zerofree Write Zeros to Free Space - Raspberry Pi
From ETCwiki
Revision as of 18:09, 25 September 2013 by Ddxfish (talk | contribs) (Ddxfish moved page Raspberry Pi - Zerofree Write Zeros to Free Space to Zerofree Write Zeros to Free Space - Raspberry Pi)
I make frequent backups of my pi using the dd command because I test and install so many different guides, hardware and software. My 32gb SD card (class 10 UHS) writes an image file that is 32gb, so each time I compress it using gzip or bzip2 and end up with a 20GB image roughly. This has the unfortunate side effect of storing all of the trash 1's and 0's on the partition where files used to be. To reduce the size of my zipped backup (this can reduce ZIPPED size of an image, not image size itself) I ran zerofree to write zeros to the unused space.
- shutdown the pi and take out its memory card
- boot your main pc to linux (I used linux Mint 15)
- backup your pi using dd (do this BEFORE you mess anything up with zerofree)
- run zerofree on your sdcard
apt-get install zerofree umount /dev/sdc1 (change sdc1 to your raspi boot partition location) umount /dev/sdc2 (change sdc2 to your raspi ext4 partition) zerofree -v /dev/sdc2 (replace sdc with your usb cards location, check the command "df")