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.

  • 0 Stimmen
    1 Beiträge
    60 Aufrufe
    Niemand hat geantwortet
  • 0 Stimmen
    1 Beiträge
    355 Aufrufe
    Niemand hat geantwortet
  • NVMe SSD Speed auf Kernel 5.0 von Kamil

    Verschoben ROCKPro64
    11
    0 Stimmen
    11 Beiträge
    864 Aufrufe
    W

    @FrankM sagte in NVMe SSD Speed auf Kernel 5.0 von Kamil:

    Kurz was zum Nanopc-t4, das war das Board, wo ich damals schon geschrieben habe, wie man da die Wärme weg bekommt!? Ok, bleiben wir beim ROCKPro64 😉

    Hmm .. nix dazu im Forum bei dir gefunden .. nach wärme , nano usw. gesucht ..

    Den Teil verstehe ich nicht. Woher soll er denn das 0.7er Image laden???

    Von seiner SD .. ein bisschen wirr von mir beschrieben.

    Nackter Rockpro, ohne USB-Devices, ohne NVMe, ohne emmc, ..

    Ablauf 1:
    SD Karte mit 0.7er Image (das bisher immer funktioniert hatte) rein -> Rockpro geht an, beide LEDs gehen an (was aber bisher nur die weisse war), kein weiterer Boot-Vorgang.

    Ablauf 2:
    SD Karte mit 0.8er Image (gleiche SD Karte) rein -> Rockpro geht an, perfekter Boot Vorgang.

    Das Monitor "Problem" und das 0.7er scheinen hier ggf. zusammen zu hängen, jedoch - mehr debugging nur mit der RS232 möglich, ggf. Mist im First-Stage-Loader ..

    (Erase SPI , etc. alles hatte nichts verändert ..)

    Wenn jemand richtig Zeit und Lust hätte könnte man sich ja am Armbian nand-sata Script orientieren:

    Da habe ich auch schon mal drüber nachgedacht....

    Ich würde 5$ Patreon Money dazu geben 🙂

    Einen schönen Sonntag.

  • VON USB 4TB HD BOOTEN GEHT NICHT

    ROCKPro64
    5
    0 Stimmen
    5 Beiträge
    563 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
    1 Beiträge
    471 Aufrufe
    Niemand hat geantwortet
  • [HOWTO] SD-Karte beschreiben

    ROCKPro64
    1
    0 Stimmen
    1 Beiträge
    442 Aufrufe
    Niemand hat geantwortet
  • 0 Stimmen
    2 Beiträge
    749 Aufrufe
    FrankMF

    Offizielle Bestätigung -> http://files.pine64.org

  • ROCKPro64 - PCIe SATA Karte

    Verschoben Hardware
    13
    0 Stimmen
    13 Beiträge
    4k Aufrufe
    FrankMF

    @elRadix : With pine64 sata-card you can use two hdd's. https://www.pine64.org/?product=rockpro64-pci-e-to-dual-sata-ii-interface-card

    For working cards please look into this thread before you buy anything.