We use cookies to help us improve our webpage. Please read our Cookie Policy .

NAS 249

Virtual Machine Configuration with VirtualBox

Configure and run Virtual Machines on ASUSTOR NAS with VirtualBox

2023-09-11

COURSE OBJECTIVES

Upon completion of this course you should be able to:

  1. Configure and run virtual machines on ASUSTOR NAS using VirtualBox.
  2. Run virtual machines on mobile devices (notebooks, smartphones, tablets).

PREREQUISITES

Course Prerequisites:

N/A

Students are expected to have a working knowledge of:

N/A


OUTLINE

1. Introduction to VirtualBox

2. Configuring a Virtual Machine

2.1 Set the display language of VirtualBox in ADM

3. Configuring Remote Desktop Connection

4. Installing VirtualBox Guest Additions

4.1 Installing via VirtualBox in ADM

4.2 Installing via ASUSTOR Portal

5. Running Virtual Machines From Mobile Devices

6. NAS File Access

7. Automatically Start a Virtual Machine upon NAS Reboot

8. Notes





1. Introduction to VirtualBox

VirtualBox is maintained and developed by the Oracle Corporation. VirtualBox can be used to install and run multiple operating systems.


  • Usage Limitations

Supported Models

AS52, 53, 54, 63, 64, 70, Lockerstor (AS66), Lockerstor Gen2 (AS67), Flashstor (FS67)

(*) AS31, 32, 50, 51, 61, 62

(**) Lockerstor (AS65), Lockerstor Pro (AS71)


*For these models, regular programs can be run successfully but not multimedia due to system hardware limitations.

**For these models, HDMI use not supported.

Memory

4 GB or higher is recommended

Officially Verified Operating Systems

  • Windows 8.1, Windows 10, 11
  • Windows Server 2012, 2012R2, 2016, 2019, 2022
  • macOS 10.15, 11, 12, 13
  • Ubuntu 18.04 LTS, 20.04 LTS, 22.04
  • Debian GNU/Linux 10, 11
  • Oracle Linux 7, 8, 9
  • CentOS
  • More...

VirtualBox Guest OS List

https://www.virtualbox.org/wiki/Guest_OSes

Maximum Simultaneous Number of Virtual Machines

Only a single virtual machine may be run at a time in the ASUSTOR Portal interface, but multiple machines can be simultaneously run in the background. The number of virtual machines that may simultaneously be run in the background will differ depending on system CPU and memory.

RDP and USB 2.0/3.0 Device Support

Due to license restrictions, the VirtualBox Extension Pack must be manually installed.




2. Configuring a Virtual Machine

In this section we will demonstrate how to use VirtualBox to configure a virtual machine.
Please first prepare the items listed below.

  • Keyboard and mouse
  • The virtual optical disk file for the operating system that you wish to install.

STEP 1

Log into ADM, open [App Central], search the following Apps and install the Apps:

  • ASUSTOR Portal (*)
  • VirtualBox
  • VirtualBox Extension Pack
  • VirtualBox Language Pack (Optional: please install this app if you need to set the display language of the VirtualBox in ADM.)

Note: *For models without HDMI support, installation of ASUSTOR Portal is not needed and is unavailable.



STEP 2

Connect the keyboard and mouse to the NAS and then click on the VirtualBox icon.

Note: Keyboards and mice are not needed for models without HDMI. Installation and settings will be done through VirtualBox on the ADM desktop.


  • ADM: Be sure to enable Web Server in Services or Web Center for using VirtualBox in ADM.



  • Portal:


STEP 3

After opening VirtualBox you should be able to see the VirtualBox management interface as shown in the graphic below. Here, you will be able to add and manage virtual machines.


STEP 4

Click on [New] to begin configuration for a new virtual machine.


STEP 5

Enter a name for your virtual machine, select the type of operating system you will be installing and then click on [Next].

  • ADM:


  • Portal:


STEP 6

Now, you will need to select the amount of memory (RAM) that wish to allocate to the virtual machine. The more memory you allocate, the smoother the performance of the virtual machine. After allocating memory, click on [Next] to continue.

Note: Please remember to take into account your NAS memory usage when allocating memory for virtual machines.


STEP 7

At this time you will need to configure the hard drive settings for the virtual machine. These settings are as follows:

  • Creating a virtual hard drive
  • Configuring virtual hard drive file properties
  • Configuring virtual hard drive expansion flexibility properties
  • Selecting a location on the NAS for the virtual hard drive and configuring its size. (Note: The default location for the virtual hard drive is /home/admin/VirtualBox VMs)

Select the [Create a virtual hard drive now] radio button and then click on [Create].


Select the type of file that you wish to use for the new virtual hard drive. In our example, we select [VDI (VirutalBox Disk Image)] and then click on [Next].


Select whether the new virtual hard drive should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size). In our example we select [Dynamically allocated] and then click on [Next].


Now, you will need to enter a name for the virtual hard drive, select a location for it on the NAS, and configure its size. In our example, we will use the VirtualBox default location and size (50 GB) and then click on [Create].

Note: If you want to create a virtual hard disk larger than 512 GB, please enter the capacity directly in the input box. Be sure the capacity will not exceed the available capacity of the Volume where the VDI is stored.


STEP 8

After creating the virtual machine, you should be able to see its name in the VirtualBox management interface. We will now proceed to configure the following settings for the virtual machine:

  • CPU settings
  • Video memory settings
  • Operating system CD/DVD image file that you wish to install

First, we will configure the CPU settings. Click on [Settings], select [System] and then select the [Processor] tab to access the CPU settings. (When configuring CPU allocation, please take into account your NAS's hardware performance.)


Next, select [Display] in order to configure the video memory. Please first select the [Enable 3D Acceleration] and [Enable 2D Video Acceleration] options and then set the Video Memory to [128 MB].


Be sure to enable remote display if using VirtualBox in ADM to config the virtual machine.

  • Select Remote Display under Display in Settings.
  • Enable server and input the IP address of the NAS under Net Address. Click OK to save.


Now, select [Storage], select [Empty] and then click on the "Optical Drive" icon. Select [Choose a virtual CD/DVD disk file]. At this time you can browse through your NAS and select the virtual CD/DVD disk file for the operating system that you wish to install. After selecting the file, click on [OK].



Note: When selecting the CD/DVD image file from ASUSTOR Portal, you can double click on [/] and then select [Volume 1] to browse through the data on your NAS.


STEP 9

Verify that the virtual CD/DVD image file has been mounted and then click on [Start] to begin installing the operating system.


  • ADM:

Using Remote Desktop Connection for Windows and input the NAS IP address followed by a Colon and the port number. Example: 192.168.1.100:3389. Afterwards, you should be able to connect to the virtual machine, install an OS and run the virtual machine.

Users can type in the Search in Windows "Remote Desktop Connection" to launch Remote Desktop in Windows.


  • Portal:

Once the installation screen has opened on Portal, click on [View] at the top of the window and then select [Full-screen Mode]. You will now be ready to begin the installation of the operating system.


If the message below appears, select [Do not show this message again] and then click on [Switch].


Note: The Host key is defined as the Right Ctrl key by default.



2.1 Set the display language of VirtualBox in ADM


STEP 1

  • Open [App Central], select [VirtualBox Language Pack] and install it.
  • Click [VirtualBox Language Pack] on the ADM desktop after installation is completed.


STEP 2

  • Click [Display Language], select the language you want to change, and click [Apply].
  • Close this app, click [VirtualBox] on the ADM desktop, and confirm that the VirtualBox display language has been changed.




3. Configuring Remote Desktop Connection

The VirtualBox Extension Pack is needed to enable remote desktop connections on VirtualBox and is especially necessary for models without HDMI support. Installing an operating system onto a VM and operating in a VM all need to be done within a remote connection since there are no HDMI ports. Be sure to enable Web Server in Services or Web Center.

These settings can be set using VirtualBox in ADM.

  • Select Remote Display under Display in Settings.
  • Enable server and input the IP address of the NAS under Net Address. Click OK to save.


After settings have been adjusted, use Remote Desktop Connection for Windows. Input the NAS IP address followed by a Colon and the port number. Example: 192.168.1.100:3389. Afterwards, you should be able to connect to the virtual machine, install an OS and run the virtual machine.

Users can type in the Search in Windows "Remote Desktop Connection" to launch Remote Desktop in Windows.


Note: Chrome and Firefox newer version no longer support Adobe Flash now. In ADM VirtualBox, you cannot click on Console to connect a remote display by using a web browser that does not support Flash.




4. Installing VirtualBox Guest Additions

After completing installation of the operating system, we will install VirtualBox Guest Additions for better usage experience. The two examples in this section will demonstrate installation via HDMI (ASUSTOR Portal) and VirtualBox in ADM (ADM Web browser interface).


4.1 Installing via VirtualBox in ADM

STEP 1

Open Chrome and then log into ADM. Open VirtualBox from the ADM desktop.


STEP 2

After opening VirtualBox, click on the virtual machine that is running. Next, click on the [Settings] icon from the tool bar and then select [Install Guest Additions...].


STEP 3

Click [OK] on the message box that pops out.


STEP 4

Using Remote Desktop Connection for Windows and input the NAS IP address followed by a Colon and the port number. Example: 192.168.1.100:3389. Afterwards, you should be able to connect to the virtual machine.

Users can type in the Search in Windows "Remote Desktop Connection" to launch Remote Desktop in Windows.


STEP 5

  • Open File Explorer in Windows, select "This PC", and then click on "VirtualBox Guest Additions".


  • Right click on [VBoxWindowsAdditions.exe], and then select "Run as administrator". Follow the steps provided for installation.



4.2 Installing via ASUSTOR Portal

STEP 1

Click on [Device] and then select [Insert Guest Additions CD image...].


After downloading and installation is complete, access the CD drive device from your operating system. You should be able to see a screen similar to the one shown in the graphic below.


STEP 2

Browse through the content on the CD drive and double-click on [VBoxWindowsAdditions.exe] in order to begin installation.


Note: If you have installed a 32-bit operating system, please select [VBoxWindowsAdditions-x86.exe].


STEP 3

The setup wizard should now appear. Select [Next] for all the setup steps. After installation completes, the system will request to reboot the virtual machine. In the last step of the setup wizard, select the [Reboot now] radio button and then click on [Finish].


Congratulations! You have completed basic configuration of a virtual machine. You can now begin to enjoy the convenience of a combined NAS and PC experience.




5. Running Virtual Machines From Mobile Devices

After configuring virtual machines and installing VirtualBox guest additions, you can use any mobile device (notebook, smartphone, tablet) to run virtual machines on your NAS.


5.1 Notebook

  • Enter your NAS IP into a Web browser and then log into ADM. Open VirtualBox from the ADM desktop.


  • After opening VirtualBox, select an operating system and click on the [Start] button.


5.2 Smartphone/Tablet

Please download the recommended app to run virtual machines from your smartphone or tablet. After entering the appropriate IP address, account name and password and you will be able to run the virtual machine using the app.

  • Android devices: Please download Remote Desktop Client from Google Play.


  • iOS devices: Please download Microsoft Remote Desktop from the Apple App Store.





6. NAS File Access

So how do you access the files stored on the virtual machine?

In the graphic below, "VM 1" represents the virtual machine that you have created. "File" represents the files stored on VM1. From a NAS storage perspective, the NAS views VM1 as a single file. Therefore, when accessing VM1 using common file access methods, you will only be able to see a single file and will be unable to open it and view additional content or files.


So how do you access the files on your NAS from within the virtual machine? Based on convenience for file sharing and operation, we recommend using Samba/CIFS as the fastest way to access files on your NAS from a virtual machine. This file access method is exactly the same as the one you would use on a regular computer. No matter if its accessing shared folders on the NAS or external hard drives connected to the NAS, you won't need to learn new!




7. Automatically Start a Virtual Machine upon NAS Reboot

ADM can execute boot scripts stored in sequence upon booting up. A script can be added to start a virtual machine upon powering on the NAS.

Note: The example below uses Windows to edit and upload the script file. To edit the script directly, log into your NAS with a system administrator account using SSH, and use vi to directly edit the script.


STEP 1

  • Using a text editor on your computer and create a new file named 'S99xxxx.sh'.
  • Enter the following script and save the file.
  • #!/bin/sh
  • /opt/VirtualBox/VBoxManage startvm VMNAME --type vrdp &
  • Where VMNAME is the name of the virtual machine.

Note: The file name must include S99 as the prefix. This is an ADM-defined file name and execution sequence for the booted shell script. The remainder of the file name can be customized. The file extension is 'sh'. Files should not have duplicate names.
Example: S99autoboot-vm.sh


STEP 2

  • Upload the saved sh file to /usr/local/etc/init.d/ on the NAS.
  • Ensure the owner of S99*.sh is the administrator account or root.
  • Modify the file access privileges of S99*.sh to 0774.

Note: Be sure to grant the [x] (execution) permission of S99*.sh for the owner, and it's optional to grant the permission for administrator group.


STEP 3

  • The well-configured Shell Script will be executed in sequence when the NAS is powered on.
  • When the NAS powers on, the configured virtual machine will start automatically and can be interacted with.




8. Notes

ASUSTOR Portal will detect new virtual machines and add them to the Portal interface as shortcut icons. If you wish to disable this function, please access [Settings] [VirtualBox] from within ASUSTOR Portal.

Was this article helpful? Yes / No