Linux From Scratch (LFS) --- Step by Step with VirtualBox

(V054a-20210617). Linux From Scratch (LFS) --- Step by Step with VirtualBox. This site is managed by VauLSMorg (vlsm.org) since 2020. May the fork() be with Jolan Tru! --- operatingsystems (@T) vlsm dot org.

View on GitHub

HOME ABOUT WEB GITHUB TOP BOTTOM PREV NEXT


LFS: To Shrink and Clean the VirtualBox VDI File

Fill the Guest disk with zero (root)

#!/bin/bash

FILE="ZZZZ"

cd /tmp/
df .
dd if=/dev/zero of=$FILE bs=1M
df .
rm $FILE
df .

cd /mnt/lfs/lost+found/
df .
dd if=/dev/zero of=$FILE bs=1M
df .
rm $FILE
df .

echo ""
echo "vboxmanage modifymedium --compact"
echo ""

exit


On Linux Host

$ ls -al LFS-08-18-disk00*
-rw------- 1 rms46 rms46  3231711232 May 14 21:06 LFS-08-18-disk001.vdi
-rw------- 1 rms46 rms46 12700352512 May 14 21:06 LFS-08-18-disk002.vdi

$ vboxmanage modifymedium --compact LFS-08-18-disk001.vdi 
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

$ vboxmanage modifymedium --compact LFS-08-18-disk002.vdi 
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

$ ls -al LFS-08-18-disk00*
-rw------- 1 rms46 rms46 3101687808 May 10 08:40 LFS-08-26-disk001.vdi
-rw------- 1 rms46 rms46 5203034112 May 10 08:42 LFS-08-26-disk002.vdi


On Windows 10 Host

Directory: C:\...\VirtualBox VMs\LFS-08-26-DEMO
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         5/14/2021   8:12 PM     3165650944 LFS-08-26-DEMO-disk001.vdi
-a----         5/14/2021   8:12 PM    12700352512 LFS-08-26-DEMO-disk002.vdi

PS C:\...\LFS-08-26-DEMO> & 'C:\Program Files\Oracle\VirtualBox\VBoxManage.exe' modifymedium --compact .\LFS-08-26-DEMO-disk001.vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
PS C:\...\LFS-08-26-DEMO> & 'C:\Program Files\Oracle\VirtualBox\VBoxManage.exe' modifymedium --compact .\LFS-08-26-DEMO-disk002.vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Directory: C:\...\LFS-08-26-DEMO
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         5/14/2021   8:16 PM     3096444928 LFS-08-26-DEMO-disk001.vdi
-a----         5/14/2021   8:17 PM     5032116224 LFS-08-26-DEMO-disk002.vdi


ENDOFPAGE

HOME ABOUT WEB GITHUB TOP BOTTOM PREV NEXT