I'd like to zero-fill the partitions/slices in my FreeBSD VMs in order to provide for better compression for archival. For those partitions/slices with file systems the process is no problem for me to figure out.

I know I can turn off the swap space use via swapoff -a. However, I am uncertain as to whether the swap space has a special structure in FreeBSD and whether I need to reinitialize this structure (like in Linux with mkswap) after zero-filling the slice using dd.

Can anybody shed light on how I can safely zero-fill the swap space and all partitions such that after shutdown I get the best compression possible?

  • You're not using encrypted swap? – ott-- Jul 31 '15 at 21:42
  • @ott--: how to find that out? swapinfo? I am using a range of FreeBSD versions from 6 through 10. – 0xC0000022L Jul 31 '15 at 21:52

There's no special structure so there's no harm in doing dd if=/dev/zero of=/dev/yourswapdev. Just be sure you use the right device. :) (Guessing this is a VM otherwise there's no benefit to this.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.