Jump to content

* How to * MythBuntu 14.04 KVM w/ HDHomerun Primes, and outside the array HDD


mikedpitt420

Recommended Posts

I had a user message me and ask me how to accomplish this, and I've actually also helped two other people do this personally so I thought I would go about posting my experience, and how I run Mythbuntu 14.04 in KVM on unRAID. I'm sure it's not the most perfect method, and I'm sure that there are other better ways to do some of the things in this post, so I'm all open to suggestions. During my setup I did find through my forum posting that doing a 9p type filesystem in fstab to mount an unRAID share from within the VM isn't necessarily the best way to do it, but it works so I honestly just left things as they are and they've been running very well. So you can choose to do that however you like, I believe it should be just a normal samba share. Again this is just my experience and it works, but very open to any changes or suggestions. I'm also aware of SparklyBalls MythTV docker which I encourage everyone to try before all of this. I personally wanted more control over my setup and chose a VM over a pre-baked docker but if you're looking for simplicity that's the way to go. I wouldn't have even thought a working docker with Mythbuntu / working MythWeb etc. could be built, and I wouldn't even have remotely tried to attempt it myself. So MAD respect to SparklyBalls and in no way am I trying to discourage people from going that route. Having said all of that....

 

I didn't want to run MythBuntu and have it store it's absolutely giant recordings it generates on the array or my relatively small SSD cache drive. For those of you that don't have experience with MythTV the output MPEG files are HUGE. Even several people casually watching Live TV ( of which it stores for 24 hours by default for FF/REW purposes, and this can be adjusted if you're hurting for disk space) can create quite a bit of video data, so for this reason I opted for adding one 1TB outside the array HDD to store both the ISO for MythBuntu to load from since it doesn't affect adversely performance, and the recordings that MythTV generates. The VM itself runs on my SSD cache drive.

 

1. Install the "Unassigned Devices Plugin" here: https://raw.githubusercontent.com/gfjardim/unRAID-plugins/master/plugins/unassigned.devices.plg

 

2. (Optional) Install the Pre-Clear plugin. It's still in beta, but I've had great success with it so far. It was also one of the last things I actually found myself dropping to command line with any frequency so I think it's a nice step forward for unRAID in general. Note, you also must follow the instructions for where to actually place the preclear_disk.sh script itself on the flash drive where the plugin will look for it :

https://raw.githubusercontent.com/gfjardim/unRAID-plugins/master/plugins/preclear.disk.plg

 

3. Preclear the HDD you plan to use, clear the statistics from it through the unassigned devices plugin. Format the drive to XFS also via the Unassigned Devices Plugin.

 

4. From the unassigned devices plugin on the unRAID MAIN screen, click the small "+" icon below the drive (make sure it is unmounted)

 

5. Click somewhere inside of the mount path, and change it to read "/mnt/disks/mythtv"  **note the extra "s". That is intentional and I use it as a way to separate my array disks from my non array disks when I'm banging around in the CLI. So it's not a typo.

 

6. Press ENTER inside of the text box to save your text changes, and mount the share. It is now accessible via the CLI at that location.

 

7. SSH into the server, and create two directories on this new HDD. One called "ISO" and one called "recordings". The final paths should be /mnt/disks/mythtv/ISO and /mnt/disks/mythtv/recordings

mkdir /mnt/disks/mythtv/ISO
mkdir /mnt/disks/mythtv/recordings

 

8. Download your Mythbuntu 14.04 ISO from their website, and place it in the directory /mnt/disks/mythtv/ISO . If you're having trouble getting the ISO there, from the CLI

cd /mnt/disks/mythtv/ISO
wget http://cdimage.ubuntu.com/mythbuntu/releases/14.04.3/release/mythbuntu-14.04-desktop-amd64.iso

For 64 bit systems only. Please refer to Mythbuntu's download page if you need links to another version for some reason : http://cdimage.ubuntu.com/mythbuntu/releases/14.04.3/release/

 

9. From the unRAID UI, go to Settings >> Network Settings and create a bridge adapter called br0. I chose to specify an IP address automatically as I use my router's DHCP server to assign IP's via MAC address but you can specify one or use DHCP and your router. Either will achieve the desired effect of giving this VM a static LAN IP.

 

10. From the CLI, create a directory on your cache drive called /mnt/cache/vmdata/MythTVKVM

 

mkdir /mnt/cache/vmdata
mkdir /mnt/cache/vmdata/MythTVKVM

 

This is where the actual VM will run its' operations. It's worth taking note that the difference in running a VM from an HDD and an SSD, especially in the context of what MythBuntu is doing, which requires quite a bit of I/O, is EXTREMELY significant. I'm honestly not 100% sure it wasn't something to do with my hardware, but running this in the same way in a VM from an HDD, I could BARELY pull 3 HD 1080i streams without it choking, no matter how many cores or how much RAM I gave it. Running it from a proper SSD cache drive made a HUGE difference in performance. I can now do 6 1080i streams with 1 core and very little devoted RAM as mentioned below and in the attached settings screenshot.

 

11. Now we need to create the VM itself. Open your unRAID KVM manager, and create a new KVM. Attached are a screenshot of my settings. You can create any MAC you like, but make sure you are using the newly created br0 network interface.

 

