Monthly Archives: December 2011

No Plugging, but everything’s playing!

I disappeared for a couple of days back there. And I’m extremely happy with what I’ve got going for now. In my NAS posts, I was trying to get RAID up so I could have this shared server for all media. Well, I’ve taken a step sideways. Instead of making it just a shared folder, I decided to aim for a media center.

At first there were two options: MediaTomb and XBMC. With my inability to get the latest version of XBMC running on Ubuntu 11.10 (graphics related crashes), I turned back to MediaTomb. Ah, I’m not really telling the story well. But here’s what I’ve reached so far so you know it works.

MediaTomb can function as an excellent Media Server (music, videos and images). You need to slightly tune the config file (links forthcoming) and now I’ve got it streaming to my PC, and my phone. Frankly, it’s better than attaching an external HD to my PC even! MediaTomb works with Media Player 11 on Windows 7, but with a stupid number of duplicate files showing. It isn’t MediaTomb. I tried on my mobile and it works fine and no duplicates appear. I’ll be trying XBMC too see if that functions well as a client.

For my Android, I’m using 2 tools: MxPlayer to render and UPnPlay to browse the list. UPnPlay could be better, but for a free product, it’s awesome!

Ran into one issue with some files not showing in MediaTomb, but found that this happened because of file permissions. This link helped resolve the issue.

NAS 7: Wow, that far ahead already?!

Yesterday, my first attempt at setting up RAID failed. The second attempt worked beautifully and after restart my raid showed up beautifully as


One thing remained. Making the RAID partition accessible. It’s not been formatted or mounted. And I’m looking up articles on LVM to understand why using LVM might be a better idea than managing it using the mkfs and mount commands. Here’s one awesome article that caught my eye. But it wasn’t much help!

I decided that using LVM was a good idea, so I started using this article to go about it. Here’s the sequence of commands:

sudo -i
pvcreate /dev/md0
vgcreate datavg /dev/md0
lvcreate -l 100%FREE -n MyData datavg
mkfs.ext4 -m 0 /dev/datavg/MyData
mount /dev/datavg/MyData /raid1
chmod 777 /raid1

In order – sudo switches me to the super user mode. pvcreate allows me to define a few physical volume (pv). vgcreate creates the Volume Group (vg). And finally lvcreate allows me to create the logical volume where I ask it for 100% of the free space and name it MyData. The mounting should be familiar. chmod 777 pretty much gives everyone full access to the drive, else I’d run into permission issues.

The coolest bit is the following. I opened up the LVM GUI and from there I looked up the info on MyData. There was a checkbox with Mount on Reboot. I checked that and voila, I’m done! Next phase will be to set up my media server!

Hatters? Mad?

In Paul Krugman’s column, I realized why Lewis Carroll’s character was named Mad Hatter! It appears that hat makers used Mercury to treat fur in the 19th century and the toxic fumes. I guess I could’ve learnt that from the Wikipedia article

I’m excited since I’ve got a few tasks lined up for myself:

  • Get the Media Server up and working
  • Visit Car Dealership
  • Check out Sofa and Desk sellers in today’s classifieds

NAS 6: misadventures too

Ouch! I was in trouble. As reported, I’d set up everything as per the documentation provided, but something just kept on going wrong! First I got the error saying that the device I wanted to mount onto /raid1 wasn’t ready and then when I did a check on the RAID status with:

cat /proc/mdstat

I kept getting reports on md127! I wanted md0! After much searching and trial and error, I found this post and after following YesWeCan’s suggestions, it worked like a charm. I removed the name parameter from the mdadm.conf and ran the update-intramfs –u command. That appears to have sorted out the issue!

To bed for me now. I’ll finish the rest of the config tomorrow.

NAS 5: mdadm adventures

Since I decided to proceed with software RAID, I had to figure out how to get it up and running. After browsing a few articles, I followed the outline of this one to set up mine. I made several errors and I guess that’s something to learn from. I think I’ll keep it short so you can see what the process is without going through a whole lot of text.

  1. First I created the partitions on /dev/sdb and /dev/sdc my two HDs. Refer to NAS 3 post for explanation. I used Gparted to do this, creating a primary partition and left it unformatted on both devices.
  2. Next I ran the following command:
    mdadm --create /dev/md0 --level=1 --raid-devices=2 \
     /dev/sdb1 /dev/sdc1
  3. Followed by this:

    mdadm --detail --scan > /etc/mdadm/mdadm.conf
  4. I hit a snag on 3, where I was getting a permission denied error. I found this post which solved the issue for me
  5. So in effect I ended it up running the following commands:

    sudo -i
    mdadm --detail --scan > /etc/mdadm/mdadm.conf
  6. To use the RAID I’ve got to format and make it available for use (mounting). So following the above commands I enter the following:

    mkfs.ext4 /dev/md0
    mkdir /raid1
    mount /dev/md0 /raid1
  7. The final bit is to edit the /etc/fstab file to edit that at the end of the commands in 6, type the following:

    gedit /etc/fstab
  8. You should see a graphical editor. Add this line to the end of the text on a new line (please use tab to separate the text instead of spaces):

    /dev/md0     /raid1    ext4    noatime,rw  0   0 

