Centos 7 Zero Free Space

General support questions
Post Reply
matthewh
Posts: 2
Joined: 2017/03/01 16:37:11

Centos 7 Zero Free Space

Post by matthewh » 2018/04/26 15:52:12

I have a number of Centos 7 KVM virtual machines using either XFS or EXT4 file system. Is there a safe easy way to ZERO out all unused disk space? I am wanting to make the backups I do of the entire KVM smaller when compressed.

tunk
Posts: 1206
Joined: 2017/02/22 15:08:17

Re: Centos 7 Zero Free Space

Post by tunk » 2018/04/26 16:18:05

Removed.
Last edited by tunk on 2018/04/26 16:39:32, edited 1 time in total.

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Centos 7 Zero Free Space

Post by TrevorH » 2018/04/26 16:30:57

You can always dd if=/dev/zero of=/tmp/somefile; rm -f /tmp/somefile but there is a window there where something else might request disk space and not be able to obtain it as the filesystem will be full. If you're on a filesystem that has a storage device that supports TRIM then fstrim can discard all unallocated blocks.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply