Installing Ubuntu 20.04.3 LTS in Windows 10 Hyper-V with Mounted SMB Shares

This guide will focus on installing Ubuntu as a base for a Torrent box that downloads directly to a TrueNAS box.

Prerequisites:
1. A Windows 10 Pro machine, with Hyper-V activated and appropriate BIOS settings allowing virtualization. For example, enabling both SR-IOV and SVM for AMD platforms.
2. A copy of Ubuntu distro [https://ubuntu.com/download/desktop]
3. A TrueNAS machine with SMB shares already working.

Part 1 – Installing Ubuntu on Hyper-V

  1. In Hyper-V Manager, click New > Virtual Machine.
  2. Example details:
    • Name: UbuntuVM [best to locate the VM on an NVME or SSD for better performance].
    • Specify Generation: Generation 1.
    • Startup Memory: 8192 MB [uncheck Dynamic Memory].
    • Connection: Default Switch.
    • Create a virtual hard disk: Name the vhdx and locate it on a NVME or SSD for better performance.
    • Size: 20GB
    • Installation Options: “Install an OS” by pointing it to the bootable Ubuntu ISO you downloaded.
    • Click “Finish”
  3. Before starting the VM, right-click on it and choose “Settings”.
    • Processor: adjust it to the number of processors you want the VM to use. Min 2.
    • “Network Adapter > Advanced Features”, you can set a static MAC address for DHCP purposes.
    • Click OK.
  4. Connect and Start the VM.
    • Choose language, keyboard.
    • Choose “Install Ubuntu”.
    • Choose time zone.
    • Choose minimal install.
    • Allow it to install and restart

Part 2 – Mapping TrueNAS SMB Shares Thru fstab

  1. Log into the Ubuntu VM and open a “Terminal”
  2. Install cifs-util:
    $ sudo apt-get install cifs-utils
  3. Make a mount point:
    $ sudo mkdir /mnt/[SomeDirectory]
  4. Create a file to store your SMB credentials:
    $ sudo nano /root/.examplecreds
  5. Add the following 2 lines with your SMB credentials:
    username=[SMBUserName]
    password=[SMBPassword]
  6. Write out the file [Ctrl-O] and exit [Ctrl-X].
  7. Edit fstab:
    $ sudo nano /etc/fstab
  8. Add the following line with your network specifics:
    //[TrueNAS IP]/[Share Name] /mnt/[SomeDirectory] cifs vers=3.0,credentials=/root/.examplecreds,noperm 0 0
    Here’s an example:
    //192.168.6.9/Media/Video/4K /mnt/4K_Videos cifs vers=3.0,credentials=/root/.examplecreds,noperm 0 0
  9. Write out the file [Ctrl-O] and exit [Ctrl-X].
  10. Test for issues prior to rebooting:
    $ sudo mount -a
  11. If no errors, reboot.

At this point, you will have a permanently mounted access to a SMB share on TrueNAS or any network storage device sharing thru SMB protocol. You can also add more SMB shares by repeating steps 3 thru 8. This will come in handy for when you want to write from you torrent client, such as Qbittorrent directly to your NAS upon completion.

References:
1. How to Install Ubuntu on Windows with Hyper-V – Aleksandar Kovačević
2. Permanently Mount CIFS/SMB Share in Ubuntu – Marc Jenkins
3. How to Mount a Samba Share on Ubuntu and Debian – Rahul Kumar

Liked it? Take a second to support RedEyeNinja on Patreon!
Become a patron at Patreon!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.