4

I have a virtualbox vitual server that keeps growing. To keep its virtual disk small I'm manually shrinking it using VBoxManage modifyhd disk.vdi compart after zeroing unused space on the disk using zerofree while booted to recovery mode. I would like to automatize it.

Is there a way how to run zerofree /dev/sda1 (where /dev/sda1 is my /) automatically on each server boot? Or alternatively on each server shutdown?

To run zerofree /dev/sda1 the device /dev/sda1 must be mounted read-only. So I can't run it while the server is running. However isn't there any chanche to run in on boot just before mounting it? Or on shutdown just after umounting?

The virtual server system is Ubutnu 16.04.

1

0

Your Answer

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

Browse other questions tagged or ask your own question.