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

Want to support HowtoForge? Become a subscriber!
 
Submitted by dfed (Contact Author) (Forums) on Tue, 2010-05-04 16:35. ::

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.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by ci4ic4 (not registered) on Mon, 2010-12-20 12:09.
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).