Installing Virtual Machine (Ubuntu ) on a USB Drive and Testing Its Functionality

Installing Virtual Machine (Ubuntu ) on a USB Drive and Testing Its Functionality

While exploring virtual machines, I became curious about how they work when storage space is shared on a USB stick , similar to Tails.

But my main goal was simply to test the VM’s functionality and observe what happens.

I’ve documented my test results in this article for your reference.

Tools & Resources Used

  • VirtualBox
  • Ubuntu ISO
  • SanDisk USB Drive (16GB)
  • Windows Machine (Host)


Setting It Up :

1. Preparing the USB stick

Format the USB drive in exFAT for cross-compatibility (NTFS also works) for better performance and readability.

2. Create the Ubuntu Virtual Machine using VirtualBox

  • Open VirtualBox → Click "New" and Set up the VM
  • Select the iso image and the skip unattended installation process

  • Assign at least 2GB of RAM and 2 CPU cores (if available)

  • Create a virtual hard disk and set the USB stick as its storage location. Make sure the size does not exceed the USB disk space, leaving some room for logs and system functions
  • Click finish


  • Now Turn on the virtual machine and manually install Ubuntu


Since the installation was done on a low-storage USB disk, it took more than an hour to complete.

  • Make sure to check that the VM Disk image files and logs are being created on the USB stick


Testing the virtual machine

Test case 1 : Booting Test

  • Start the virtual machine to verify that Ubuntu boots without errors ( reboot it multiple times to check the persistence)

Result : Terminal commands are functioning as expected.


Test case 2 : File integrity Test

  • Create a txt file and reboot the machine to ensure that the file remains.

Result : The file remains as it is.


Test case 3 : Creating User Groups

  • Create a new user and test its permission restrictions. Reboot multiple times to ensure user account persistence without performance lag.

Type the command :

sudo adduser testuser        


Result :It worked as intended, but the OS became slower when booting and switching between users


Test case 4 : Live Crash Test ( Forcefully Removing the USB While the VM Is Running )

  • Unplug the USB stick while the VM is running live

Caution: Create a backup before doing this, as files on the USB disk may get corrupted and require reinstallation.


First crash attempt : With snapshot files

Result

  • The VM crashed and froze, causing the snapshot files to be erased. Rebooting did not work, requiring a reinstallation of the OS on the USB stick.
  • The second time, without using a snapshot, the VM crashed again, but this time the OS booted successfully without errors

Second Crash attempt : Without snapshot files
Best practices : shut down the VM before removing the USB stick.


Hope this information helps you !


要查看或添加评论,请登录

Sivabalan M A的更多文章

社区洞察

其他会员也浏览了