Cubietruck. Travel mini server. Part 1

    image
    The idea of ​​such a server was born on vacation. In the evening I wanted to watch an online TV show on a tablet, but due to an unstable 3G reception, viewing turned into flour. Alternatively, you could download a series, but again, when downloading, the signal constantly floated, the speed jumped and the tablet had to be kept constantly on and on charge (application specifics). By evening, a couple of episodes were downloaded and you could safely watch the series.
    At this time, the idea of ​​creating this device was born. On the Internet, a large number of information storage implementations on single-board computers of different manufacturers, but a combination of several solutions was not found.

    What is in the plans: The
    brain of the entire Cubietruck
    HDD system is a 500Gb
    USB modem HUAWEI E3372
    Power AC-DC 5V
    Power DC-DC 12V - 5V (for the car)

    How it will work:
    At home it will be an ordinary NAS connected via a network cable (lan) and attached to the computer as a simple network drive.
    A WI-FI access point will constantly work on CubieTruck (in case there is no Wi-FI, but there is only a cable with DHCP).
    In the case when a network cable (lan) is connected in Cubietruck, the device connected to the Cubietruck access point must go to the Internet via a network cable, and not 3G. The modem should start working when a network cable is not connected to Cubietruck.

    When tuning relied on the post Cubietruck. A cozy, home server, so I will not describe the installation process of the system.

    Network settings


    I did all the settings on Windows.
    We write the system image to the USB flash drive, put it in its place and turn on Cubietruck.
    The system itself is installed and rebooted. After that, Cubietruck with Cubian installed is ready to go.
    In the absence of an HDMI monitor and keyboard, we need Putty .
    We go to the device with DHCP (router and server) we find the ip of our Cubietruck. We
    connect using port 36000 , since this is the default port in SSH Cubian.
    Username / password cubie / cubie
    During the configuration process did not change.

    I personally changed the port.
    To do this, edit sshd_config
    sudo nano /etc/ssh/sshd_config
    

    Find the line with port 36000
    Port 36000
    Change to
    Port 22
    Save. The editor nano for storing click Ctrl + O then Enter and Exit Ctrl + X .
    Reboot
    sudo reboot
    

    Now we can all connect via standard port 22
    Since the cube is planned as something portable, in the future the eth0 interface, that is, the Enternet port will work via DHCP , but now for convenience, I will assign it a static address:
    The interface settings are stored in the / etc / network / file interfaces
    sudo nano /etc/network/interfaces
    

    Default configuration
    auto lo
    iface lo inet loopback
    #
    auto eth0
    iface eth0 inet dhcp
    

    We change the eth0 interface . Do not forget that everyone changes the settings for themselves
    auto eth0
    allow-hotplug eth0
    iface eth0 inet static
            address 192.168.1.247
            netmask 255.255.255.0
            gateway 192.168.1.10
            dns-nameserver 192.168.1.7
    

    Reboot
    sudo reboot
    

    We ping the ya.ru host and check its availability.
    cubie@Cubian:~$ ping ya.ru
    PING ya.ru (213.180.193.3) 56(84) bytes of data.
    64 bytes from www.yandex.ru (213.180.193.3): icmp_req=1 ttl=56 time=2.04 ms
    64 bytes from www.yandex.ru (213.180.193.3): icmp_req=2 ttl=56 time=1.82 ms
    64 bytes from www.yandex.ru (213.180.193.3): icmp_req=3 ttl=58 time=1.95 ms
    

    The answer is, the network is configured

    HDD auto-mount


    Create a folder where the HDD will be mounted.
    sudo mkdir /media/files
    

    We give read / write access rights to all users.
    sudo chmod 777 /media/files
    

    Browse HDD sections.
    sudo fdisk -l
    

    I have a 500Gb drive installed
    Disk /dev/sda: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x82e3ff7e
    

    Format the disk to the ext4 file system
    sudo mkfs.ext4 /dev/sda
    

    Find out the UUID of our HDD
    sudo blkid
    

    /dev/mmcblk0p1: LABEL="cubieboard" UUID="2a1124a9-6108-4da0-932f-78ccbfd92458" TYPE="ext4"
    /dev/sda: UUID="ff0caf96-39b9-4aff-a4d0-5892abfdca8f" TYPE="ext4"
    

    We need UUID / dev / sda
    Copy UUID without quotes
    ATTENTION. Each drive has its own UUID.
    Now we add an entry to / etc / fstab
    sudo nano /etc/fstab
    

    At the very end, add
    UUID=ff0caf96-39b9-4aff-a4d0-5892abfdca8f       /media/files    ext4   defaults,acl,user,user_xattr,errors=remount-ro
    

    * Attributes are set to your liking.
    Records are separated by either a space or a tab.
    Reboot:
    sudo reboot
    

    After rebooting, check
    mount
    

    The disk is mounted in the system
    /dev/sda on /media/files type ext4 (rw,nosuid,nodev,noexec,relatime,errors=remount-ro,data=ordered)
    

    If the disk is formatted in NTFS and needs to be mounted on the system
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1            2048   234438655   117218304    7  HPFS/NTFS/exFAT
    

    First, update the list of repositories and search for indexes of updated versions of programs, drivers, the kernel and everything else:
    sudo apt-get update
    

    In order to install the ntfs-3g utility
    sudo apt-get  install ntfs-3g
    

    Find out the UUID of our section
    sudo blkid
    

    /dev/sda1: LABEL="M-PM-^]M-PM->M-PM-2M-QM-^KM-PM-9 M-QM-^BM-PM->M-PM-<" UUID="E8923D15923CE9A8" TYPE="ntfs"
    

    We need UUID = "E8923D15923CE9A8"
    Now add the entry to / etc / fstab
    sudo nano /etc/fstab
    

    At the very end, add
    UUID= E8923D15923CE9A8       /media/files    ntfs-3g   defaults,acl,user,user_xattr,errors=remount-ro
    

    * Attributes are set to your liking.
    Records are separated by either a space or a tab.
    Reboot:
    sudo reboot
    

    After rebooting, check
    mount
    

    NTFS drive mounted
    /dev/sda1 on /media/files type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
    

    Install Samba


    First, update the list of repositories and search for indexes of updated versions of programs, drivers, the kernel and everything else:
    sudo apt-get update
    

    Install samba
    sudo apt-get install samba samba-common-bin
    

    There are a lot of settings in samba, but now we only need to configure the basic ones to get access to our disk.
    We open the smb.conf file
    sudo nano /etc/samba/smb.conf
    

    You can delete all the many settings, or you can add the necessary settings to the appropriate sections
    [global]
    workgroup = WORKGROUP
    guest ok = yes
    netbios name = CubieNAS
    security = share
    browseable = yes
    [files]
    path = /media/files
    writeable = yes
    browseable = yes
    

    Restart Samba
    sudo /etc/init.d/samba restart
    

    We try to enter
    \\ CubieNAS or \\ ip.
    If everything is configured correctly, we will see the files folder.

    I have a gigabit network speed:
    EXT4 disk.
    1 Gb file is transferred at a speed of 24-29 Mb / s.
    Folder with 300 files of different formats 16-34 Mb / s
    Copying from a cube
    1 Gb file is transferred at a speed of 26-34 Mb / s
    Folder with 300 files of different formats 22-33 Mb / s
    NTFS Disk
    Copying to a cube
    1 Gb file is transferred at a speed of 8-9 Mb / s
    Folder with 300 files of different formats 3- 8 Mb / s
    Copying from a cube
    1 Gb file is transferred at a speed of 24-28 Mb / s
    Folder with 300 files of different formats 12-27 Mb / s
    Not fast, but it works.

    Cubietruck. Travel mini server. Part 2
    Cubietruck. Travel mini server. Part 3

    Also popular now: