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 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.Attaching A USB Device
The NAS has one USB port for connecting USB devices like printers, external hard drives and such. I connected an external USB 500GB hard drive and it showed up right away as another share. I haven't tested this feature with printer yet.Accessing via A 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 devices like 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 such 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. This research also showed me that there are three ways to access the Central Axis NAS: 1) by permanently inserting the CIFS mount info into /etc/fstab; 2) using the Ubuntu "Connect to Server..." menu option under Places; and 3) writing my own script.
For either of these three options to work, you will need the Samba installed. On Ubuntu, the following packages are required: samba-common, samba-tools, smbclient and smbfs.
The /etc/fstab Option
If I wanted to have the shared folders on the NAS accessible every time I booted, I would need to have something like
this in my /etc/fstab file for each share.
//<IP Address of NAS>/<Share name> /<Path to>/<mount point> cifs uid=<my username>,gid=users,domain=<network domain>,nounix,file_mode=0777,dir_mode=0777,credentials=<path to credentials file> 0 0 0 0
So mine ended up looking like this:
//192.168.1.25/Public /home/paul/MaxtorNAS_Public cifs uid=paul,gid=users,domain=HOME,nounix,file_mode=0777,dir_mode=0777,credentials=/home/paul/.smbpasswd 0 0 0 0 //192.168.1.25/Paul /home/paul/MaxtorNAS_Paul cifs uid=paul,gid=users,domain=HOME,nounix,file_mode=0700,dir_mode=0700,credentials=/home/paul/.smbpasswd 0 0 0 0
A couple of parameters to note. The credentials= parameter points to a file that contains the username and password that is used to access a protected share on the NAS (as defined using the setup utility). The file format and contents are shown at the bottom of this page.
The nounix parameter turns off Unix Extensions. This allows you to use the next two parameters, file_mode and dir_mode to specify the default permissions that will be set when new files and directories are created. These three parameters are also used in the script option as well.
Finally, you need to have a place to mount the shares to. In my case, I created sub-directories in my home directory called MaxtorNAS_Public and MaxtorNAS_Paul.
The "Connect to Server..." Option
This option is available in various places depending on which version of Gnome you are using. A common way to find this
option is to open a Nautilus window and click on File --> Connect to Server... This will open the Connect to Server
dialog where you can fill in the appropriate fields accordingly.
Type/Server Type: Select Windows share Server: Enter the address of NAS Share: Name of Share, i.e - Public or Paul Folder: This is optional; use only if you want a specific folder within the share User Name: This is optional for the Public share. For personal shares, enter the user name you defined when you created the share on the NAS. Password: This is optional for the Public share. For personal shares, enter the password that corresponds with the user name. Domain Name: This is optional
Once filled in, click on Connect and the share will be mounted. If a password is required, you will be asked for this.
Writing A Script
A roll-your-own script allows you to customize how and when you mount the shares. This is the option I went for
because it works with pretty much any flavor of Linux and gave me the flexibility I needed for mounting and
unmounting.
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 cool changes that make using it better.
As with the /etc/fstab and "Connect to Server..." options above, this 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 names of 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. 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:
# GSUDO = Path to graphical sudo interface
# DOMAIN = Network domain
# 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
# USRSHM = User share to mount
# PUBSHM = Public share to mount
# USRSH = User mount point; corresponds to USRSHM
# PUBSH = Public mount point; corresponds to PUBSHM
GSUDO="/usr/bin/beesu"
DOMAIN="HOME"
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.1.25"
USRSHM="//$IP/$NUSER/"
PUBSHM="//$IP/Public/"
USRSH="/home/$USER/MaxtorNAS-$NUSER"
PUBSH="/home/$USER/MaxtorNAS-Public"
# Check for existance of mount points. If not there, create them.
if [ -d $USRSH ]
then
echo "First mount point exists......continuing."
else
echo "First mount point does not exist...creating"
mkdir $USRSH
fi
if [ -d $PUBSH ]
then
echo "Second mount point exists...continuing."
else
echo "First mount point does not exist...creating"
mkdir $PUBSH
fi
# Check to see if the share is mounted. If it is, unmount it.
# If it is not, mount it.
mount | grep "on ${USRSH} type" > /dev/null
if [ $? -eq 1 ]
then
USTAT="Unmounted"
else
USTAT="Mounted"
fi
mount | grep "on ${PUBSH} type" > /dev/null
if [ $? -eq 1 ]
then
PSTAT="Unmounted"
else
PSTAT="Mounted"
fi
ANS=$(zenity --list --text "Select a Share to Mount" --checklist --title "Maxtor Mount" --column "" --column="Share Name" --column="Status" FALSE $NUSER $USTAT FALSE Public $PSTAT)
if [[ "$ANS" == "Paul" ]]
then
if [[ "$USTAT" == "Unmounted" ]]
then
`$GSUDO "mount -t cifs $USRSHM $USRSH -o uid=$USER,nounix,domain=$DOMAIN,gid=users,file_mode=0700,dir_mode=0700,iocharset=iso8859-15,credentials=$CRED"`
if [ $? -eq 1 ]
then
MSG="There was an error mounting $USRSHM."
else
MSG="Mounted $USRSHM from $USRSH"
fi
elif [[ "$USTAT" == "Mounted" ]]
then
`$GSUDO "umount $USRSHM"`
if [ $? -eq 1 ]
then
MSG="There was an error unmounting $USRSHM."
else
MSG="Unmounted $USRSHM from $USRSH"
fi
else
zenity --error --text "Unable to determine how to deal with $USERSH."
exit
fi
# User selected Public only
elif [[ "$ANS" == "Public" ]]
then
if [[ "$PSTAT" == "Unmounted" ]]
then
`$GSUDO "mount -t cifs $PUBSHM $PUBSH -o uid=$USER,nounix,domain=$DOMAIN,gid=users,file_mode=0777,dir_mode=0777,iocharset=iso8859-15,credentials=$CRED"`
if [ $? -eq 1 ]
then
MSG="There was an error mounting $PUBSHM."
else
MSG="Mounted $PUBSHM from $PUBSH"
fi
elif [[ "$PSTAT" == "Mounted" ]]
then
`$GSUDO "umount $PUBSHM"`
if [ $? -eq 1 ]
then
MSG="There was an error unmounting $PUBSHM."
else
MSG="Unmounted $PUBSHM from $PUBSH."
fi
else
zenity --error --text "Unable to determine how to deal with $PUBSH."
exit
fi
# User selected both mounts
elif [[ "$ANS" == "Paul|Public" ]]
then
# Mount/Unmount User share
if [[ "$USTAT" == "Unmounted" ]]
then
`$GSUDO "mount -t cifs $USRSHM $USRSH -o uid=$USER,nounix,gid=users,file_mode=0700,dir_mode=0700,iocharset=iso8859-15,credentials=$CRED"`
if [ $? -eq 1 ]
then
MSG1="There was an error mounting $USRSHM"
else
MSG1="Mounted $USRSHM on $USRSH"
fi
elif [[ "$USTAT" == "Mounted" ]]
then
`$GSUDO "umount $USRSHM"`
if [ $? -eq 1 ]
then
MSG1="There was an error unmounting $USRSHM."
else
MSG1="Unmounted $USRSHM from $USRSH."
fi
else
zenity --error --text "Unable to determine how to deal with $USERSH."
exit
fi
if [[ "$PSTAT" == "Unmounted" ]]
then
`$GSUDO "mount -t cifs $PUBSHM $PUBSH -o uid=$USER,nounix,domain=$DOMAIN,gid=users,file_mode=0777,dir_mode=0777,iocharset=iso8859-15,credentials=$CRED"`
if [ $? -eq 1 ]
then
MSG2="There was an error mounting $PUBSHM"
else
MSG2="Mounted $PUBSHM on $PUBSH."
fi
elif [[ "$PSTAT" == "Mounted" ]]
then
`$GSUDO "umount $PUBSHM"`
if [ $? -eq 1 ]
then
MSG2="There was an error unmounting $PUBSHM."
else
MSG2="Unmounted $PUBSHM from $PUBSH."
fi
else
zenity --error --text "Unable to determine how to deal with $PUBSH."
exit
fi
MSG="$MSG1\n\n$MSG2"
else
zenity --error --text "I have no idea what you want to mount. Exiting..."
exit
fi
# Display a status message
zenity --title="Maxtor Mount" --info --no-wrap --text="$MSG"
exit
.smbpasswd - the password file for accessing restricted shares on the unit
username=me password=myP@ssword