PINE64

Full Version: Install OS on RAID1 thanks to dual SATA board?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello,

Let's say I buy this list
ROCKPro64 4GB Single Board Computer
ROCKPro64 12V 5A EU POWER SUPPLY
ROCKPro64 PCI-e to Dual SATA-II Interface Card
ROCKPro64 Metal Desktop/NAS Casing
Fan for ROCKPro64 Metal Desktop/NAS casing

16GB CLASS10 MICROSD CARD

and two SSD drive

How can I install armbian on a RAID1 of these two drives?
I understood that these two drives can't boot. I need to flash the SDcard with armbian installer (https://www.armbian.com/rockpro64/) and I'll always have to boot from SDcard.

However, I think it's better to install and use the system from SSD because it's safer (Sdcard don't last long) and SSD have more capacity and they would be in RAID1 (so safer also)

So, how can I boot from SDcard but have armbian system installed on SATA and specifically on RAID1 (2 SSD)?

Do you know tutorials (text or video) explaining how to reach to this situation?
- How to create RAID1 for 2 SATA drive connected to ROCKPro64 through the ROCKPro64 PCI-e to Dual SATA-II Interface Card?
- How to install armbian system to this RAID1 from the micro SDcard plugged in the ROCKPro64?

Now a side question : as we are talking about SATA-II, I guess the speed of SSD doesn't really matter as it is SATA-II which will limit the speed?
I don't have my RockPro64, yet. (It's on its way!) I hope to do something similar. You should be able to put just the boot partition on the SD card, and then put your root partition on SATA drive. The best way to accomplish this may be to start with a complete Linux image on the SD card and boot up on it. Then setup the SATA drives as RAID1, create a partition, and copy the root partition files from the SD card over. Then configure your fstab to make the new partition root and update your bootloader configuration.

Note: The above is all speculation, and I haven't tried it!

But what I really want to do with my system is eliminate the SD card dependency entirely. I think this should be possible with u-boot, assuming u-boot has built-in support for SATA. Just flash u-boot the SPI and configure it to boot from SATA! Probably easier said than done! But it seems like it should be possible.
(05-07-2019, 04:34 PM)markb1 Wrote: [ -> ]I don't have my RockPro64, yet. (It's on its way!) I hope to do something similar. You should be able to put just the boot partition on the SD card, and then put your root partition on SATA drive. The best way to accomplish this may be to start with a complete Linux image on the SD card and boot up on it. Then setup the SATA drives as RAID1, create a partition, and copy the root partition files from the SD card over. Then configure your fstab to make the new partition root and update your bootloader configuration.

Note: The above is all speculation, and I haven't tried it!

But what I really want to do with my system is eliminate the SD card dependency entirely. I think this should be possible with u-boot, assuming u-boot has built-in support for SATA. Just flash u-boot the SPI and configure it to boot from SATA!  Probably easier said than done! But it seems like it should be possible.

As your RockPro64 is on the way and you plan to try that out, would you mind taking notes of your work and share them or even better write a step by step tutorial that, who knows, could be published on pine64's wiki?

That would be awesome!
I'll definitely document what I do, in some way! I can put a tutorial in the wiki, assuming I get it working!
It looks like Armbian has a script for setting up boot on SD, system on SATA:

https://docs.armbian.com/User-Guide_Gett...d-sata-usb

I don't quite understand the documentation, though, particularly the required conditions.

Anyway, I'm thinking you can setup the RAID1, partition and format it, and then use the create_armbian function from that script.
Got my RockPro64 today.
NOTE: Updated with step 7. Now it survives a reboot!