12. Create the VM, and check on your router that the VM has indeed popped up, is on the network, and has the correct LAN IP address.  You can see from the attached image I gave my MythBuntu VM 2 cores (although it did run fine pulling 6 HD streams with 1, I wanted to give it some buffer) and very little memory. It works wonderfully to watch or record 6 simultaneous 1080 HD streams and I don't have some great hardware running it. See my sig for my specs. 

 

13. From the VM tab in the unRAID UI, click on your newly created and running VM icon, then click "VNC REMOTE". This will drop you into the VM in X-Windows.

 

14. You will be prompted to install MythBuntu. Follow all of the prompts, install the updates etc to finish you installation. Reboot your VM, and get yourself back to the VNC Remote.

 

15. From the menu, open a terminal window and type:

sudo nano /etc/fstab

You need to add this line to the bottom of this file:

shares	/mnt	9p	trans=virtio,version=9p2000.L,_netdev,rw	0	0

 

EDIT: Please refer to the next post down for another (more correct) way of editing your fstab file inside of your VM to mount this remote unRAID share

 

Now, save fstab, reboot the VM. From The CLI within your VM /mnt should have mounted /mnt/user/disks/mythtv

Check via the CLI on your MythBuntu system to be sure

cd /mnt/
ls -la

as long as you see your directories you've created earlier "ISO" and "recordings", your remote unraid share is mounted.

 

16. Run the MythTV configure through the X-Windows menu, and setup your tuners, episode guide provider, and storage directories for MythTV (I prefer schedulesdirect as you can trim down all the channels you care nothing for). Your recordings directory for both "recordings" and "LiveTV" should reside within the /mnt/recordings directory from within the VM. So all of my scheduled recordings end up in /mnt/disks/mythtv/recordings/ and all of the stuff that's deleted daily for live tv is in /mnt/disks/mythtv/recordings/livetv . Just remember, that from within your VM, this directory is just called /mnt. But from the rest of your actual unRAID box, the former path is where they reside, which should also already be shared via samba as "mythtv" so you can access your recordings through a SAMBA share to manipulate them however you like. From the MythTV configuration menu, you want to change all of your "Directories" settings to be somewhere in /mnt .

 

17. For future ease of use in manipulating recordings etc. I would recommend mapping a network drive samba share (through windows of whichever OS flavor you choose) to \\your.server.IP.address\mythtv so you can grab, edit, copy, and delete your recordings without having to drop into the actual VM itself.

 

Well, that's it :D You're now all setup and can get to tweaking all of your mythtv settings the way you like them with commercial editing, transcoding with handbrake, etc. I don't have ANY information of commercial editing, transcoding, or anything of the like. I primarily use this for NHL and NFL, and to record Jeopardy daily. I don't save any of these recordings or edit them to store in my library (that's what Usenet is for :P again, see my sig). It works like a charm, the guides in kodi are gorgeous (especially with Aeon Nox) and the box is quick and responsive to tune channels. From my small experience with Myth's commercial flagging, it depends on the channel entirely and works ~ 50% of the time. So for my purposes, this is for watching sports live. Yes, I'm a sad sop who pays for cable for that only....

 

I hope this has helped some users, and again, I'm open to any comments or suggestions. 

 

EDIT: 9/26/16 after upgrading to unRAID version 6.2 this fstab entry no longer works (as it probably shouldn't have in the 1st place as mentioned above). Here is a link to the correct fstab entry to automount an outside of the array share from within an Mythbuntu 14.04 KVM : http://lime-technology.com/forum/index.php?topic=52313.0

mythvmsettings.PNG.9836f7efa305e3602ffddff2cd97c25f.PNG

Link to comment

Nice write up. Like you I've helped a few users set up a mythbuntu vm and the only thing I might add is to mount a non array disk separately just for tv recording. I've always had one disk for os (ssd) and a spinner for recording. Right now I have a 7200 rpm 750GB 2.5" drive for recording. The reason I would mount it directly vs 9p sharing is the performance from 9p seems lacking and even slower on some systems than a network share. There's a thread on here somewhere with lots of test results.

Thus is how I mount it in the vm.

    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/disk/by-id/ata-WDC_WD7500BPKX-00HPJT0_WD-WXL1E84AK1MK'/>
      <target dev='hdb' bus='virtio'/>
    </disk>

And this is my fstab. I use jfs but xfs is fine and you don't need extra packages loaded for xfs. I mount it to /var/lib/mythtv so no directory changes have to be made to the backend setup. I backed up the original /var/lib/mythtv and copied the contents of mythtv to the root of the recording drive. I do all this from a vnc window to the vm.

/dev/vdb1 /var/lib/mythtv        jfs    rw,noatime,nodiratime,errors=remount-ro 0    1

Link to comment

That definitely sounds like a superior method, but that was for me one of the more tricky parts. Getting the right fstab entry from within the VM was driving me insane, so once it worked I just left it alone :P I could mount it no problem via the CLI and the normal mount command, but that was the only way I got it to work with fstab. Thanks for that very much. I've edited my post to point towards your instructions as well. Although I've heard that as well and toyed with the idea of changing it, as stated I do 6 streams no problem, which is the amount of tuners I have. So it at least works "that much". Thanks again dmacias :D

Link to comment

I just passed the whole disk to the vm then I used gparted from inside mythbuntu to partition it. Your way offers advantages too. You can use only a portion of a disk and it's visible to both unRAID and mythbuntu. I don't save any recordings to the array. Any series I want to save I just download.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...