Wednesday, May 31, 2017

Pictures of Gizmo 2 NAS

I was thinking to publish a few pictures of the final NAS built in http://xorinox.blogspot.com/2017/05/gizmo-2-becomes-my-fast-nas.html

Some preliminary and naive testing showed that I can read and write about 110MB/s from and to this NAS.











Sunday, May 7, 2017

Setting up Samba on my Gizmo 2

As described in my previous blog I have setup my Gizmo 2 to become my NAS. Now it is time to enable Samba so I can access the volumes with my Windows machines.

Installation
  • yum install -y samba samba-client

Security
  • useradd pi
  • passwd pi
  • smbpasswd -a pi
  • smbpasswd -L -e pi
  • groupadd fastvol
  • groupadd safevol
  • usermod -a -G fastvol pi
  • usermod -a -G safevol pi

Permissions
  • chown -R pi:fastvol /mnt/fastvol
  • chown -R pi:safevol /mnt/safevol
  • chmod -R 0777 /mnt/fastvol
  • chmod -R 0777 /mnt/safevol
  • chcon -t samba_share_t /mnt/fastvol
  • chcon -t samba_share_t /mnt/safevol

Configuration
  • vi /etc/samba/smb.conf
[fastvol]
        path = /mnt/fastvol
        valid users = @fastvol
        writable = yes
        read only = no
        browsable = yes
        guest ok = no
        create mode = 0777
        directory mode = 0777

[safevol]
        path = /mnt/safevol
        valid users = @safevol
        writable = yes
        read only = no
        browsable = yes
        guest ok = no
        create mode = 0777
        directory mode = 0777

Start & enable service
  • systemctl restart smb
  • systemctl restart nmb
  • systemctl enable smb
  • systemctl enable nmb

Sources Samba Setup

Gizmo 2 becomes my fast NAS

My Gizmo 2 has CentoOS 7 installed on a miniSATA disk from Samsung. Through USB3 I have connected 2 x NexStart MX 2.5" enclosures that each contain 2 x 1TB SSD 840 Evo from Samsung.

I will create two volumes, a really fast one and a very secure one. The enclosure comes with hardware RAID that is currently configured to RAID 1. So each enclose provides 1TB of disc space right now.

The fast volume will be made of 2 x 700GB and then secure one, for backups, utilizing the rest.


Keep the yum repos updated
  • yum install -y yum-cron
  • chkconfig yum-cron on

I need Vim enhanced

  • yum install -y vim-enhanced
  • echo "alias vi=vim" >> ~/.bashrc
  • source ~/.bashrc

A bunch of tools I always install

  • yum install -y bind-utils net-tools traceroute nmap dhclient 
  • yum install -y system-storage-manager
  • yum install -y nano bash-completion wget curl lsof deltarpm rpm-build yum-utils attr screen git
  • yum groupinstall -y "Development Tools"

Let's look at the USB drives

  • yum whatprovides lsusb
  • yum install -y usbutils libusb
    • libusb actually enabled the USB 3 ports

Install software RAID support
  • yum whatprovides mdadm
  • yum install -y mdadm

Check disk configuration
  • Using lsblk this is how I have all my disks configured
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 111.8G  0 disk
├─sda1        8:1    0     1G  0 part /boot
└─sda2        8:2    0 110.8G  0 part
  ├─cl-root 253:0    0    50G  0 lvm  /
  ├─cl-swap 253:1    0   1.5G  0 lvm  [SWAP]
  └─cl-home 253:2    0  59.3G  0 lvm  /home
sdb           8:16   0 931.5G  0 disk
├─sdb1        8:17   0   700G  0 part
└─sdb2        8:18   0 231.4G  0 part
sdc           8:32   0 931.5G  0 disk
├─sdc1        8:33   0   700G  0 part
└─sdc2        8:34   0 231.4G  0 part


Configure RAID
  • Edit /etc/mdadm.conf
DEVICE /dev/sd[bc]1
ARRAY /dev/md0 devices=/dev/sdb1,/dev/sdc1

DEVICE /dev/sd[bc]2
ARRAY /dev/md1 devices=/dev/sdb2,/dev/sdc2
  • mdadm -C /dev/md0 --level=raid0 --raid-devices=2 /dev/sdb1 /dev/sdc1
  • mdadm -C /dev/md1 --level=raid1 --raid-devices=2 /dev/sdb2 /dev/sdc2

Formatting & mounting
  • mkfs.xfs /dev/md0
  • mkfs.xfs /dev/md1 -f
  • mkdir /mnt/fastvol
  • mkdir /mnt/safevol
  • added lines to /etc/fstab
/dev/md0     /mnt/fastvol                       xfs     defaults        0 0
/dev/md1     /mnt/safevol                       xfs     defaults        0 0
  • mount -a

Check disk configuration again
  • Using lsblk this is how I have all my disks configured
[root@giz-node-1 ~]# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda           8:0    0 111.8G  0 disk
├─sda1        8:1    0     1G  0 part  /boot
└─sda2        8:2    0 110.8G  0 part
  ├─cl-root 253:0    0    50G  0 lvm   /
  ├─cl-swap 253:1    0   1.5G  0 lvm   [SWAP]
  └─cl-home 253:2    0  59.3G  0 lvm   /home
sdb           8:16   0 931.5G  0 disk
├─sdb1        8:17   0   700G  0 part
│ └─md0       9:0    0   1.4T  0 raid0 /mnt/fastvol
└─sdb2        8:18   0 231.4G  0 part
  └─md1       9:1    0 231.3G  0 raid1 /mnt/safevol
sdc           8:32   0 931.5G  0 disk
├─sdc1        8:33   0   700G  0 part
│ └─md0       9:0    0   1.4T  0 raid0 /mnt/fastvol
└─sdc2        8:34   0 231.4G  0 part
  └─md1       9:1    0 231.3G  0 raid1 /mnt/safevol




Saturday, May 6, 2017

Tools to burn images onto SD cards etc.


Windows

On my Khadas VIM I could not find the command "ping"


Funny, after installing Ubuntu Server on my Khadas VIM I could not find the command "ping". An approach to find commands that so far always helped me was to use apt-file.
  • apt-get install apt-file
  • apt-file update
  • apt-file find ping |grep utils
I also suspected it needed to be part of some kind of *utils*. 
  • apt-get install iputils-ping
And now I have "ping".