Monday, April 19, 2010

Sun Fire V120 as NAS part 6: Network shares and RAM upgrade

Ok. Time to start some file sharing protocols.

First the easy part: NFS.
Solaris comes with NFS4 (backwards compatible with NFS2 and NFS3). Not very important in a normal home but in my case, this is the best option to share information with my SGI boxes. Only three steps are needed to start sharing, Fantastic!

1. Make writable to everybody the folder where I want to share. I use the same array than before:
# chmod 777 /fsshared
2. Add the share information to the file /etc/dfs/dfstab
#       Place share(1M) commands here for automatic execution
#       on entering init state 3.
#
#       Issue the command 'svcadm enable network/nfs/server' to
#       run the NFS daemon processes and the share commands, after adding
#       the very first entry to this file.
#
#       share [-F fstype] [ -o options] [-d ""] [resource]
#       .e.g,
#       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2
share -F nfs -o rw -d "fsshared V120" /fsshared
3. Start sharing:
# shareall
The dfstab entry goes:
  • -F nfs .- Type of sharing.
  • -o rw .- The options. Here I only used read-write but there is a lot more (including loggin), but I just don't need.
  • -d "fsshared V120" .- Obviously is only a comment.
  • /fsshared .- Here comes the folder I want to export.
Here some captures from my Fuel mounting the exported folder of the Sun Fure V120:

Second part is SAMBA!
This is the standard Windows protocol. At the time the most important in any home or company. From a lot of time ago samba.org is publising the source code and it's widely used but all the test I did before (and some test done by friends) are telling Samba is slow, in Solaris and in Linux.

Configure Samba in Solaris is not as easy as I was thinking before to use it.
1. Check if Samba is installed. Well, installing Solaris with OEM option, Samba must be installed:
# /usr/sfw/sbin/smbd -V
Version 3.0.35
2. Now we have to create the smb.conf file. I copied the exampled provided with the Solaris installation:
# cd /etc/sfw
# cp smb.conf-example smb.conf
3. Edit the configuratin file. I modified three parts: The allowed ip ranges (my network subnet and localhost):
# This option is important for security. It allows you to restrict
# connections to machines which are on your local network. The
# following example restricts access to two C class networks and
# the "loopback" interface. For more examples of the syntax see
# the smb.conf man page
   hosts allow = 192.168.2. 127.
 Set the Windows workgroup name:
# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
   workgroup = WORKGROUP
And the last one, the shared folder. I want the folder open read-write to everybody, then the guest ok option must be set and the guest only option must be removed! The docs says guest only is discarded with guest ok but in my case guest ok was discarded with both options in the configuration of the folder.


# A publicly accessible directory, read/write to all users. Note that all files
# created in the directory by users will be owned by the default user, so
# any user with access can delete any other user's files. Obviously this
# directory must be writable by the default user. Another user could of course
# be specified, in which case all files would be owned by that user instead.
[public]
   path = /fsshared
   public = yes
   guest ok = yes
   writable = yes
   printable = no
   browseable = yes
4. Test the configuration file:
# /usr/sfw/bin/testparm

Load smb config files from /etc/sfw/smb.conf
Processing section "[homes]"
Processing section "[printers]"
Processing section "[public]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
5. Add a user to the Samba database:
#  /usr/sfw/bin/smbpasswd -a admin
New SMB password:
Retype new SMB password:
Added user admin.
6. The last part must be start the samba service:
# svcadm enable samba
----------------------------------------------------------------------------------------------------------
UPDATE: 2010/09/08
7. Now Samba is working but I can't see the computer in the Windows Explorer (or other smb bowsers): The last step is activate WINS:
# svcadm enable wins

Here you have the old post part (italic letter). NOT NECESSARY.
A new test showed that I don't need to do the next part. At the end 
but in my case it didn't work. After some googling I found this guide related to Solaris u4, and I followed. Samba didn't start and after a new search I found a fault in my smb.conf: I writed /fssaredc instead of the name of my shared folder.
Now I have two commands to start samba:
# svcadm enable samba:smbd
# svcadm enable samba:nmbd
End of the update
----------------------------------------------------------------------------------------------------------
But it's working:
And here comes the bad part. I only get 4.3 MB/s downloading the test file via FTP and 1.9 MB/s via Samba! The V120 is connected to my main router via a non manageable HP ProCurve gigabit switch and the client is a Dell Precsion 390 with the onboard Broadcom gigabit network chipset. I did some checks in the V120 network port configuration but I didn't find anything wrong. Well, I will check later. Anyway I have a Quad GigaSwift PCI card at the mail coming home.

RAM tests.
Thursday arrived some more RAM sticks, 4x1GB ECC registered sticks!!!
I did various test with different amount of memory: 512 MB (one stick that came with the server), 2 GB and 4 GB.

                                 512MB         2 GB        4GB
-----------------------------------------------------------------------
From RAID5 to system disk.      12.8 MB/s    17.8 MB/s   26.9 MB/s
From system disk to RAID5.      11.3 MB/s    18.6 MB/s   21.6 MB/s
From RAID5 to disk 2.           12,5 MB/s    20.9 MB/s   32.0 MB/s

I was expecting a great improvement from 512 MB to 2 Gb, but I also discovered a great rise in performance with 4 GB using the RAID5 array. Yes, ZFS needs a lot of memory!
Note that tests are done by hand and I only did the test one or two times but are enough for comparision. At least for me!

Tuesday, April 6, 2010

Sun Fire V120 as NAS part 5: Users, rows and some tips

Well, I had some problems with the screen rows (lines) when using the vi editor. Some time surfing the net later I found a good solution: the TERM environment variable. The /etc/profile script only can set this variable only in two ways: sun-color or sun:
(...)
if [ "$TERM" = "" ]
then
        if /bin/i386
        then
                TERM=sun-color
        else
                TERM=sun
        fi
        export TERM
(...)
This could be changed at the Solaris prompt typing:
# TERM=vt100
# export TERM
But with this commands the values are lost when the user logouts. Due all the connections to the server console or terminal will use a vt100 terminal simulator I decided to modify the /etc/profile script as follows:
(...)
if [ "$TERM" = "" ]
then
        if /bin/i386
        then
                TERM=sun-color
        else
                TERM=vt100
        fi
        export TERM
(...)
One problem solved. Go to the second one: with only the root account nobody can login into the server via ftp, smb or something like that. I decided to create an admin account like my linux servers:
# useradd -d /export/home/admin -m -s /bin/ksh -c admin admin
# passwd admin
New password:
(...)
Ok now I can open a FTP session. -d specifies the user folder, -s sets the shell he will use and -c specifies the full name of the user (use " to enclose the name if it has spaces). Obviously the las word is the account name.

Another problem I had was that the man pages were not working. Man seemed installed but not the documentation files. I tried adding the routes to the path but finally the solution is more easy: the package SUNWman was not installed while the package SUNWdoc was perfectly on the hard disk:
# cd /cdrom/sol_10_1009_sparc/Solaris_10/Product
# pkgadd -d . SUNWman
One more thing: How to complete shutdown (well in this server it means 'put the server on standby'):
# shutdown -y -g 0 -i 5