Connecting to a Maxtor Central Axis NAS via Linux
Background
I'd been wanting a network attached storage (NAS) device for a while for a couple of reasons. First, it's a whole lot faster than USB 2.0. And second (and more crucially) a NAS would be accessible from anywhere on my network at anytime so I wouldn't have to lug around an external USB device when doing things like backups, software loads, etc.So after doing some research, I decided on the Maxtor Central Axis 1TB unit. This unit provided me with what I needed (a massive NAS) plus two other functions: the ability to connect an external USB device like a printer or an external hard drive and the ability to access it over the web. I also got more of a chore getting it to work on Linux than I thought.
Set-Up
The unit comes with an ethernet cable and a power supply. Connection is simple. Plug in the ethernet cable to the unit and your router then plug in the power supply.Initial power on will configure the network connection via DHCP. However, this is where the Windows and Mac OS only mind-set of Maxtor rears it's ugly head. The only way to tell what the IP address is (according to their skimpy setup guide) is to install their proprietary utility. I found the address by going into my router and looking at attached devices.
After getting the IP address, I fired up Firefox and surfed over to the unit's web-based utility. I was greeted with a message stating that I needed to set a password and other configuration items. This I did and within five minutes I was all done. Additionally, I changed from DCHP to a static address.
The web-based utility is fairly easy to work with, but has one major drawback: once you create directories on the unit, you can't rename them. You can delete them and suspend access to them, but that's it. The Windows/Mac OS utility is no better.
For what it's worth, the proprietary Windows utility works perfectly under VMWare (tested on version 5.5.9).
Accessing via My Network
Accessing the unit under Windows (and I suppose Mac OS) is a breeze. The unit shows up right away in your "network neighborhood." Linux is another story, which is funny considering the unit uses Linux as it's OS and Samba to share out directories, files and USB connected printers.Since my Ubuntu box had file sharing already setup via Samba, I thought I would be able to see it by browsing in Nautilus. No suck luck. I swithched over to my Xubuntu box. This one has the fusesmb package on it for browsing Windows (and other) shares. Again, no luck.
After quite a bit of Google research I found that network browsing, whether in straight Ubuntu via Nautilus or in Xubuntu with fusesmb, has become problematic with the 8.04 release. Interestingly, the rarely updated since 2004 xsmbrowser utility can see the shares as well as access them without any problems.
Using the xsmbrowser utility gave me some insight into the mount commands I needed to mount the shares on the unit. After further research (and pulling out my O'Reilly Using Samba book) I determined that I would need to mount the shares as a CIFS filesystem via the mount command. Now, I could have put the mount parameters in the fstab, but I wanted to mount and unmount the shares as needed and not everytime I booted (especially on my laptop). This would require command line interaction, something the wife isn't too keen about. Naturally, a script was needed. Thus was born the script at the end of this page.
Accessing via WWW
Accessing the Maxtor Central Axis via the WWW requires a couple of things. First you have to enable this option on the unit via the browser-based utility. Second, you have to have an account on the globalaccess.seagate.com site to connect you to your unit via WWW. That's right. To access your unit while away from home, you logon (securely) to globalaccess.seagate.com which in turn connects to your unit. Now, I'm not too keen on Seagate having access to my NAS and all its contents so I turned this feature off.Sharing A Printer
I haven't tested this feature out yet. I plan to in the future though. When I do, I will update this section.The Script
The script below is tailored to fit the computers in my house. Your mileage may vary. As the license states in the script, feel free to snag it and use it but you have to give me credit for it and let me know of any changes that make using it better.The script requires a bit of configuring locally for smooth use.
- Samba packages for proper use. On Ubuntu-based distros these are: samba-common, samba-tools, smbclient and smbfs.
- The shares to mount. These are specified in the SM1 and SM2 variables and are the reason I changed from DHCP to static IP on initial set-up.
- Someplace to mount the shares from the unit. These are specified in the MP1 and MP2 variables.
- A file containing the username and password of an authorized user. See the .smbpasswd example below the script. This file is plaintext so take care where you put it. You really only need this if you are going to have seperate directories with limited access. If you are only going to use the wide-open Public directory, then consider modifying the script as needed.
maxtor.sh - the mount/unmount script
#!/bin/bash
# Purpose: To mount and umount shares on a Maxtor Central Axis
# network storage device via smb.
# Author: J Paul Richardson, http://www.reverendlinux.com, paul@reverendlinux.com
# License: Released for free use by any and all for any use with the
# consent by the user to 1) give credit to me as the original
# author; and 2) notify me of any changes to this script that
# enhances its operation and/or usability.
# Some variables:
# USER = username as returned by the id command
# NUSER = username with first letter uppercased via sed
# CRED = location of credentials file containing samba user and password.
# IP = IP address of the Maxtor NAS
# SM1 = First share to mount
# SM2 = Second share to mount
# MP1 = First mount point; corresponds to SM1
# MP2 = Second mount point; corresponds to MP2
USER=`id -un`
NUSER=`echo $USER |sed 's/\([a-z]\)\([a-zA-Z0-9]*\)/\u\1\2/g'`
CRED="/home/$USER/.smbpasswd"
IP="192.168.16.9"
SM1="//$IP/$NUSER"
SM2="//$IP/Public"
MP1="/home/$USER/MaxtorNAS-$NUSER"
MP2="/home/$USER/MaxtorNAS-Public"
# Check for existance of mount points. If not there, create them.
if [ -d $MP1 ]
then
echo "First mount point exists......continuing."
else
echo "First mount point does not exist...creating"
mkdir $MP1
fi
if [ -d $MP2 ]
then
echo "Second mount point exists...continuing."
else
echo "First mount point does not exist...creating"
mkdir $MP2
fi
# Check to see if the share is mounted. If it is, unmount it.
# If it is not, mount it. If mount/unmount is successful, set
# error state variable (ERR) and set message to be displayed (MSG1).
# If unsuccessful, do the same.
mount | grep "on ${MP1} type" > /dev/null
if [ $? -eq 0 ]
then
`gksudo "umount $SM1"`
if [ $? -eq 1 ]
then
ERR=1
MSG1="There was an error unmounting $SM1"
else
ERR=0
MSG1="Unmounted $SM1 from $MP1"
rm /home/$USER/Desktop/MaxtorNAS-$NUSER
fi
else
`gksudo "mount -t cifs $SM1 $MP1 -o uid=$USER,gid=users,file_mode=0664,dir_mode=0775,iocharset=iso8859-15,credentials=$CRED"`
if [ $? -eq 1 ]
then
ERR=1
MSG1="There was an error mounting $SM1"
else
ERR=0
ln -s $MP1 /home/$USER/Desktop/MaxtorNAS-$NUSER
MSG1="Mounted $SM1 to $MP1"
fi
fi
# Repeat for second mount point.
mount | grep "on ${MP2} type" > /dev/null
if [ $? -eq 0 ]
then
`gksudo "umount $SM2"`
if [ $? -eq 1 ]
then
ERR=1
MSG2="There was an error unmounting $SM2"
else
ERR=0
MSG2="Unmounted $SM2 from $MP2"
rm -rf /home/$USER/Desktop/MaxtorNAS-Public
fi
else
`gksudo "mount -t cifs $SM2 $MP2 -o uid=$USER,gid=users,file_mode=0664,dir_mode=0775,iocharset=iso8859-15,credentials=$CRED"`
if [ $? -eq 1 ]
then
ERR=1
MSG2="There was an error mounting $SM2"
else
ERR=0
ln -s $MP2 /home/$USER/Desktop/MaxtorNAS-Public
MSG2="Mounted $SM2 to $MP2"
fi
fi
# Display a status message based on error state ($ERR). If an
# error did not occur (ie - $ERR = 0), display a zenity info dialog
# with the messages ($MSG1 and $MSG2). If an error occurred,
# display the messages in a zenity error dialog instead. I
if [ $ERR -eq 0 ]
then
zenity --title="Success!" --info --no-wrap --text="$MSG1\n$MSG2"
else
zenity --title="An error was encountered" --error --no-wrap --text="$MSG1\n$MSG2"
fi
.smbpasswd - the password file for accessing restricted shares on the unit
username=me password=myP@ssword