Pages

Saturday, January 4, 2020

Orange Pi Zero NAS

Today my Orange Pi Zero with the NAS Extension Board arrived and I decided immediatly to setup it up as a very minor NAS. So here is what I am using:

Orange Pi Zero with an Allwinner H2+ and 512MB RAM
NAS Extension Board with 1x SATA and 1x mSATA
Adata SP310 128GB mSATA
Samsung Evo 840 250GB SATA


As most cheap boards the SATA connectors are not real SATA connectors, just USB-SATA converters.
Also, when using both SATA connectors, then the Orange PI Zero can not be powered via the USB-OTG port. For powering the Orange Pi Zero with both SATA connectors in use, the NAS Extension Board provides an extra Power connector to use (which works very well with Cubietruck/Cubiboard 3 Power Supply). Using only the mSATA port surprisingly worked with power from the USB-OTG port.
As operating System I am using Armbian again (just like on most of my ARM based boards)

After assembling all parts and powering up, my first command was lsscsi to check if both disks are available:

# lsscsi
[0:0:0:0]    disk    JMicron  Generic          0404  /dev/sda
[1:0:0:0]    disk    JMicron  Generic          0404  /dev/sdb


Then I checked the size of each disk with fdisk:

# fdisk -l /dev/sda
Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
...

# fdisk -l /dev/sdb
Disk /dev/sdb: 232.9 GiB, 250059350016 bytes, 488397168 sectors
...


The Samsung Evo 840 showed only 232GB, not 250GB as advertised but OK. Then I prepared both disks to use with LVM:

# pvcreate /dev/sda
  Physical volume "/dev/sda" successfully created.

# pvcreate /dev/sdb
  Physical volume "/dev/sdb" successfully created.


And created a Volume Group called nas02-local (no RAID):

# vgcreate nas02-local /dev/sda /dev/sdb
  Volume group "nas02-local" successfully created


A quick check with vgs showed me that I have ~350GB for usage:

# vgs -v
  VG          Attr   Ext   #PV #LV #SN VSize   VFree   VG UUID                                VProfile
  nas02-local wz--n- 4.00m   2   0   0 352.12g 352.12g lONfiY-8U00-10zm-zHks-5JgH-eGbs-b22z89


Then I created two 60GB Volumes, one for my images and another one for my music across both disks:

# lvcreate -i 2 -n image -L 60G nas02-local
  Logical volume "image" created.

# lvcreate -i 2 -n music -L 60G nas02-local
  Logical volume "music" created.


And of course the filesystem must not be missing:

# mkfs.ext4 /dev/mapper/nas02--local-image -m 0 -L image
...
# mkfs.ext4 /dev/mapper/nas02--local-music -m 0 -L music
...


Created the mountpoints:

# mkdir /local/image
# mkdir /local/music


Before I modify the fstab file for automatic mount during boot, I checked both disks and volumes with lsblk:

# lsblk -f
NAME                 FSTYPE      LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINT
sda                  LVM2_member       mvkeEr-FVB2-TUW0-bb38-ghJO-UpqM-bEOfyA
|-nas02--local-image ext4        image 978ba6c7-13a2-463b-95b4-bd5703238a0e
`-nas02--local-music ext4        music cd0c7305-fed2-45ed-940c-2c0dd272c1cc
sdb                  LVM2_member       GUrMN3-eM0f-moAA-Wb66-7h6p-OAHv-fD0XWj
|-nas02--local-image ext4        image 978ba6c7-13a2-463b-95b4-bd5703238a0e
`-nas02--local-music ext4        music cd0c7305-fed2-45ed-940c-2c0dd272c1cc

...

Both volumes are using both available disks, which means when one disk fails, then the data is unrecoverable lost on both volumes!
I use the UUID information from lsblk to modify my fstab file:

# vi /etc/fstab
...
UUID=978ba6c7-13a2-463b-95b4-bd5703238a0e       /local/image    ext4    defaults,noatime,nodiratime,commit=600,errors=remount-ro 0 1
UUID=cd0c7305-fed2-45ed-940c-2c0dd272c1cc       /local/music    ext4    defaults,noatime,nodiratime,commit=600,errors=remount-ro 0 1


And a first test:

# mount /local/image
# mount /local/music


And a final check:

# df -h
Filesystem                      Size  Used Avail Use% Mounted on
...
/dev/mapper/nas02--local-music   59G   53M   59G   1% /local/music
/dev/mapper/nas02--local-image   59G   53M   59G   1% /local/image
...


Perfect, a small mini NAS for minor data storing tasks. And this is how it looks assembled:


Links:

http://www.orangepi.org/orangepizero/

No comments:

Post a Comment