LVM - Zero out empty space in a Volume Group

3

1

How do I zero out the empty space in a volume group? I've got a Virtual Machine contained in a Logical Volume. This logical volume itself contains sda1 for boot partition and sda2 as physical volume for the volume group vmvg.

The volume group vmvg contains two logical volumes. It has about 5-6 GB free space. I need to fill this space with zeroes (/dev/zero).

How do I go about doing this?

Sparctus

Posted 2011-12-01T21:27:37.283

Reputation: 103

Answers

5

Create a volume that consumes the empty space, then

dd if=/dev/zero of=/dev/mapper/vg-emptyspace

(where vg-emptyspace is replaced by the volume you created)

Then delete the volume.

Paul

Posted 2011-12-01T21:27:37.283

Reputation: 52 173

Thank you Paul. This thought occurred to me after I posted my question, but wasn't too sure. Thanks for the affirmation :) – Sparctus – 2011-12-02T15:01:47.800