Skip to content

Instantly share code, notes, and snippets.

@rmi1974
Last active March 29, 2020 15:23
Show Gist options
  • Save rmi1974/a021ff4c51f8395284e45de9f6aa0826 to your computer and use it in GitHub Desktop.
Save rmi1974/a021ff4c51f8395284e45de9f6aa0826 to your computer and use it in GitHub Desktop.
VirtualBox recipes #virtualbox #commandlinefu

VirtualBox recipes

Mount shared folder

sudo mount -t vboxsf -o uid=1000,gid=1000 <sharename> <mountpoint>

Shrink windows guest Virtualbox VDI disk

Courtesy of Shrink Windows Guest VDI.

  1. Boot up your windows guest and uninstall/delete all unwanted programs and files

  2. Defragment the disk using Windows built-in defragment tool.

  3. Zero-out unused sectors:

Download the latest version of SDelete tool from SysInternals and Extract sdelete zip to c: (or what ever drive your shrinking).

Click Start> Run and type cmd. in the command prompt type:

c:\sdelete.exe -z c:
  1. Shutdown the windows guest

  2. Run the following command on the linux host (windows virtual box has a similar command and syntax):

VBoxManage modifyhd /path/to/disk.vdi compact

Miscellaneous / Problems

Creation of symlink fails on a shared folder

Symbolic link creation from within a guest has been disabled in VirtualBox 4.1.8 for security reasons. A guest could create symbolic links which point outside the assigned host directory. This has nothing to do with any ext3/ext4 bug. And the guest is still able to read symlinks which are created on the host.

VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment