How To Build A Standalone File Server With Nexenta 3.0 Beta2 - Page 3

3 Add Disks and Create ZPools:

First, let's see what disks are available if we're adding some. On the console or from an ssh login to server1.example.com, sudo su - to become root:

dfed@server1:~$ sudo su -

[sudo] password for dfed:
root@server1:~#

Then type the following to see which disks are available:

format

This will give you a readout similar to the following:

AVAILABLE DISK SELECTIONS:
       0. c0d0
          /pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0
       1. c0d1
          /pci@0,0/pci-ide@1,1/ide@0/cmdk@1,0
       2. c1d1
          /pci@0,0/pci-ide@1,1/ide@1/cmdk@1,0
Specify disk (enter its number):

Make note of the disk names and control-c to exit this. You do not need to format a disk before adding it to a zpool. Specifically, make note of the disks that are not your system OS installation. You should have that disk name notated from above. In this case, c0d1 and c1d1 are the two disks I want to add, both 2T in size.

You have several options for creating the pool containing your disks. If you want to just create a concat of the disks, you would create a single zpool. If you wanted a mirrored storage pool (equivalent of raid 1) you would create a mirrored pool. You can also create a RAID-Z pool which is the equivalent of a raid 5 array. Since we have only two disks and I am more interested in space than redundancy, I will create a simple concat pool by doing this:

root@server1:~# zpool create pool1 c0d1 c1d1

To create a mirrored pool, you would do the following:

root@server1:~# zpool create pool1 mirror c0d1 mirror c1d1

If you had multiple disks to mirror (more than 2) you would do as follows:

root@server1:~# zpool create pool1 mirror disk1 disk2 mirror disk3 disk4

Where disk1,disk2,disk3,disk4 would be the system names of said disks. To create a RAID-Z:

root@server1:~# zpool create pool1 raidz disk1 disk2 disk3 disk4 disk5

To verify the pool's creation:

root@server1:~# zpool list

NAME      SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
pool1    3.97T   213K  3.97T     0%  1.00x  ONLINE  -
syspool   127G  1.31G   126G     1%  1.00x  ONLINE  -

And we see where I have created a concat of the two 2T disks shown earlier in the list. To destroy a zpool and start over, simply type:

root@server1:~# zpool destroy pool1

Now that we've created our pool, you can check that it is mounted in /. If you ls / you will see pool1 as a directory. Let's say you didn't want that name in the filesystem, and wanted it to mount, instead, at /opt. You would do the following:

root@server1:/# zpool create -m /opt pool1 c0d1 c1d1
root@server1:/# zpool list

NAME      SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
pool1    3.97T   109K  3.97T     0%  1.00x  ONLINE  -
syspool   127G  1.31G   126G     1%  1.00x  ONLINE  -

root@server1:/# df -h

Filesystem             size   used  avail capacity  Mounted on
syspool/rootfs-nmu-000
                       125G  1007M   123G     1%    /
/devices                 0K     0K     0K     0%    /devices
/dev                     0K     0K     0K     0%    /dev
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   1.5G   316K   1.5G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                       124G  1007M   123G     1%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   1.5G     0K   1.5G     0%    /tmp
swap                   1.5G    36K   1.5G     1%    /var/run
pool1                  3.9T    21K   3.9T     1%    /opt

The -m /path/to/file trigger allows you to mount this pool anywhere. With that in mind, I will now create the pool and mount it at /export/home. /export/home is the location of user home directories by default in both OpenSolaris and Nexenta. To do this, I will have to move my current home directory out of /export/home and then return it once this is created.

root@server1:/# mv /export/home/dfed /opt/
root@server1:/# ls /export/home
root@server1:/# ls /opt

dfed

root@server1:/# zpool create -m /export/home pool1 c0d1 c1d1
root@server1:/# mv /opt/dfed /export/home/
root@server1:/# ls /export/home

dfed

Do a df -h to verify disk/mount sizes:

root@server1:/# df -h

Filesystem             size   used  avail capacity  Mounted on
syspool/rootfs-nmu-000
                       125G  1007M   123G     1%    /
/devices                 0K     0K     0K     0%    /devices
/dev                     0K     0K     0K     0%    /dev
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   1.5G   316K   1.5G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                       124G  1007M   123G     1%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   1.5G     0K   1.5G     0%    /tmp
swap                   1.5G    36K   1.5G     1%    /var/run
pool1                  3.9T    30K   3.9T     1%    /export/home

We have now set up the extra disks and are ready to set up users and share directories. If you are interested in a Samba standalone server, read on. If you are looking to set up NFS, skip to section 6.

 

4 Adding And Managing Users: Samba

At the end of the file /etc/pam.conf add the following line:

[...]
other password required pam_smb_passwd.so.1 nowarn
[...]

This will set the encryption level correctly for the user accounts being shared. Once added, you can create users as you see fit and when you set their passwords via the passwd command, it will encrypt their passwords in a Samba friendly manner. For your current user, you will need to reset the password with the passwd command before that user can use the samba services. To add a user:

root@server1:/# groupadd -g 1001 newuser
root@server1:/# useradd -u 1001 -g 1001 -s /bin/bash -c "New User" -d /export/home/newuser -m newuser

14 blocks

root@server1:/# passwd newuser

New Password:
Re-enter new Password:
passwd: password successfully changed for newuser

root@server1:/# ls -lha /export/home

total 6.0K
drwxr-xr-x 4 root    root    4 Apr 22 15:16 .
drwxr-xr-x 3 root    sys     3 Apr 22 11:51 ..
drwxr-xr-x 2 dfed    dfed    7 Apr 22 12:07 dfed
drwxr-xr-x 2 newuser newuser 8 Apr 22 15:16 newuser

Now we are ready to enable the Samba service and set up zfs Samba shares. If you are joining an Active Directory Domain, then skip ahead to that section. In the next section, we will set up the Samba service as a stand alone in a workgroup.

Share this page:

4 Comment(s)

Add comment

Comments

From: at: 2010-05-04 18:00:54

Nexenta just released 3.0 Beta3.  The instructions are the same between the two release versions for this tutorial.


The download link included will take you to the latest version.


 


Thanks


 


-dfed

From: ci4ic4 at: 2010-12-20 11:09:36

smb/server is not Samba under Nexenta Stor (or any OpenSolaris class system). It is the in-kernel CIFS service, which is incompatible with Samba, so only one or the other can be enabled in any one time on a system. The 'zfs sharesmb=on <zfs>' command relates also only to CIFS, nothing to do with Samba. The capabilities of the two are different, there are occasions one might prefer Samba, most of the time though the CIFS service will be the better choice, as it has full Windows integration (the ACLs are not simulated, but are actual part of the file system).

From: Aristotle Jones at: 2010-08-09 19:57:54

This is a great run down of getting a samba and NFS server up and running.  I wish I had this guide when I built mine, could have saved me a LOT of work.  I would like to add that one will run into trouble if they are trying to create a share for multiple users, specifically when using ACL's from windows.


 As the tutorial really only goes over sharing home folders, you would be fine, but if you create one share, available to several users or groups, and they are writing from windows, you are in for trouble without understanding the ACL's


For Owner full access, read to everyone else use this:
(Note: i used chown on the root of the my share first  i.e. chown -R chris /share)

chmod -R A=\

owner@:wACpdDo:d:allow,\

owner@:wACpdDo:f:allow,\

everyone@:rxaARWcs:d:allow,\

everyone@:raARWcs:f:allow \

/share/

Make sure to TEST!
 
For multiple groups / users on a specific folder, and then recursively add the ACL’’s to any child objects:

chmod -R A=\

owner@:full_set:d:allow,\

owner@:full_set:f:allow,\

user:Bob:full_set:d:allow,\

user:Bob:full_set:f:allow,\

everyone@:rxaARWcs:d:allow,\

everyone@:raARWcs:f:allow \

/share/

The above command gives the owner and the user “Bob” full permissions, the everybody else group has read only access. If you want to add a group then just use group: instead of user: at the start.

This gives full access to myself and Bob, but deny’s access to everyone else;

chmod -R A=\

owner@:full_set:d:allow,\

owner@:full_set:f:allow,\

user:chris:full_set:d:allow,\

user:chris:full_set:f:allow,\

user:Bob:full_set:d:allow,\

user:Bob:full_set:f:allow,\

everyone@:full_set:d:deny,\

everyone@:full_set:f:deny \

/share/photos/


 Hope this helps get you going faster.

From: Anonymous at: 2011-02-07 10:20:03

Remember if you give the full_set to files they are also executable ..... you might not want that on every file ;) especially if you propagate this to every new file in the future.