File Server, part 5: Setting up client access

Posted

With all my different means of file access set up on the server, I’ve got to set up all my workstations to attach to it. Just to rehash what I’ll set up:

  • NFS: Used on a separate Linux server for home directory and project development files.
  • SMB: Used on Windows and Mac machines to access various types of files (media, documents, etc).
  • iSCSI: Used only for testing purposes on Windows and Mac platforms now. Will be used in the future for virtual machine disk storage under VMWare ESXi.

Linux access

Boring server-side NFS preparations

Before setting up NFS access, emphatically take note that NFS doesn’t translate permissions based on user and group names, but rather by the numeric UID and GID.

Since my file server will be the most coveted machine on my network, and will be ground zero for any file that matters, I’ll centralize permissions and UID/GIDs there as well. The best way to do this is to pick a block somewhere in the thousands (preferably well beyond 1000, which is what some Linux distributions start at by default; OpenSolaris starts at 100). Whenever I need to create a new user that needs file server access, I’ll just create them on the file server first, within the bounds of my custom UID/GID block, then create them on the client machine(s) using that same numeric UID and GID. Any *nix distribution that matters has command line options you can use when creating a new user to specify a custom UID/GID pair, so this isn’t a big hairy deal, really.

My UID/GID block will start at 2000. I’m saving the 2000 pair for something else. My brian user thusly has a new UID and GID of 2001. There are five simple steps to changing this on client machines:

  1. Edit the /etc/passwd file very carefully to change the UID. Take note of the old one. Some distributions will let you do this via usermod.
  2. Edit the /etc/group file very carefully to change the GID. Take note of the old one. Some distributions will let you do this via groupmod.
  3. Perform a find / -uid 1000 as root to determine which files are owned by the old UID (in this case, 1000).
  4. Perform a find / -gid 1000 as root to determine which files are owned by the old GID (again, 1000).
  5. Use chown 2001 and chgrp 2001 on files owned by the old UID and GID, respectively. In my case, I was able to do a chown -R 2001.2001 /home/brian as I didn’t own any other files elsewhere on the system.

With all that out of the way, I can prep the permissions on my ZFS filesystems.

root@sol:~# groupadd -g 2001 brian
root@sol:~# usermod -u 2001 brian
root@sol:~# chown -R brian:brian /Storage00/*
root@sol:~# chmod 770 /Storage00/*
root@sol:~# ls -l /Storage00/
total 16
drwxrwx--- 2 brian brian 2 2009-04-28 10:13 Backups
drwxrwx--- 2 brian brian 2 2009-05-01 03:49 Databases
drwxrwx--- 2 brian brian 2 2009-04-28 10:13 Development
drwxrwx--- 2 brian brian 4 2009-05-16 19:14 Documents
drwxrwx--- 2 brian brian 2 2009-04-28 10:13 Media
drwxrwx--- 2 brian brian 2 2009-04-28 10:13 Software
drwxrwx--- 2 brian brian 2 2009-04-28 12:13 Virtualization
drwxrwx--- 2 brian brian 2 2009-04-28 10:13 WWW

You’ll see everything is ready on the server. If you’re following along, you can do whatever you want to with your groups here. Mine are set up in much the same way I did the user permissions so I’m not going to repeat everything.

Fun client-side NFS stuff

I’ve logged in as root on my Linux server and made sure that I’ve got all the necessary NFS client packages installed. Now for the moment of truth:

root@shuttle:/# mkdir /sol
root@shuttle:/# mkdir /sol/Backups
root@shuttle:/# mkdir /sol/Databases
root@shuttle:/# mkdir /sol/Development
root@shuttle:/# mkdir /sol/Documents
root@shuttle:/# mkdir /sol/Software
root@shuttle:/# mkdir /sol/WWW
root@shuttle:/# mount sol:/Storage00/Backups /sol/Backups
root@shuttle:/# mount sol:/Storage00/Databases /sol/Databases
root@shuttle:/# mount sol:/Storage00/Development /sol/Development
root@shuttle:/# mount sol:/Storage00/Documents /sol/Documents
root@shuttle:/# mount sol:/Storage00/Software /sol/Software
root@shuttle:/# mount sol:/Storage00/WWW /sol/WWW
root@shuttle:/# cd /sol
root@shuttle:/sol# ls -l
total 12
drwxrwx--- 2 brian brian 2 2009-04-28 10:13 Backups
drwxrwx--- 2 brian brian 2 2009-05-01 03:49 Databases
drwxrwx--- 2 brian brian 2 2009-04-28 10:13 Development
drwxrwx--- 2 brian brian 4 2009-05-16 19:14 Documents
drwxrwx--- 2 brian brian 2 2009-04-28 10:13 Software
drwxrwx--- 2 brian brian 2 2009-04-28 10:13 WWW

