This blog is NOFOLLOW Free!
Print This Post Print This Post

The Linux Chronicles – WD MyBook NAS Storage

PermaLink

wdfMyBook World H1NWith just a little over a TB of storage on-hand, things were getting kinda tight (who’da thunk that 5 years ago?) so I decided to buy some storage. To reduce the number of connections to my computer, this time I wanted Network Atached Storage. NAS is really a small computer and drive combo in a nice little enclosure. It usually runs Linux and when attached to the ethernet, becomes another network file server.

I looked around and decided that the 1TB Western Digital MyBook World Edition would be a good option. I’ll tell you right up front that if I knew then what I know now, I’d have spent the extra money for the MyBook World Edition II. This box contains two drives arranged in a RAID configuration. The data is stored redundantly on both drives. If one drive fails, simply remove it and replace it. No data lost. Oh well, I got the Edition I and this is a review of that device.

Amazon had it on sale for just a touch over $100 so I bent the plastic and got one. It arrived complete with ethernet cable and wall wart. That’s my only minor quibble. The wall wart takes up a lot of room on the outlet strip. I wish they’d used a power brick with a cord like most computer accessories do today.

I plugged it in, attached it to my router and it came up immediately. For my winders software development machine, attaching the drive was just a matter of running the setup disk. Some PFM happend and it showed up as drives Y and Z.

This brings up the next thing that I don’t like about the drive. It comes divided into 2 shares called Downloads and Public. These are not removable. Fortunately the whole drive is available to either share so it is more a nuisance than a show stopper.

Setting up Linux is a bit more involved. I’ll outline the process here. Any device on a network has to have an IP address. The MB comes out of the box set up to get an address via DHCP. In my case, my HughsNet modem is the DHCP server. The drive got assigned the next available address in the 192.168.0.x space. That’s fine on a pure windows network but Linux and NFS (Network File System) really need a static address. So the first thing to do is to change the drive to static addressing.

The first step is to fire up your browser and log onto the built-in web server on the drive. Simply enter http://192.168.0.x, replacing X with whatever number was assigned the drive. You may have to try a few to get the right one. If your network is small, x is likely to be 2 or 3.

Log in using “admin” as both the userid and password. Click on the “Network” icon. Click on the drop-down and select “static” for network node. Since DHCP assigns addresses from typically 2 (1 is reserved for itself), convention is that static addresses be assigned from 254. On my system, my router is 192.168.0.254 so I assigned my drive the address 192.168.0.253. Note: some LANs use the private IP address range of 10.0.0.x. If yours does then substitute that for the 192.168.0.x in these instructions.

Now some sleuthing must be done. You need to know your gateway to the internet and your DNS servers. The gateway is normally your broadband modem which usually has the address 192.168.0.1. On a windows system, the easiest way to find out both the gateway and the DNS servers is to click on the network icon in the tray and follow the prompts to that info. Sorry I can’t be more specific but I don’t do winders :-)

My gateway is my HughsNet Satellite modem at 192.168.0.1 and my DNS servers are 67.142.160.8 and 67.142.160.9. Do not use these! They are specific to my installation. Use either the DNS addresses provided by your ISP or a public server such as this one.

OK, we have a static address assigned so now let’s make the drive available to the linux system. With Ubuntu, convention is that external drives are mounted in /media.

The first step is to open a shell window (Applications->Accessories->Terminal) and execute the command

$ cd /media

Then execute the following commands

$ sudo mkdir public
$ sudo mkdir download

This creates two mount points. next, execute these commands

$ cd /etc
$ sudo gedit fstab

/etc/fstab is the place where all drive mounting information is stored, including network drives. Once in the editor, add these two lines:

192.168.0.253:/nfs/Public /media/public nfs
192.168.0.253:/nfs/Download /media/download nfs

Substitute the IP address of your MB if it is different from mine. Save the file and exit the editor. Now execute this command

$ sudo mount -a

This tells mount to mount all the drives listed in the /etc/fstab. Mount normally works silently so if you get nothing other than a command prompt, you know that it worked. Eror messages must, of course, be addressed.

Now when you click on Places, you’ll see two new places, “public” and “download”. See, wasn’t that easy? The two shares should mount automatically during boot but if they don’t, simply open a shell and execute “sudo mount -a” again.

The Downloader

One of the neat features of this drive is the downloader. Through the clunky web interface, you can start a download directly to the WB and then turn your computer off if you wish. Very nice for getting those new Ubuntu ISO releases.  It can do both HTP/FTP and BitTorrent. The downloader contains a scheduler so I can, for example, set it up to only download during my quota-free hours in the early morning.

To access the downloader, log out of the drive’s web interface if you’re in “admin”. Enter http://192.168.0.x into your web’s browser as before. Select “downloader” from the drop-down menu. This time enter “downloader” as both the userid and password. Then just follow the simple prompts. The only minor negative is that you have to locate the URL of the download in your browser and then cut and paste that address into the downloader menu. A plugin for Firefox that intercepts clicks and fires off the downloader would be nice. We can always wish…. :-)

