Main Page

How to setup a basic Slackware Linux NAS home server

  1. We need to start with a freshly installed and upgraded Slackware64-15.0 OS.

    1. Download slackware64-15.0-install-dvd.iso
    2. Start the install process. During the install I choose Ext4 for the filesystem, lilo for the bootloader, and make sure samba and sshd are set to
      start at boot, and very important, make sure mysqld is set to not start at boot. We only need to install the (A, AP, D, K, L, N) packages for this
      command line server.
    3. After Slackware is installed exit the install menu and do a reboot. After the reboot run "mc" at the command prompt and navigate to /etc/ssh/sshd_config
      and uncomment and set "PermitRootLogin yes". Then navigate to /etc/lilo.conf and set "timeout = 0", or to whatever time you want. Then navigate to
      /etc/slackpkg/mirrors and uncomment "https://mirrors.slackware.com/slackware/slackware64-15.0/". Then run lilo and reboot:
      lilo
      reboot
      
    4. You can now login to your NAS server with PuTTY if you are on a different machine than the NAS server.
    5. Okay, now do a full upgrade with the commands below.

      slackpkg update
      slackpkg upgrade-all
      
      After the upgrade is finished run lilo then reboot:
      lilo
      reboot
      
  1. Install Webmin as the server control panel. (Optional)

    This server will be using Webmin for the server control panel, so we'll need to install some perl modules required by Webmin.

    1. Install the perl modules by copy and pasting the block of text below into PuTTY that you have connected to your server.
    2. export PERL_MM_USE_DEFAULT=1
      cpan install CPAN
      cpan install App::cpanminus
      cpanm -n Log::Log4perl
      cpanm -n Authen::PAM DBD::mysql DBI IO::Pty Net::SSLeay Sys::Syslog
      

    3. Intall Webmin

      Webmin makes a great web based server control panel. Run the block of commands below to install.

      mkdir -p /root/tmp
      cd /root/tmp/
      wget https://github.com/webmin/webmin/releases/download/2.202/webmin-2.202.tar.gz
      tar -xf webmin-2.202.tar.gz
      rm /root/tmp/webmin-2.202.tar.gz
      cd webmin-2.202
      ./setup.sh /usr/local/webmin
      rm -R /root/tmp/webmin-2.202
      
  1. Install OpenZFS on Linux

    We'll need to download, build, and install OpenZFS

    # Download OpenZFS
    cd /root/tmp
    wget https://github.com/openzfs/zfs/releases/download/zfs-2.2.7/zfs-2.2.7.tar.gz
    tar -xf zfs-2.2.7.tar.gz
    cd zfs-2.2.7
    # Build and install OpenZFS
    ./configure
    make
    make install
    depmod
    
    Now OpenZFS is installed on your server.

    Remember that everytime the Slackware Linux kernel is updated you'll have to rebuild and reinstall OpenZFS.

  2. Create a ZFS pool

    Now we'll create the ZFS pool that we want to share with our other home computers. I've got videos and music that I share with my livingroom
    entertainment computer, which is running Windows 11. This setup works great for me, and it's simple.

    There are many different ways to use drives with ZFS. I'll be focusing on:

    raidz1 - 3 drives with 1 for redundency. Did the raidz1 because it was the cheapest way to get the most storage. I plan on going to the safer raidz2
    in the near future, which is 5 disk with 2 for redundency. That would raise my storage to 24tb.

    I have 3 8tb 3.5" SATA NAS drives attached to my Slackware NAS server, sdb, sdc, sdd. To use these 3 drives for my raidz1 storage pool named "storage",
    I run the following command:

    zpool create storage raidz1 /dev/sdb /dev/sdc /dev/sdd
    
    After you've created your storage pool it will show up in your root directory as a directory, "/storage" in my case. This is where you store the files
    you want to share.

    Next you'll need to change the permissions of the shared directory. In my case that would be the "/storage" directory.

    chmod 0777 /storage
    

    With this setup of raidz1 with 3 drives you can lose 1 drive due to errors or malfunction. Just replace the bad drive as soon as you can, and you're
    back up to speed. With my 3 drives of 8tb in a raidz1 configuration I actually get about 15.5tb storage space.

  3. Install wsdd2 (WSD/LLMNR Discovery/Name Service Daemon)

    Next we need to download, build, and install the wsdd2 slackbuild package.

    cd /root/tmp
    wget https://slackbuilds.org/slackbuilds/15.0/network/wsdd2.tar.gz
    tar -xf wsdd2.tar.gz
    cd wsdd2
    wget https://github.com/Netgear/wsdd2/archive/1.8.7/wsdd2-1.8.7.tar.gz
    ./wsdd2.SlackBuild
    installpkg /tmp/wsdd2-1.8.7-x86_64-1_SBo.tgz
    
    With wsdd2 our samba shares will be discovered.

  4. Setting up Samba

    First make sure Samba is started at boot:

    chmod 0755 /etc/rc.d/rc.samba
    
    Next configure Samba

    Create the needed /etc/samba/smb.conf file.

    Below is a very simple smb.conf for sharing your zfs pool without any password needed.
    Just copy and paste using PuTTY the entire echo command below.

    echo "[global]
      server string = Samba Server
      dns proxy = no 
      debug level = 0
      workgroup = WORKGROUP
      log file = /var/log/samba.%m
      read raw = no
      socket options = TCP_NODELAY
      bind interfaces only = Yes
      max log size = 5120
     # Change "storage" to the actual name of your ZFS pool.
      default = storage                          
      server role = standalone server
      map to guest = Bad User
      # Change "myfiles" to the folder name you want to show up in network discovery.
      netbios name = myfiles                     
      map to guest = Bad User
      server min protocol = SMB2_02
      # Change "myfiles" to the actual netbios name from above.
      server string = %h server (Samba, myfiles) 
      usershare allow guests = yes
        
    [storage]
      # Change "/storage" to the actual name of your ZFS pool directory.
      path = /storage                            
      comment = storage
      browseable = yes
      public = yes
      writeable = yes
      case sensitive = auto
      preserve case = yes
      short preserve case = yes
      force create mode = 0666
      force directory mode = 0777" > /etc/samba/smb.conf
    
    Almost done!

  5. Lastly import your ZFS pool at boot, and start the wssd2 discovery service at boot.

    Put the following at the top of your /etc/rc.d/rc.local file:

    /usr/local/sbin/zpool import storage >/dev/null 2>&1 # Change "storage" to the name you gave your ZFS pool.
    /usr/sbin/wsdd2 -d > /dev/null 2>&1
    
    After you reboot you should be able to see your ZFS pool in Windows under Network.

  6. Maintaining your ZFS pool

    Check the status of your ZFS pool:

    zpool status # This shows you the status of your zpools.
    
    Check ZFS File system storage pool integrity.

    To check the zfs pool storage integrity you need to periodically run a scrub operation on the pool, so on my system I run:

    zpool scrub storage # This pool scrub operation may take many hours. I do this about once a month.
    
  7. Rebuild and reinstall OpenZFS after Slackware Linux kernel is updated.

    Everytime you update the Slackware Linux kernel you will have to rebuild and reinstall OpenZFS.
    Assuming you have OpenZFS at /root/tmp/zfs-2.2.7

    cd /root/tmp/zfs-2.2.7
    make clean
    ./configure
    make
    make install
    depmod
    
    Hopefully you now have a Slackware NAS server ready to save and share files.

    Recommendations for NAS drives.

    I use 3.5" SATA NAS drives for my NAS servers. I would use SSD drives, but they are way too expensive at this point.

    My favorite drives are the HGST Ultrastar Enterprise refurbished drives sold by GoHardDrive. I've got about 10 of them, and have never had a problem with any
    of them yet. They have been rock solid, some many years old with many hours on them. You can get the HGST drives in 4tb, 8tb, 10tb, and 12tb.

    Just had a second Toshiba 8tb N300 NAS drive start to go out on me, and throwing checksum errors. I just bought a HGST 8tb Enterprise (renewed) to replace the
    Toshiba, and it was $85.59 with tax. Had a heck of a time figuring out how to replace the bad drive, never had to do it before. After a lot of reading, and cussing,
    I finally have the new HGST resilvering now. The command that worked for me was:

    "zpool replace -f storage /dev/disk/by-id/ata-TOSHIBA_HDWG180_5160A01TFBEG /dev/disk/by-id/ata-HGST_HUH728080ALE604_VLJMVKWZ"

    Here is a pic of the "zpool status" after I started the "zpool replace" of the bad Toshiba drive with the renewed HGST drive.

    Warning! Stay away from Toshiba NAS drives! Bought two 8tb Toshiba N300 NAS drives. One died within 1 week, and the other died in about 2 years. Stick with HGST
    Enterprise or Western Digital Red Pro NAS drives only. I now have 2-HGST 8tb and 1-WD Red Pro 8tb drives in my raidz1 pool. I'm planning on going to raidz2 after
    I buy 2 more HGST 8tb's.

    A new Western Digital Red Pro 8tb NAS drive cost about 3 times as much as a (renewed) HGST Enterprise 8tb NAS drive, and the HGST drives run about 3 degrees celcius
    cooler than the WD drives.





Powered by: Rocky Linux v9.5 Rocky Lunux Nginx v1.20.1 Nginx iRedMail v1.7.1 iRedMail


Please send any feedback to: wjack@wjack.com