Looks like everything mounted successfully! On the file server I’ll create a file under Documents, then check to see if I can read and write to it from the Linux server:

brian@sol:~$ echo "Hello from sol" > /Storage00/Documents/sol_test

 

brian@shuttle:~$ cd /sol/Documents
brian@shuttle:/sol/Documents$ ls -l
total 1
-rw-r--r--+ 1 brian brian 6 2009-05-16 20:17 sol_test
brian@shuttle:/sol/Documents$ echo "Modified from shuttle" >> sol_test
brian@shuttle:/sol/Documents$ cat sol_test
Hello from sol
Modified from shuttle
brian@shuttle:/sol/Documents$ echo "Test" > shuttle_test
brian@shuttle:/sol/Documents$ 

Perfect! Everything’s set up under Linux. I could add each mount point to my /etc/fstab so it gets mounted upon startup, but this is only the test file server.

Windows Access

SMB

Under SMB everything regarding permissions is much easier. Under Windows and Mac OS X, all we really need to do is enter our user name and password for the file server and we’re pretty much ready to go.

I’ve done just that by locating the server in Explorer’s “network” tree. I then used SOL\brian as the username, opened the Documents share, and copied a PDF file to make sure writing works:

Windows Vista viewing OpenSolaris SMB shares

Excellent – now on to iSCSI.

iSCSI

This isn’t how I intend to use iSCSI but nevertheless I still want to make sure it works. Vista includes a very handy iSCSI Initiator control panel applet, making it extremely easy to mount an iSCSI disk.

A quick rundown:

  1. Go to Control Panel, then iSCSI Initiator.
  2. Go to the Discovery tab, then click the Add Portal button to enter the IP address of the file server. In this case, 10.0.0.107. Leave the default port number, 3260, intact.
  3. Go to the Targets tab and click the Refresh button. This tells Vista to contact all the target portals and ask for a list of iSCSI volumes. After it’s done, I see the two iSCSI volumes that I created on the file server in part 4 (see screen shot below).
  4. Select the desired volume and then click “Log on”, then “OK” in the resulting dialog.
  5. The disk is connected.

Vista iSCSI Initiator volumes listing

Now that it’s connected, I can format it by using the Disk Management console.

  1. Right-click “Computer” from any explorer window, then choose “Manage”.
  2. Click the “Disk Management” node in the tree at the left.
  3. I’m immediately prompted to initialize the newly attached iSCSI disk. Since this is a test, I used the default options.
  4. Now that it’s attached, it appears in the disk list in the lower pane (see below screenshot).

Vista Disk Management console with iSCSI disk attached

I’ll right-click the unallocated space on the new disk, and choose “New Simple Volume”, using the maximum amount of space, the “I:” drive letter, and a name of “iSCSI Volume”. Once it is formatted, Explorer shows the drive and it is ready for use as a normal disk.

Vista Explorer showing iSCSI disk

Success! Everything’s ready under Windows, and I’ve verified that copying files to the iSCSI volume works.

Mac OS X access

The file server appears automagically in Finder, and once I use the “Connect As” button to enter my file server username and password, I see the list of shares, open the Documents share (which OS X will mount as a volume), and copy a PDF to it:

OS X Finder viewing OpenSolaris SMB shares

Perfect!

Conclusion

With everything running smoothly with my test file server, I’ll be purchasing hardware for the real deal. There’s a good possibility I’ll document the hardware here, but it may be a while before the actual purchase happens.

However, with all this documented, the amount of time I spend between turning on my real file server and being able to use it should be very minimal.

In any event, I hope this series has helped someone at least become familiar with OpenSolaris, ZFS, iSCSI, and the magnitude of what can be accomplished through a little planning and testing.

Comments

Nobody has posted any comments yet. Be the first!