Creating a HackMyVM Virtualbox - Notes
Just a few notes (mainly for myself!)
After creating a new machine.... and running an export and checking the size - it looks larger than expected. I was using Virtualbox 6.1 and Debian 11 as the machine host, makes the install with Nginx & PHP around 330Mb.
Steps:
1. Keep the original backup (just in case!)
2. Remove any old\previous kernels.
Find the current one with:
uname -sr
dpkg -l | grep linux-image | awk '{print$2}'
apt remove --purge <kernel name>
update-grub2
reboot
3. /var/logs
truncate -s 0 <logfile>
on any large logs.
4. Clean up apt
apt-get clean
and also delete the +100Mb in /var/lib/apt/lists (it will be recreated if you apt-get update)
reboot to check its still works and halt.
#Note if you export at this point it has not changed size :(
5.Attach the disk without mounting it (live Kali or Knoppix)
(if required)
apt-get install zerofree
(then assuming the disk is attached in /dev/sda1)
zerofree -z /dev/sda1
it does a check and sets the bytes of deleted files to 00
6. Now do another export and the image has actually shrunk to a nice size!
References
Comments
Post a Comment