Skip to content

[HOWTO] ROCKPro64 - SATA-Karte Btrfs Raid1 einrichten

ROCKPro64
  • So, wird Zeit um mal wieder was zu spielen 😉 Das Setup

    0_1535383578419_IMG_20180827_172323_ergebnis.jpg

    Hardware

    • ROCKPro64 v2.1 mit 2GB
    • PCIe SATA-Karte
    • 2 * HDD Festplatten (2TB)

    Software

    rock64@rockpro64:~$ uname -a
    Linux rockpro64 4.4.132-1075-rockchip-ayufan-ga83beded8524 #1 SMP Thu Jul 26 08:22:22 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux
    

    Das ist der letzte Release vom Kamil ohne Kernelupdates.

    Einrichten der HDDs

    Die zwei fabrikneuen HDDs brauchen jeweils eine Partition. Dazu nutzen wir fdisk.

    rock64@rockpro64:~$ sudo fdisk /dev/sda
    
    Welcome to fdisk (util-linux 2.31.1).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    Device does not contain a recognized partition table.
    Created a new DOS disklabel with disk identifier 0xee944413.
    
    Command (m for help): p
    Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disklabel type: dos
    Disk identifier: 0xee944413
    
    Command (m for help): n
    Partition type
       p   primary (0 primary, 0 extended, 4 free)
       e   extended (container for logical partitions)
    Select (default p): p
    Partition number (1-4, default 1): 1
    First sector (2048-3907029167, default 2048): 
    Last sector, +sectors or +size{K,M,G,T,P} (2048-3907029167, default 3907029167): 
    
    Created a new partition 1 of type 'Linux' and of size 1.8 TiB.
    
    Command (m for help): w
    The partition table has been altered.
    Calling ioctl() to re-read partition table.
    Syncing disks.
    
    rock64@rockpro64:~$ sudo fdisk /dev/sdb
    
    Welcome to fdisk (util-linux 2.31.1).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    Device does not contain a recognized partition table.
    Created a new DOS disklabel with disk identifier 0x7ee08dca.
    
    Command (m for help): p
    Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disklabel type: dos
    Disk identifier: 0x7ee08dca
    
    Command (m for help): n
    Partition type
       p   primary (0 primary, 0 extended, 4 free)
       e   extended (container for logical partitions)
    Select (default p): p
    Partition number (1-4, default 1): 1
    First sector (2048-3907029167, default 2048): 
    Last sector, +sectors or +size{K,M,G,T,P} (2048-3907029167, default 3907029167): 
    
    Created a new partition 1 of type 'Linux' and of size 1.8 TiB.
    
    Command (m for help): w
    The partition table has been altered.
    Calling ioctl() to re-read partition table.
    Syncing disks.
    

    Danach sind die HDDs soweit erst mal fertig.

    btrfs

    Ich möchte diesmal gerne mit btrfs rumspielen. btrfs ist ein Filesystem, also so wie ext3 oder ext4 (ich weiß, das ist unkorrekt. Aber für Einsteiger sollte es passen)

    rock64@rockpro64:~$ sudo apt-get install btrfs-tools 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following additional packages will be installed:
      btrfs-progs
    Suggested packages:
      duperemove
    The following NEW packages will be installed:
      btrfs-progs btrfs-tools
    0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
    Need to get 554 kB of archives.
    After this operation, 3924 kB of additional disk space will be used.
    Do you want to continue? [Y/n] 
    Get:1 http://ports.ubuntu.com/ubuntu-ports bionic/main arm64 btrfs-progs arm64 4.15.1-1build1 [551 kB]
    Get:2 http://ports.ubuntu.com/ubuntu-ports bionic/main arm64 btrfs-tools arm64 4.15.1-1build1 [2604 B]
    Fetched 554 kB in 0s (1501 kB/s) 
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
    	LANGUAGE = (unset),
    	LC_ALL = (unset),
    	LANG = "de_DE.UTF-8"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    locale: Cannot set LC_CTYPE to default locale: No such file or directory
    locale: Cannot set LC_MESSAGES to default locale: No such file or directory
    locale: Cannot set LC_ALL to default locale: No such file or directory
    Selecting previously unselected package btrfs-progs.
    (Reading database ... 46721 files and directories currently installed.)
    Preparing to unpack .../btrfs-progs_4.15.1-1build1_arm64.deb ...
    Unpacking btrfs-progs (4.15.1-1build1) ...
    Selecting previously unselected package btrfs-tools.
    Preparing to unpack .../btrfs-tools_4.15.1-1build1_arm64.deb ...
    Unpacking btrfs-tools (4.15.1-1build1) ...
    Processing triggers for initramfs-tools (0.130ubuntu3.1) ...
    update-initramfs: Generating /boot/initrd.img-4.4.132-1075-rockchip-ayufan-ga83beded8524
    Processing triggers for libc-bin (2.27-3ubuntu1) ...
    Setting up btrfs-progs (4.15.1-1build1) ...
    Setting up btrfs-tools (4.15.1-1build1) ...
    Processing triggers for initramfs-tools (0.130ubuntu3.1) ...
    update-initramfs: Generating /boot/initrd.img-4.4.132-1075-rockchip-ayufan-ga83beded8524
    Processing triggers for libc-bin (2.27-3ubuntu1) ...
    

    HDDs formatieren

    rock64@rockpro64:~$ sudo mkfs.btrfs -m raid1 -d raid1 -L "BTRFS_RAID" /dev/sda1 /dev/sdb1 
    btrfs-progs v4.15.1
    See http://btrfs.wiki.kernel.org for more information.
    
    Label:              BTRFS_RAID
    UUID:               eb901604-2d07-42b3-bbfe-faff22d7ece4
    Node size:          16384
    Sector size:        4096
    Filesystem size:    3.64TiB
    Block group profiles:
      Data:             RAID1             1.00GiB
      Metadata:         RAID1             1.00GiB
      System:           RAID1             8.00MiB
    SSD detected:       no
    Incompat features:  extref, skinny-metadata
    Number of devices:  2
    Devices:
       ID        SIZE  PATH
        1     1.82TiB  /dev/sda1
        2     1.82TiB  /dev/sdb1
    

    Somit hätten wir jetzt ein RAID1 erzeugt aus den beiden HDDs.

    rock64@rockpro64:/$ sudo blkid /dev/sda1 /dev/sdb1
    [sudo] password for rock64: 
    /dev/sda1: LABEL="BTRFS_RAID" UUID="eb901604-2d07-42b3-bbfe-faff22d7ece4" UUID_SUB="d0f458d8-c211-4c44-bc26-54e4b8cba161" TYPE="btrfs" PARTUUID="ee944413-01"
    /dev/sdb1: LABEL="BTRFS_RAID" UUID="eb901604-2d07-42b3-bbfe-faff22d7ece4" UUID_SUB="a60198f0-7de8-4bd4-9d55-01cd91692923" TYPE="btrfs" PARTUUID="7ee08dca-01"
    

    RAID1 mounten

    sudo mount /dev/sda1 /mnt
    

    Auf dem Einhängepunkt /mnt würde uns jetzt das RAID1 zur Verfügung stehen.

    rock64@rockpro64:/$ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    udev            992M     0  992M   0% /dev
    tmpfs           200M  476K  199M   1% /run
    /dev/mmcblk0p7   30G  1.3G   27G   5% /
    tmpfs           996M     0  996M   0% /dev/shm
    tmpfs           5.0M  4.0K  5.0M   1% /run/lock
    tmpfs           996M     0  996M   0% /sys/fs/cgroup
    /dev/mmcblk0p6  112M  4.0K  112M   1% /boot/efi
    tmpfs           200M     0  200M   0% /run/user/1000
    /dev/sda1       1.9T   17M  1.9T   1% /mnt
    

    !! Man muss nur eine HDD mounten, um den Rest kümmert sich btrfs !!

    Kurzer Test

    sudo mount /dev/sdb1 /media
    

    Damit würde man die zweite HDD nach /media mounten. Wenn man nun auf der HDD /mnt eine Datei erzeugt, findet man diese Datei auch unter /media wieder. Das ist die identische Kopie. Dieser Schritt ist nicht notwendig, sollte nur mal ein kleiner Test sein. Um das Schaufeln der Daten kümmert sich btrfs selbst 🙂

    Speedtest

    dd

    rock64@rockpro64:/mnt$ sudo dd if=/dev/zero of=sd.img bs=1M count=4096 conv=fdatasync
    4096+0 records in
    4096+0 records out
    4294967296 bytes (4.3 GB, 4.0 GiB) copied, 42.9631 s, 100 MB/s
    

    iozone

    rock64@rockpro64:/mnt$ sudo iozone -e -I -a -s 100M -r 4k -r 16k -r 512k -r 1024k -r 16384k -i 0 -i 1 -i 2 
    	Iozone: Performance Test of File I/O
    	        Version $Revision: 3.429 $
    		Compiled for 64 bit mode.
    		Build: linux 
    
    	Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
    	             Al Slater, Scott Rhine, Mike Wisner, Ken Goss
    	             Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
    	             Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
    	             Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,
    	             Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root,
    	             Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren Sawyer,
    	             Vangel Bojaxhi, Ben England, Vikentsi Lapa.
    
    	Run began: Mon Aug 27 16:08:17 2018
    
    	Include fsync in write timing
    	O_DIRECT feature enabled
    	Auto Mode
    	File size set to 102400 kB
    	Record Size 4 kB
    	Record Size 16 kB
    	Record Size 512 kB
    	Record Size 1024 kB
    	Record Size 16384 kB
    	Command line used: iozone -e -I -a -s 100M -r 4k -r 16k -r 512k -r 1024k -r 16384k -i 0 -i 1 -i 2
    	Output is in kBytes/sec
    	Time Resolution = 0.000001 seconds.
    	Processor cache size set to 1024 kBytes.
    	Processor cache line size set to 32 bytes.
    	File stride size set to 17 * record size.
                                                                  random    random     bkwd    record    stride                                    
                  kB  reclen    write  rewrite    read    reread    read     write     read   rewrite      read   fwrite frewrite    fread  freread
              102400       4    10449     7641    10617    11416     1666     6508                                                          
              102400      16    18176    22496    24975    31205     5943    14868                                                          
              102400     512    44167    42565    41055    43099    31827    46765                                                          
              102400    1024    50660    48283    49612    51093    42008    55360                                                          
              102400   16384    69188    69437   112674   118407   109011    74552                                                          
    
    iozone test complete.
    

    hdparm

    Mit hdparm kann man die HDDs schlafen legen. Gerade die mechanischen Dinger, können einem ganz schön auf die Nerven gehen. Da ich diese Installation später mal als NAS nutzen möchte, müssen die Platten nicht ewig laufen. Macht die mechanischen Dinger auch nur kaputt 😉

    Installation

     rock64@rockpro64:/mnt$ sudo apt-get install hdparm
     Reading package lists... Done
     Building dependency tree       
     Reading state information... Done
     Suggested packages:
       apmd
     Recommended packages:
       powermgmt-base
     The following NEW packages will be installed:
       hdparm
     0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
     Need to get 89.6 kB of archives.
     After this operation, 231 kB of additional disk space will be used.
     Get:1 http://ports.ubuntu.com/ubuntu-ports bionic/main arm64 hdparm arm64 9.54+ds-1 [89.6 kB]
     Fetched 89.6 kB in 0s (460 kB/s)
     perl: warning: Setting locale failed.
     perl: warning: Please check that your locale settings:
     	LANGUAGE = (unset),
     	LC_ALL = (unset),
     	LANG = "de_DE.UTF-8"
         are supported and installed on your system.
     perl: warning: Falling back to the standard locale ("C").
     locale: Cannot set LC_CTYPE to default locale: No such file or directory
     locale: Cannot set LC_MESSAGES to default locale: No such file or directory
     locale: Cannot set LC_ALL to default locale: No such file or directory
     Selecting previously unselected package hdparm.
     (Reading database ... 46794 files and directories currently installed.)
     Preparing to unpack .../hdparm_9.54+ds-1_arm64.deb ...
     Unpacking hdparm (9.54+ds-1) ...
     Setting up hdparm (9.54+ds-1) ...
    

    Konfiguration

    ls /dev/disk/by-id
    

    Die ID's der HDDs auslesen. In meinem Fall sieht das so aus.

     rock64@rockpro64:/dev/disk/by-id$ ls
     ata-ST2000LM015-2E8174_ZDZ2MY9W        mmc-SC32G_0x601d3b65        mmc-SC32G_0x601d3b65-part4  wwn-0x5000c500b111120c
     ata-ST2000LM015-2E8174_ZDZ2MY9W-part1  mmc-SC32G_0x601d3b65-part1  mmc-SC32G_0x601d3b65-part5  wwn-0x5000c500b111120c-part1
     ata-ST2000LM015-2E8174_ZDZ2MZ1W        mmc-SC32G_0x601d3b65-part2  mmc-SC32G_0x601d3b65-part6  wwn-0x5000c500b1112c07
     ata-ST2000LM015-2E8174_ZDZ2MZ1W-part1  mmc-SC32G_0x601d3b65-part3  mmc-SC32G_0x601d3b65-part7  wwn-0x5000c500b1112c07-part1
    

    Das sind meine beiden Festplatten

    • ata-ST2000LM015-2E8174_ZDZ2MY9W
    • ata-ST2000LM015-2E8174_ZDZ2MZ1W

    Config bearbeiten

    sudo nano /etc/hdparm.conf
    

    Das dann ans Ende der Datei. Sieht dann so aus

     #HDDs schlafen legen nach 20 Minuten (240*5=1200Sek.=20Min.)
     /dev/disk/by-id/ata-ST2000LM015-2E8174_ZDZ2MY9W {
     # mult_sect_io = 16
     # write_cache = off
     # dma = on
     spindown_time = 10
     }
     
     /dev/disk/by-id/ata-ST2000LM015-2E8174_ZDZ2MZ1W {
     # mult_sect_io = 16
     # write_cache = off
     # dma = on
     spindown_time = 10
     }
    

    Die 10 ist mein Testwert, man hat ja nicht ewig Zeit 😉 Danach mal eben neustarten und etwas warten, dann legen sich die Platten schlafen. Das machen sie natürlich nur, wenn es keine Aktivität gibt! Bei mir hat das wunderbar geklappt, nach einer knappen Minute waren sie leise.
    Die 240 also 20 Minuten, benutze ich schon ewig auf meinem NAS, ohne Probleme. Also, nach dem Testen auf 240 umstellen! Neustarten nicht vergessen.

    Fazit

    Soweit hat alles wie erwartet funktioniert, so könnte man nun ein nettes kleines NAS aufbauen, was nicht besonders viel Strom verbraucht. Man hätte aber auch noch genug Rechenleistung um damit mehr zu machen als zwei Platten als Datengrab zu gebrauchen, mal sehen wie es weiter geht. Ich denke ein wichtiges Thema ist Verschlüsselung. Bin kein Freund davon, Daten unverschlüsselt auf einer HDD rumliegen zu haben. Ich schau mal was es als nächstes gibt, für heute soll es das mal gewesen sein.

    Wie immer, wer Fehler findet oder Tipps geben kann, dafür gibt es dieses Forum. Traut Euch! 😉

  • Ergänzung

    Mal ein paar Filme vom meinem aktuellen NAS auf die Platte an der PCIe SATA-Karte geschaufelt.

    0_1535474720924_rp64_copy_NAS_to_SATA.png

    Ok, Geschwindigkeit ist für ein Datengrab noch akzeptabel.

  • SATA - Booten jetzt möglich

    ROCKPro64
    1
    0 Stimmen
    1 Beiträge
    244 Aufrufe
    Niemand hat geantwortet
  • VON USB 4TB HD BOOTEN GEHT NICHT

    ROCKPro64
    5
    0 Stimmen
    5 Beiträge
    566 Aufrufe
    W

    Hallo FrankM,
    schade das Du mir nicht weiter helfen kannst, aber danke für Deine schnelle Antwort.
    Mit dem Bugreport kenne ich nicht aus, bin noch leihe.

    Einen schönen Abend noch.

    Winne

  • 0 Stimmen
    8 Beiträge
    1k Aufrufe
    FrankMF

    Die Verlinkung hatte ich überlesen, sorry.

    Es gibt nur eine Handvoll Karten, die im PCIe Port funktionieren. Warum, kann ich dir leider nicht beantworten. Es liegt aber mit Sicherheit an falschen Einstellungen im Kernel und an fehlenden Treibern. Ich habe hier auch eine andere Karte rumliegen, die erzeugt immer nur eine Kernel Panic 😞

    In diesem Thread steht einiges was geht und was nicht.
    https://forum.pine64.org/showthread.php?tid=6459

  • 0 Stimmen
    1 Beiträge
    472 Aufrufe
    Niemand hat geantwortet
  • ROCKPro64 - Armbian nand-sata-install

    Verschoben Armbian
    14
    0 Stimmen
    14 Beiträge
    2k Aufrufe
    FrankMF

    Ich habe heute, nachdem es einige Updates von Armbian gab, mal nachgeschaut ob ein spezieller Fehler verschwunden ist.
    Und zwar geht es um das Resizen der Partion nachdem wir Armbian auf eine USB-HDD (USB3) installiert haben.

    Ich setze dafür folgendes System ein.

    Hardware ROCKPro64v2.0 4GB RAM SanDisk 240GB 2,5 Zoll HDD (nix tolles) Software Welcome to ARMBIAN 5.67.181217 nightly Debian GNU/Linux 9 (stretch) 4.4.167-rockchip64

    Was sehe ich nach dem Reboot?

    root@rockpro64:~# df -h Filesystem Size Used Avail Use% Mounted on udev 1.9G 0 1.9G 0% /dev tmpfs 388M 5.3M 383M 2% /run /dev/sda1 220G 1.3G 207G 1% / tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup tmpfs 1.9G 4.0K 1.9G 1% /tmp /dev/mmcblk0p1 58G 1.3G 57G 3% /media/mmcboot /dev/zram0 49M 3.0M 43M 7% /var/log tmpfs 388M 0 388M 0% /run/user/0

    Korrekt die Größe angepasst!

    Schnell mal den USB3 testen

    root@rockpro64:~# sudo dd if=/dev/zero of=sd.img bs=1M count=4096 conv=fdatasync 4096+0 records in 4096+0 records out 4294967296 bytes (4.3 GB, 4.0 GiB) copied, 38.0723 s, 113 MB/s

    Der Adapter

    root@rockpro64:~# lsusb -vvv Bus 004 Device 002: ID 2109:0715 VIA Labs, Inc. Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 3.10 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 9 idVendor 0x2109 VIA Labs, Inc. idProduct 0x0715 bcdDevice 1.31 iManufacturer 1 VLI Manufacture String iProduct 2 VLI Product String iSerial 3 000000123ADA bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 121 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 224mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk-Only iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 1 bNumEndpoints 4 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 98 iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x04 EP 4 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 0 Command pipe (0x01) Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x85 EP 5 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 MaxStreams 32 Data-in pipe (0x03) Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x06 EP 6 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 MaxStreams 32 Data-out pipe (0x04) Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x87 EP 7 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 0 MaxStreams 32 Status pipe (0x02) Binary Object Store Descriptor: bLength 5 bDescriptorType 15 wTotalLength 70 bNumDeviceCaps 4 FIXME: alloc bigger buffer for device capability descriptors Device Status: 0x0000 (Bus Powered)

    Ein lästiger Fehler weniger. 😉

  • [HOWTO]ROCKPro64 - NAS bauen Teil 1

    Angeheftet ROCKPro64
    5
    0 Stimmen
    5 Beiträge
    2k Aufrufe
    FrankMF

    Die Pinne für den Adapter liegen ja nur parallel zum Eingang des Steckers vom Netzteil. Also, solange da nichts abfackelt kann man da eine Menge Strom drüber jagen 🙂

    Wenn es funktioniert ist ja alles gut.

  • Neuer Bootprozeß seit 0.7.x

    ROCKPro64
    1
    0 Stimmen
    1 Beiträge
    843 Aufrufe
    Niemand hat geantwortet
  • 0 Stimmen
    2 Beiträge
    2k Aufrufe
    FrankMF
    Ergänzung

    Eine andere SATA-Karte und eine Riser-Karte mit angeschlossener GPU startet nicht.

    rock64@rockpro64v2_1:~$ uname -a Linux rockpro64v2_1 4.4.132-1075-rockchip-ayufan-ga83beded8524 #1 SMP Thu Jul 26 08:22:22 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux