GRC VM Template

Installed base OS

Ubuntu 16.04.4 LTS  because only LTS releases are worthy.  No auto-updates.
Copy over home directory and /etc/apt from my current TESTNET system

Split /home /usr /var /tmp into separate LVs.

lvcreate, edit /etc/fstab, mount on temp space, copy over, move old dir, reboot, remove old dir.

Shrunk root filesystem

grub
e
root=/dev/ram0 rw
^X

Wait for mdadm to finish complaining.
alias ll='ls -laF'
mkdir /mnt
lvm pvscan
lvm vgscan
lvm vgchange -a y
e2fsck -f /dev/ubuntu-vg/root
mount /dev/ubuntu-vg/root /mnt
cd /mnt
cp -a lib lib65 bin sbin /
cd /
umount /mnt
e2fsck -f /dev/ubuntu-vg/root
resize2fs -M /dev/ubuntu-vg/root
lvreduce -L 1120M /dev/ubuntu-vg/root
e2fsck -f /dev/ubuntu-vg/root
resize2fs /dev/ubuntu-vg/root
umount -a

power off VM since halt and reboot do not work.

Cleared free space

lvcreate -l 100%FREE -n deleteme ubuntu-vg
dd if=/dev/zero of=/dev/null bs=256k
lvremove /dev/ubuntu-vg/deleteme
swapoff /dev/ubuntu-vg/swap_1
dd if=/dev/zero of=/dev/ubuntu-vg/swap_1 bs=256k
for i in / /home /var /tmp /boot /usr ; do dd if=/dev/null of=${i}/deleteme bs=256k & rm ${i}/deleteme ; done
halt -p

Compacted

"\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd --compact "Xenial GRC Build.vdi"

Plans

Snapshot, test building.


Comments are closed.