First experiment: RAID1 on SATA via BTRFS, with boot on SD card
Result: easy! Not hard once you know what you're doing!
Steps:
  1. Image an SD card with Armbian and boot up
  2. SSH in to it, login as root, and follow the prompts to create a user account
  3. Re-login via the user account (no strictly necessary, but I like a little protection from messing up the system as root)
  4. Partition the disks
    1. sudo fdisk /dev/sda
    2. create a partition table
    3. create a new partition to fill the disk
    4. repeat for /dev/sdb
  5. sudo nand-sata-install
    1. Select the option "Boot from SD - system on SATA..."
    2. Choose the partition /dev/sda1
    3. Choose the filesystem btrfs
    4. Allow it to complete and then reboot the system
  6. Now that your root directory is on /dev/sda1, time to make it a RAID1
    1. sudo btrfs device add /dev/sdb1 / #adds /dev/sdb1 to the filesystem
    2. sudo btrfs balance start -dconvert=raid1 -mconvert=raid1 / #converts the two-drive filesystem to RAID1
  7. VERY IMPORTANT: DO THIS BEFORE REBOOTING!!!
    1. As root (or with sudo), create a file "/etc/initramfs-tools/scripts/local-top/btrfs" with the following contents:
      Code:
      #!/bin/sh

      PREREQ=""
      prereqs()
      {
          echo "$PREREQ"
      }

      case $1 in
      prereqs)
          prereqs
          exit 0
          ;;
      esac

      . /scripts/functions
      # Begin real processing below this line

      if [ ! -x /bin/btrfs ]; then
          log_warning_msg "/bin/btrfs does not exist or is not executable"
      fi

      /bin/btrfs device scan
    2. Make the file executable: "sudo chmod a+x /etc/initramfs-tools/scripts/local-top/btrfs"
    3. Rebuild the initramfs image: "sudo update-initramfs -u"
  8. Reboot

And that's it!

If you want to use mdraid, it's going to be a little bit more work. You'll have to modify the nand-sata-install script, because it wants to format a partition. You'll have to remove that formatting part from the script and make it use a pre-formatted partition.
Update: Not so easy!

It turns out, it did not survive a reboot. Sad
Thank you for your notes.
Anyone here to help him?
I asked for help on #rock64:matrix.org matrix room chat but couldn't get any help there.
If I understand well, you setup the RAID1 correctly, then you partition and format it, and finally you installed armbian script to install it in order to boot on SD and have the system on SATA/
Am I correct?
And after all that, when you reboot it, it didn't work.
What didn't work?
It didn't boot at all? or does it boot from SD but don't reach system on the RAID1 SATA?
Are both of your drive correctly powered? I could read many people talking about power problem, need of external power supply and stuff, a button to push to power SATA drives... [I can't find back these threads...].

Right now I found that thread : https://forum.pine64.org/showthread.php?...ight=raid1

I hope you'll manage to make it work and do a beautiful tutorial for other newbies.
Thank you.
(05-10-2019, 11:19 AM)Thatoo Wrote: [ -> ]I asked for help on #rock64:matrix.org matrix room chat but couldn't get any help there.
If I understand well, you setup the RAID1 correctly, then you partition and format it, and finally you installed armbian script to install it in order to boot on SD and have the system on SATA/
Am I correct?

Sort of. With btrfs, you create the partition first, on one drive, and format it, before adding the second drive. With just one drive, and letting nand-sata-install format the partition as btrfs, booting worked fine. After the nand-sata-install script is when I turned the one-drive btrfs partition into a two-drive RAID1 btrfs partition. (That's one of the advantages that btrfs has over mdraid: it's super easy to add drives to an existing configuration.)

Quote:And after all that, when you reboot it, it didn't work.
What didn't work?
It didn't boot at all? or does it boot from SD but don't reach system on the RAID1 SATA?
Are both of your drive correctly powered? I could read many people talking about power problem, need of external power supply and stuff, a button to push to power SATA drives... [I can't find back these threads...].

At this point, I just know it didn't boot up completely. The white LED turns on for a bit, and then turns off. I can't connect to it on the network. There's no monitor attached, so I don't know if it's displaying any error messages. But I will hook up a monitor if necessary to debug this.

Some research suggests that there is some special configuration that needs to be done to the bootloader for booting multi-drive btrfs partitions. I'm still looking into it. Unfortunately, there isn't as much knowledge out there on btrfs compared to mdraid, since btrfs isn't as mature.

Quote:Right now I found that thread : https://forum.pine64.org/showthread.php?...ight=raid1

I hope you'll manage to make it work and do a beautiful tutorial for other newbies.
Thank you.

I saw that thread. I think the power supply issue depends on the exact drives in use. So far, I don't suspect that, because the RAID1 configuration works fine until I reboot.

Anyway, I'm continuing to work on this.
Pages: 1 2