Search This Blog

Wednesday, January 4, 2012

Media Server - Share files to an Xbox 360

https://help.ubuntu.com/community/Xbox360Media

Ushare has been working flawlessly to stream media to my Xbox 360 for about a month now.  It does not, however, stream mkv or mp4 files.  Those must be converted to m4v or avi.

Google Tricks

Try typing these into Google (it helps to turn off instant search results):

do a barrel roll
let it snow
askew
google gravity      and then click "I'm feeling Lucky"

Play pacman:
www.google.com/pacman

Media Server - Hard drive spindown time

Hard drives that constantly spin are more prone to errors than those that spin down after some pre-determined time.  I usually run Ubuntu on a laptop, and with that configuration it is set to conserve power by spinning down hard drives from the Power Management dialog.  Due to knowing this, it never crossed my mind to even check the server for hard drive spin-down because I had just assumed it was already implemented, which was not the case.
In order to "buy" more life out of your hard drives, or to conserve electricity, use
hdparm to spin down the hard drives.  If you do not have hdparm installed, run:
sudo apt-get install hdparm

To set the hard drive to spin down, issue the following command:
sudo hdparm -S 120 /dev/sda
This will spin down the sda drive in 10 minutes.  The number scheme is weird.  Since it is based on a 0-255 range, the following correlate the minutes:
0: disabled (will never enter standby mode)
1-240: multiples of 5 seconds (ie 2=10 seconds and 120=10 minutes)
241-251: multiples of 30 minutes (ie 242=1 hr and 251=5.5 hrs)
252: 21 minutes (don't ask me why)
253: vendor supplied, somewhere between 8-12 hrs
254: reserved
255: 21 minutes, 15 seconds (again, no clue)


If you have multiple drives in your computer, this command must be run for each drive you want to spin down.
There is a downfall: the setting goes away once the computer is restarted.  Fear Not!  Add it in to rc.local to make it run on any change of runlevels (ie, during a startup):

sudo gedit /etc/rc.local

Unless you have already added something to rc.local, the only thing currently in there should be:
#!/bin/sh -e
exit 0

Or something along those lines (there may be a few commented lines describing what the file does between those two)


My rc.local now looks like the following, set up to spin down my system drives after 1 hr and my RAID drives after 10 minutes:
#!/bin/sh -e
#Set system drives to spin down after 1 hr idle time:

hdparm -q -S 242 /dev/sde
hdparm -q -S 242 /dev/sdf
#Set RAID drives to spin down after 10 min idle time:

hdparm -q -S 120 /dev/sda
hdparm -q -S 120 /dev/sdb
hdparm -q -S 120 /dev/sdc
hdparm -q -S 120 /dev/sdd
exit 0

The reason I want to wait a longer time for the system drives is that those get used more often for every-day tasks, and I don't want to wait for the hard drives to spin up each time I need to use the computer.  Since the RAID is going to constantly be seeking data while I stream to my TV and not at all when I do not, spinning down after 10 minutes seemed to be the logical choice.  The "-q" means it does it "quietly" (no visible output) during the startup.