Pages

Monday, February 20, 2012

Ubuntu, an affordable media server

    Ubuntu is a Linux operating system that is both free and open source. It is also a great way to serve media to your home network and even your television for next to no money. 

    If your like me, you may have a few space PC part laying around. Most of these parts are the leftovers of countless upgrades over the years. My wife had been pestering me for a while to do "something" with all of that junk, so I did. I put a few pieces of, shall we say less-than high end parts together and got a simple PC up and running. The Ubuntu OS itself resides on its own dedicated hard disk that is a mere 300 gigs. The second hard disk is only a 750 gig, and that is the drive that is setup to both store and host all of my media files. 

    Before I get to far into this, I should point out that the "server" has been running near flawlessly for a little over three months now. Since the instill setup was completed, I have had to restart the machine only three times, and the last one was because I ran a series of updates that required a reboot to finish. 

    For software, I am using a generic install of Ubuntu 11, the Plex Media Server and of course "Samba" (with comes pre-installed on Ubuntu) for network file sharing. For hardware I am running a 2Ghz Intel quad core, 4 Gb's of ram and a DVI-HDMI adapter is plugged into an old 512Mb nVidia video card. No sound devices are connected to the server. The HDMI cable goes to the television and only acts as a monitor on the rare occasion that I actually need to be sitting at the server. That hasn't happened for a long time now. 

    For some stats on the 750Gb Hard Drive, I have have roughly 80 or so full length movies, and 14 television series that are complete. Everything I have is at least 720p, with more than half coded in 1080p HD. I still have 360 Gigs of free space left on that drive alone. 

    For legal reasons I recommend that you only rip DVD's that you actually own. I strongly encourage this actually. For one, you never have to worry about disks getting scratches or otherwise becoming unplayable, and if your hard drive crashes, you can always make another backup from the original. This is good reason to have multiple drives in a RAID array, but I am on a tight budget and really don't want to hassle with that as well. I already have backup in the form of the actual DVD's. 

    I am now ready to expand my servers capabilities. The good people at Plex also have both an iPhone and Android app so you can watch all of your shows while on the go. You don't even need VPN access. If you don't know what that is, don't worry, you won't need it all. 

    I will also be installing a third hard drive in the server. This one is a whopping 3 Terra Bytes. Thats roughly 3,000 Giga Bytes. Why you ask? Well for one, because I can. However, this drive will not be mainly for media storage; it will also be to used as a Time Machine Backup drive for my two Macs. 

    The drive be partitioned into three 1TB drives. Partition one will be for added media storage, partitions two and three will be for backing up each of the two Mac computers. To enable Time Machine to access a network drive there are a few this you have to do first:

1) Install the new Hard Drive and set all of the Partitions
2) Enable network Read/Write sharing for all the Partitions
3) In finder "Mount" the remote partition by using either "Command+K" or the menu option of "Go-=>Connect to Server"
4) Open Terminal and type the following commands:

    A)hdiutil create -size 1024g -library SPUD -fs HFS+J -type SPARSEBUNDLE -volname "Backup" /Volumes/Remote/backupvolume.sparsebundle

    B)defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

    C)open /Volumes/Remote/backupvolume.sparsebundle

    D)sudo tmutil setdestination -p /Volumes/Backup

    That's it. If you get an error creating the "sparsebundle"file on the remote machine directly, just "cd" to a local drive and copy the new file after you create it. 

    It is important to note the -size 1024g on step "A". You want to set this to the largest size your drive can handle. If fact, you don't even "need" a separate partition at all. You actually have multiple "sparsebundle" files on the same drive. Time Machine will see this file as a virtual Hard Drive and treat the file just like any other drive. 

    Now that I have shown you the hard way, I will show you the easy way. First, Complete steps 1, 2 and 3 from above. Then open "Disk Utility", a very powerful program. Next, select menu options "File -=> New -=> Blank Disk Image". Click the "Down Arrow" to the right of the "Save As" text field to expand it. Navigate to your remote shared folder. Set the "Name" field to something like "Backup". Set the "Size" to just larger than your drive (or as large you want the maximum file size to be). If you make the file "too big" disk utility will auto size it to fit. 

    Next, set the "Format" to Mac OS Extended (Journaled). Set Encryption to "128-bit AES encryption (recommended). Set "Partitions" to No Partition Map. Set "Image Format" to read/write disk image.

    Once your ready, click create. 

    Preform steps 4) B, C an D) from above. This will allow Time Machine to see network drives and make the connection to Time Machine. 

   If you you use Disk Utility to create the file, and you set the size to 1.00TB it will actually be 1.02 due to a rounding error. If you set it to 1024GB, it will become 1.05TB for the same reason. This could also be for extra space needed for the file system, I am really not sure, nor does it matter. Just be aware of it. 

    In closing I should point out that I have less than $200 wrapped up in the server, and the new 3TB hard drive I ordered from Amazon for only $249. For less than the cost of a Mac Mini, I have a server with nearly 4TB of storage, it processes media to my TV through my Roku box or to my cell phone, and does encrypted backups. Not to shabby, but it is an eye sore, so I stuffed it behind the TV stand. 

    Until next time .... 

    

No comments:

Post a Comment