Thursday, February 12, 2026

Windows VM notes.

 Despite how much you dislike Windows, especially Windows 11, there are still times which you can't escape from it.  Like many people, I have a virtualbox VM for it, and here are few things I would do to make it "better".

 1) Debloating.  It is not a secret Windows 11 is not lean even with a fresh installed.  Especially if you are unfrotunately having the joy of using its Home edition.  So, the first thing you may want to do is to trim it down.  Win11Debloat may be a good start.

 https://github.com/Raphire/Win11Debloat

 

 

 

 



2) Compact the VDI image. There are times you either just want to keep the VDI file size in control or you want to export the VM as OVA for backup. For both instance, you may want o compact your VDI first. Here are steps I would take.

a) run Windows' Cleaner tool to delete any obsolete/residue files left from Windows updates.

b) run sdelete to "zero" the empty spaces after the deletion in (a)

sdelete c: /z
sdelete is a power toy tool that can be obtained at: https://learn.microsoft.com/en-us/sysinternals/downloads/sdelete

c) run the Windows defrag tool to defragment the drive, so all empty spaces are in continuous blockss.

d) optional. I often run the (b) again, to zero the empty space once more before the compacting.

e) shutdown the VM, and run the below command on the host machine to the VDI file to compact the file.

 vboxmanage modifyhd <your vdi file> --compact 

 If you get the erorr below, try switch to cmd and try again.

  


 

How to get my public IP in Linux with cmd?



There are times when you are on a cmd only set up and you want to know your current public IP. This little command may help you.

curl ifconfig.co

 If you specifically want IPv4 address, you add -4 switch to the command as below.

 curl -4 ifconfig.co

 

Debian 13 Installation notes

Recently, I have started to use Debian instead of Ubuntu for my computers.  There are a lot to like in Ubuntu, the cleaner default install is more favourable for virtual machines.

Here are few notes that I took while I was setting up my Debian.  They are reminders to myself, but they may also be useful to others.

1) Use the Advanced Graphical Install option found under Advanced Options instead.  Most Debian derived distributions disable the root user by default, but Debian does NOT do this with its default option, "Graphical Install".  However, if you use the advanced options, you can choose to disable the root user during the installation time.

 

 

2) Make ext4 more SSD friendly by add mount options: "discard,noatime,nodiratime".  

sudo findmnt --verify --verbose

 Since it is a pain to fix the fstab if a mistake was made.  Use the below to verify your changes!

sudo findmnt --verify --verbose

 

 

3) Reduce swappiness.  By default, Linux can be a bit too aggressive in using your hard drive for virtual memory.  By reducing its aggressiveness can make your system performs better as well as prolonging the life of your hard drive.  This achieves by adding a conf file to /etc/sysctl.d with the content below.  I named mine 99-swappiness.conf.

 vm.swappiness=1

 

 4) Improve system responsiveness during USB drive writing.  It is a bit beyond my capabilities to explain this in details.  If you want to know more, you can try this link, https://forum.manjaro.org/t/the-pernicious-usb-stick-stall-problem/52297 and https://www.reddit.com/r/linux4noobs/comments/1p9h136/copyingmoving_files_to_usb_media_weirdness/

With the default installation, if you are copying a large file to your pen drive, you are likely to end up with a very sluggish if not irresponsive system.  This issue can be mitigated by adding another conf file to /etc/sysctl.d/ with the lines below.  I named mine 99-usb-drive.conf

vm.dirty_ratio = 3
vm.dirty_background_ratio = 3
vm.dirty_expire_centisecs=3000
vm.dirty_writeback_centisecs=1500
vm.min_free_kbytes=59030

 

You can use "sudo sysctl --system" to apply the change without a reboot.

 

Here is what Google AI said about the ratio. 

   

 

4) Add NetBIOS supports.  By default, if you are trying to referencing another machine in your network by its name, you are likely to get an error.  This is because the default set up does not understand NetBIOS.  To make your new install aware other Windows machines in your network better, you need to add the winbind support by:


apt install libnss-winbind winbind

Then, update your /etc/nsswitch to inlcude wins, i.e.



5) Add fonts support to CKJ and Thai characters.

apt install fonts-noto* fonts-thai-tlwg*

6) Add "Open in Terminal" to the context menu.
 sudo apt install caja-open-terminal

 

 

That is it.  I hope you found this useful.