The Good Stuff

The good stuff is the embedded Linux system. Fortunately WD responded to user requests and made the shell easily accessible. Having the root shell means that you can hack the system or just play around and learn Linux. Always been interested in Linux but didn’t want to buy another computer? For just over $100 you can get a Linux machine with a 1TB hard drive attached!

The first step is to enable SSH (Secure SHell) on the MB. Log into the admin web interface and click the Advanced button at top and then click the “Advanced” button. The first option is to enable root shell. Click the check-box beside “Enable”. Click “Submit”. There, you’re done.

If you’re on a windows machine, you’ll need an SSH client. I recommend Putty. If you’re on a Linux box then SSH is built in. Open a shell window as described above. Type the following command

$ ssh -l root 192.168.0.253

Using the IP address of your MB, of course. You’ll be prompted for a password. Enter “welcOme”. That’s an upper-case O and not a zero. You should get the normal # root prompt. From there you can do most anything that you could do on any Linux box.

WD has chosen to strip away some of the system such as the C compiler. Too bad. However, the hacker community has come to the rescue. Google “Hacking the Western Digital MyBook”. Note that the version being sold as this is written is the white light version. The blue band version is obsolete so don’t get sidetracked into trying to do hacks for it.

Incidentally, if you don’t want to use the clunky downloader interface, you can use the program “wget” directly. From the shell prompt, if you want to download to the /nfs/Download directory (where it will show up on your network drive), simply do the following

# cd /nfs/Download
# wget <url of the file to download>

If you want to duplicate the functionality of the downloader that lets you start a download and then go to bed, use this command.

# nohup wget <url> &

Nohup tells the system not to kill the process when you log out and the “&” on the end puts the job in the background. You’ll notice a number in square brackets like this [1] when you execute the command. That’s the job number. You can bring the job back to the foreground with the command

# fg 1

If you forget the “&”, a ^Z will put the job in the background. The process stops the job so execute

# bg 1

to restart it.

External Drive

The MB has a USB port where you can connect an external drive. This drive can be used to back up the MB or it can be mounted as another network drive. In windows, when the setup utility is run, the external drive shows up as drive X:.

For some reason the MB comes configured to disable NFS on the external drive. I prowled around the system for awhile and determined that I’d have to hack system files to enable it. This would FUBAR any future firmware upgrades so I decided not to.

Fortunately the drive can be mounted as a microsoft network drive using SAMBA on the Linux machine. Ubuntu comes with SAMBA installed so only two things have to be done to mount the drive. Create a mount point and edit /etc/fstab. Here are the commands. I called the mount point 1tb because the external USB drive that I bought at the same time is also a 1Tb drive. Open a shell window on your Linux system.

$ cd /media
$ sudo mkdir 1tb
$ gedit /etc/fstab

Go to the bottom of the file and enter this line

192.168.0.253:usb1-1share1 /media/1tb smbfs

“usb1-1share1” is what the MB’s linux system mounts the external drive as. It is mounted in /nfs but you do not enter a path in the mount command for the microsoft network like you do for NFS. Save the file and execute

$ sudo mount -a

You’ll see “1tb” show up in “Places”.

File Copy

The last facility that is built into the MB is a file copy utility. This allows you to copy files to and from the MB and the external drive without the data having to travel over the network. The copy is VERY fast.

To access this facility, log into the web interface as before. Enter “admin” as the userid and password and choose “Copy Manager” from the dropdown menu. Then follow the prompts.

A very handy use for this facility is to back up the MB onto the external drive. It can also copy to and from thumb drives and portable drives. Unfortunately it can’t download from cameras. I don’t understand why since Ubuntu has that ability.

My SetupWell, that ’bout wraps it up. Oh, before I forget, here’s my setup. I like the contrast between the new and the old (dial phone and converted oil lamp). Everything on that table runs from a large UPS in my basement, as does my computer so I’m immune to the daily power drops and chugs that goes with living in the mountains.

Oh, before I forget #2, change those password! Since your drive is sitting on a network accessible to the world, it is subject to being hacked.  leaving the default passwords is practically a guarantee.  You can change some of the passwords from the web interface but you can change them all from the root shell prompt and do so much faster.  SSH into the MB.  Then use the following commands.

# passwd root
# passwd admin
# passwd downloader

Then you can enter the new password.  You may use the same password for all three.

Enjoy,

John

Posted by neonjohn on December 22nd, 2009 under Computing



One Response to “The Linux Chronicles – WD MyBook NAS Storage”

  1. Daniel @ Status Page Says:

    WD have been making some great drives and NAS units.

Leave a Comment

Comments links could be nofollow free.

*





Meta: