Linux hard drive information

Sometimes it is useful to get some more information about your hard drive than just the size remaining. For this purpose there is a Linux package called smartmontools available, which can be easily installed.

$ sudo apt-get install smartmontools

Once available you can inspect different quantities and qualities of your drive by issuing smartctl commands. A good article is available over at TechRepublic.com written by Vincent Danen

The tools will be installed to /usr/sbin/smartctl. In case you are on a machine that does not have sbin in it’s path (I was working on a bananapi, which does not) you will have to precede the commands with the full path.

Some commands and their output are given below.

Get the basic information from your drive

$ sudo smartctl -i /dev/sda
smartctl 6.4 2014-10-07 r4002 [armv7l-linux-3.4.112-bananian] (local build)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Red (AF)
Device Model:     WDC WD20EFRX-68EUZN0
Serial Number:    WD-WCC4M0AX088S
LU WWN Device Id: 5 0014ee 2b66bd176
Firmware Version: 82.00A82
User Capacity:    2.000.398.934.016 bytes [2,00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Sun Apr 16 17:57:13 2017 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

Starting a short test

$ sudo smartctl --test=short /dev/sda

Viewing the test results

The test results will be at the end of the ouptut provided by smartctl -a. Test information starts with a hash.

$ sudo smartctl -a /dev/sda

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%      8034         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

Setting up an NFS server on Banana Pi

Install the NFS Server

sudo apt-get install nfs-kernel-server

 

—————————————-
Mount the drive

sudo nano /etc/fstab
more /etc/fstab

# FSTAB FOR BASE SYSTEM

# 512 MB swapfile
/swapfile1 swap swap defaults 0 0

# NAS Volume mount
# /dev/sda2 /mnt/nas_volume ext4 auto 0 0

—————————————–
Setting up the exports

sudo mkdir /nfs
cd nfs
ln -s /mnt/nas_volume/Public/ Public
sudo ln -s /mnt/nas_volume/Public/ Public
sudo ln -s /mnt/nas_volume/georg/ Georg
sudo ln -s /mnt/nas_volume/marit/ Marit
sudo ln -s /mnt/nas_volume/backup/ Backup
sudo ln -s /mnt/nas_volume/gabi/ Gabi

————————————
Configuring the exported directories

sudo nano /etc/exports

sudo exportfs -ra

———————————
Starting the server

sudo service nfs-kernel-server start
sudo tail /var/log/messages

————————————————————————-
After normal restart

georg@bananapi:~$ sudo ps -elf |grep rpc
[sudo] password for georg:
1 S root 23 2 0 60 -20 - 0 rescue 18:16 ? 00:00:00 [rpciod]
5 S root 1432 1 0 80 0 - 473 poll_s 18:16 ? 00:00:00 /sbin/rpcbind -w
5 S statd 1464 1 0 80 0 - 551 poll_s 18:16 ? 00:00:00 /sbin/rpc.statd
1 S root 1476 1 0 80 0 - 581 epoll_ 18:16 ? 00:00:00 /usr/sbin/rpc.idmapd
1 S root 1992 1 0 80 0 - 663 poll_s 18:16 ? 00:00:00 /usr/sbin/rpc.mountd --manage-gids
0 S georg 2684 2618 0 80 0 - 931 pipe_w 18:18 pts/0 00:00:00 grep rpc
georg@bananapi:~$ sudo ps -elf |grep nfs
1 S root 29 2 0 60 -20 - 0 rescue 18:16 ? 00:00:00 [nfsiod]
1 S root 1955 2 0 60 -20 - 0 rescue 18:16 ? 00:00:00 [nfsd4]
1 S root 1956 2 0 60 -20 - 0 rescue 18:16 ? 00:00:00 [nfsd4_callbacks]
1 S root 1957 2 0 80 0 - 0 svc_re 18:16 ? 00:00:00 [nfsd]
1 S root 1958 2 0 80 0 - 0 svc_re 18:16 ? 00:00:00 [nfsd]
1 S root 1959 2 0 80 0 - 0 svc_re 18:16 ? 00:00:00 [nfsd]
1 S root 1960 2 0 80 0 - 0 svc_re 18:16 ? 00:00:00 [nfsd]
1 S root 1961 2 0 80 0 - 0 svc_re 18:16 ? 00:00:00 [nfsd]
1 S root 1962 2 0 80 0 - 0 svc_re 18:16 ? 00:00:00 [nfsd]
1 S root 1963 2 0 80 0 - 0 svc_re 18:16 ? 00:00:00 [nfsd]
1 S root 1964 2 0 80 0 - 0 svc_re 18:16 ? 00:00:00 [nfsd]
0 S georg 2687 2618 0 80 0 - 931 pipe_w 18:18 pts/0 00:00:00 grep nfs
georg@bananapi:~$

—————————————–
Adding the NFS group

sudo groupadd --gid 1111 nfs
groups
sudo usermod -aG nfs georg

—————————————–
Assign the new group to existing files

sudo chown -R root:nfs *

—————————————–
Adding the group on the client machine

sudo addgroup --gid 1111 nfs
sudo usermod -aG nfs georg
groups

Using Californium in Eclipse

Why Californium?

When dealing with IoT on a technical level one of the protocols to look at ist CoAP. The Californium™ library is one of the rare libraries that provides the CoAP protocol on top of the secure DTLS protocol. Both CoAP respective DTLS are based on UDP.

So let’s go for it…

Setting up Eclipse for usage with Californium

I am using Ubuntu 14.04 and the Eclipse you can install with the package manager is not featuring the required extensions:

  • EGit
  • Maven

So first thing is to install them manually.

Eclipse Install Menu

Select a site with Eclipse software

Eclipse Install Software Dialog. Select Site

Install EGit into Eclipse

Eclipse software dialog - Select EGit

Eclipse software installation - Egit

Install Maven Integration into Eclipse

Eclipse software installation - Maven

Import Californium into Eclipse

Importing a maven project into Eclipse

Select californium directory with projects

eclipse-iot-10

Setting up an own project using Californium

eclipse-iot-12

eclipse-iot-13

eclipse-iot-14