And voila, I’ve got an up and running RAID.

I open up a disk explorer (open any folder and point to the file system) and right click on raid1 and choose “sharing options”.  When I check “Share this folder”, I get the option to install Samba. I’m currently installing it. Once done, I should have a shared folder called RAID1 available to everyone!

I’ll just wait until the resync is done. Then, I’ll do a reboot to see if things are working as expected. If they are, my mission will be complete.

I expect I’ll have to work on some networking permissions to ensure that all computers on the home network are able to access the folder. I may also have to ensure (through firewall rules?) that this folder is accessible only via the home network.

NAS–the learning curve

I’ve been browsing. And it’s been interesting. It’s the classic learning curve issue. Since I thought of setting up “redundant” hard drives, I was looking at RAID1. Most documentation spoke of RAID and LVM. And somehow I got the impression that I could create a RAID using LVM, esp. since LVM has a checkbox that says mirror. Eventually, I figured out that what I was trying to achieve could be done in two ways: LVM mirroring or a software RAID. Yes, they’re two different things.

Software RAID1 requires 2 partitions of equal size. It’ll make sure that whatever’s written is written to both and when reading will check both. LVM Mirroring on the other hand requires 3 partitions: two partitions of equal size and a log partitions. It acts like the software raid to mirror the data, and it also writes a log. I’m still researching it, but I’m leaning towards the software RAID1 idea. 3 partitions gives me a headache. Doesn’t this mean a single point of failure? If the log partition blows, you’re done for. And it removes that beautiful symmetry that I was dreaming of. Pete, my friend had strongly recommended a Software RAID. At that time I thought he was recommending it as opposed to hardware RAID. I guess I know better now.

Now, I’m going to research how to create the software RAID!

NAS Box Part 3. And other stuff.

Last time we stopped at me being stuck about the screen. After some searching, I picked up a 15.6” Benq LED screen from – where else? – Nehru Place. My good old Microsoft wireless mouse and keyboard worked quite well – except the mouse seemed to be out of batteries. Impatiently, I plugged in another and continued.

In the intervening day, I’d had time to chat with my wife and she made a really good suggestion. Since this computer was so high spec, why not use it as a backup machine for home use anyways? I gave it some thought and agreed. Now that created another issue. I could no longer use FREENAS – at least not in the way I’d envisioned it earlier. So, I settled for Ubuntu as the desktop OS. I’d heard from my friends that this was perhaps one of the friendliest and nicest distros out there. I’d tried Zenwalk before and some of those lessons came in handy – esp. booting from USB.

Last year when I’d tried booting Ubuntu, I’d failed miserably, this time it worked like a charm and in no time I had Ubuntu set up. I had an older version and so I set it to upgrade to 11.4. Har har. Linux still has issues. The latest version is 11.10 – so after upgrading to 11.4 I had to upgrade again to 11.10! Waste of time, but you live you learn and I guess you pay for being lazy. I could’ve just downloaded the latest distro.

And yet again, I’m in some trouble. Coz, it appears that the desktop version of Ubuntu isn’t the best one for installing a Raid1 or so the tutorials say. Ok, I get confused about RAIDs too. Here’s a quick refresher on RAID.

Ok, so before I go mucking about let me explain my setup briefly. I’ve got 3 HDs:

  • HD1 is the boot hd with Ubuntu installed – 160 GB
  • HD2 and HD3 are the ones I want to use for my RAID1 – they’re both 1 TB HDs.

Most documentation that I’ve found online seems to work on the assumption that I want to use the RAID1 for my operating system, so they advise me to use a bootable cd (live cd) to configure it. I’m planning on jumping into the juicy post-boot bits to see if I can make it work. I’m still working on it and I’m taking some time off since I’ve got my first guest staying over and yesterday we watched Ghost Protocol and had some Masala Dosa and Vada Sambar. And today’s plan is to head to Khan Market and catch up on some shopping.