Page 1 of 1

zerofree: failed to open filesystem /dev/mmcblk0

Posted: Tue Jan 27, 2015 3:44 pm
by alexandros301
I'm trying to use zerofree to reduce the size of my SD card (got this idea after searching the web) so I can save it as an image (with dd) in my laptop and use it with other SD cards (same size as the original one).
I type this

Code: Select all

zerofree /dev/mmcblk0
and get this

Code: Select all

zerofree: failed to open filesystem /dev/mmcblk0
It's pretty obvious that my approach is not correct at all. Can anyone recommend a proper use of zerofree (most stuff I found online mention using grub by holding down the left shift on boot etc. I'm logging in my Pi with SSH from my laptop, so I'm not sure I can do that...)?
Is zerofree only for VirtualBox? This seems to be posted here and there on official OS sites...

I've got a Pi model B, logging in from an OS X 10.8.5 machine.

Re: zerofree: failed to open filesystem /dev/mmcblk0

Posted: Tue Jan 27, 2015 3:55 pm
by RaTTuS
your probably mean
sudo zerofree /dev/mmcblk0p6 [change p6 to whatever partition you have mounted as the rootfs]

however this will just increase the wear on your SD card
you can do something like
cat /dev/zero >poo
rm poo
to achieve a similar effect

the means you can compress the image better after [during] a dd of the filesystem.

there are other ways of making useful copies of the complete filesystem

Re: zerofree: failed to open filesystem /dev/mmcblk0

Posted: Tue Jan 27, 2015 4:08 pm
by alexandros301
change p6 to whatever partition you have mounted as the rootfs
there's p1 and p2. how do I know which one is mounted as the rootfs? I guess I've configured that while configuring the Pi, but I really don't know which one it is.
however this will just increase the wear on your SD card
so it will be even worse than not using zerofree?
the means you can compress the image better after [during] a dd of the filesystem.
How do I do that? .zip or something else? Does this "guarantee" I'll be able to burn the image to an SD card of the same size? (BTW, it's an 8GB card and I've already made an image with dd which is 7.97GB)
there are other ways of making useful copies of the complete filesystem
Can you give me an example? I'm basic terminal and Linux user. I don't know much about it, and looks like most options are rather complicated for my knowledge.

Thanks