NCP Documentation: NCP on Raspberry PI 4 booting from USB (no microSD needed)

  • This wiki attempts to create a beginner-friendly ‘how-to guide’ to boot your NCP from a USB media.
  • I have updated the doc, accordingly.
  • You are most welcome to contribute, by commenting and editing this (wiki).

Difficulty Level: easy

Why would you want to boot from a USB drive?
It is faster and a SSD has a far longer life expectancy as the microSD. So as a home user who wants to have a working system over several years I highly suggest doing this. You could of course also use an HDD, but it would spin 24/7.

  • Warning: You will not be able to keep the data on your USB drive as you have to flash the .img to it. A backup is therefore required to restore settings and data.
  • Warning: You will not be able to format any USB device any more using the NCP web panel and will have to do it manually by using the terminal.
  • Warning: You will not be able to use nc-snapshot because your USB drive will be an ext4 filesystem and not BTRFS.

What we have:

  • No setup yet

or

  • NCP on Raspberry Pi 4 booting from microSD with external USB drive for data.
    (If you are still using a armhf image (32bit) you will have updatet to arm64 after following this guide.)

What we want

  • NCP runs from a USB 3 drive (preferably a SSD drive) without the need for a microSD.

What we need:

  • Raspberry Pi 4B
  • USB drive (you should use a SSD with USB 3.0)
  • microSD card (only if you don’t run the latest bootloader already)
  • Secondary backup drive with a nextcloud_bkp of all your ncp data, (nc-backup) & a ncp-config backup of our configurations (export-ncp) on a separate drive

Preparation:

  1. Backup all your data and configs to a separate drive using nc-backup & export-ncp.

  2. If your bootloader is not up-to-date, or you are not sure about it, update it to the latest version. (A more complete how to you find here or, if you set up a new Pi follow this documentation.)

    1. login into your Pi using SSH
    2. type sudo apt update & sudo apt upgrade
    3. type: sudo rpi-eeprom-update to see if an update is available.
    4. if there is type sudo rpi-eeprom-update -a to update
  3. Power off the pi (sudo shutdown now)

  4. Disconnect all of your attached data drives and remove the SD card from the Pi.

Installation

  1. Flash the latest Image “NextCloudPi_Rpi_xx-xx-xx.img” to the USB media.
  2. Connect the Pi to Ethernet, plug in the drive and boot. Give it a few minutes and then go to https://nextcloudpi.local (or use the IP address of the Pi) and activate NCP (don’t forget to note the passwords)

Restore your Backup

1. Restoring NCP Settings

  1. Login to the NextcloudPi web panel (at nextcloudpi.local)

  2. On the left in the section “System” choose “nc-automount” and activate it.

  3. login to your pi via SSH (ssh pi@IP-ADDRESS | pswd: raspberry)

  4. update the pi with sudo apt update & sudo apt upgrade

  5. update ncp by typing sudo ncp-config

  6. Type df -h to list attached drives.

  7. Look for your backup drive and type: ls /media/BACKUP-DRIVE/

  8. You should see a list of your backups.

  9. Look for the config-backup and note its name: ncp-config_XXXXXXXX.tar

  10. Go back to the NextcloudPi web pannel (at nextcloudpi.local)

  11. On the left in the section Backups choose nc-import-ncp

  12. Fill in path and file name and hit apply

  13. This will not take long as it only restores your ncp settings.
    (You will not have any user or data restored. This we will do in the follwing step.)
    nc-import-ncp


2. Restoring the data-backup
(the process for the dateless and full backup is the same)

  1. Follow step 1-7 from the description above
  2. Look for the backup file and note its name: nextcloud-bkp_XXXXXXXX_XXXXXXXXXX.tar
  3. Go back to the NextcloudPi web pannel (at nextcloudpi.local)
  4. On the left in the section Backups choose nc-restore
  5. Fill in path and file name and hit apply
  6. Depending on your backup size this can take a very long time.
  7. Once the backup has been restored successfully reboot NCP using the web pannel (top right) or just reboot the pi with SSH sudo reboot now
  8. Now you will be able to login with your former login and all your data, apps and users should be restored.
    Note:
    • The web panel login will not be restored, so you will have to use the one you got when you first activated (Installation: Step 2).
    • Do not attempt to use the web panel to format a USB device!

Congratulations, you are done. Please leave a comment if you succeeded or have issues. It helps to improve this documentation.


Note: 02.January 2021: I have followed this tutorial myself and succeeded.

@JimmyKater , @rakekniven or any other authorized person, could you turn the post above into a wiki? Thanks!


The second half of the post above is basically a copy of the NCP docs page with some minor editing from me.
__

And here are some of the points I don’t understand yet: (whenever I get an Answer I’ll add clarification/explanation to the wiki above)

  1. I understand the first part about updating the bootloader. But what I don’t understand is why, after updating it I still need to boot from a microSD and can not use the USB media with the flashed NCP image right away.

  1. Under point 3. in Setting-up the USB as boot media => ROOT_PATH & BOOT_PATH
    is written in capital letters, does that mean that I need to fill in my root and my boot path, or do I type that command 1:1 into the terminal?

  1. After I have set up NCP this way, do I need to do something about the datadir?
    The ncp wizard that shows up whenever we set up a new instance gives the option to move the datadir to a usb media and format it as BTRFS.
    I will have the whole NCP instance on my 1TB SSD. Do I need to make partitions and format them or do I just leave it as it is?

It is a wiki now. Will move it to a better category later.

1 Like

moved to How to

Right now I have flashed NextCloudPi_RPi_11-27-20 onto a microSD and a SSD.
I want to use this SSD for /boot /root and for the datadir. Can I do that without any further set up or do I need to format a partition for the datadir or something else?

thx

Sorry, I guess I’m not really explaining well what I want…


After flashing the NextCloudPi_RPi_11-27-20.img to a SSD drive the drive looks like this:

Screenshot 1

On the bottom you see 235.47 GB unallocated space.


If I boot from this drive and use the wizard it will ask to move the data to a USB drive.

Screenshot 2

Obviously, I will choose No as I’m already having everything on the USB drive.

BUT,

I assume NCP will be using the unallocated space for my data, is that correct?

Is it correct that I do not need to make any manual partitioning?
(will it allocate disk space to data, NC-Apps, other software i.e. PiVPN, PiHole automatically from the unallocated space?

No ncp can not use unallocated space
No it is not correct, manual resizing of the partition sdb2 is required.
You need to use a program like gparted (Linux) to resize sdb2, to be able to use the space.

Once you boot from sdb, as you said obviously, there is no need to move the datadir.

1 Like

Learned some new stuff.

  • Using the latest bootloader I can simply flash the current NCP image to the SSD, plug it into the Pi and boot from it, no need for a microSD at any time.

  • After booting and activating ncp it will automatically allocate the empty space to rootfs.

Screenshot_2021-01-01_14-12-01

I will be updating the wiki accordingly.

1 Like

Nice, I didn’t realize it could ! Thanks for contribution :heart:

3 posts were split to a new topic: Basic Problem setting up NCP on a RPi4

After updating eeprom and flashing latest image to an USB-SSD, I get some errors during boot:
“Timeout waiting for device dev/disk/by-partitionid…”
“Dependency failed for File system check”
“Dependency failed for /boot”
“Dependency failed for unattended upgrades shutdown”
“Dependency failed for Local File System”
The SSD has a boot partition and a rootfs partition.
What am I missing?

Did you solve it by now?

I assume you have tried more than once?
Try using a USB stick just to eliminate any issues with the SSD.

Yeah, I solved it finally but ran into other issues. First, the error while booting was related to a poor quality or unsupported USB3toSATA-Converter. I changed it and it worked then.
After sucessfull deployment I did all necessary configurations and nextcloud ran for approx. 1 week.
Currently I am running into ext4-fs errors. Haven’t had the time looking into this, i’m a bit annoyed by now…

:see_no_evil:

good to hear that you solved it.
…but sorry to hear that the problems did not stop. Hope you can solve them ASAP without loosing all nerves. :sweat_smile:

Hello. I am having problems to boot NCP from a SSD in a Raspberry Pi 4. I followed the step of the guide. So, I updated the bootloader using those commands. Also, I formatted the SSD to ext4 and I used Etcher to install the latest image of NCP. However, when I turn the Pi on, it doesn’t detect the SSD, so it asks me for an SD card.

Any idea of how to boot from SSD?

Thanks.

strange…
Do you have a SD card lying around?
What does it say if you type:
sudo rpi-eeprom-update


Change Boot Order Manually

If there are no updates use
sudo raspi-config

and enable USB Boot (it should do this by default… actually)




04 Confirmaton

If this still does not work:

  • Are you using the correct .img for your SBC from own your bits? (I once made the mistake to donwload berryboot… that did not work)
  • Re-download the .img, it could be that something went wrong when downloading it. (check md5sum)
  • Try to flash again
  • Use another USB media to eliminate a faulty SSD (cable, case or drive itself)
  • run in a circle and cry out loud… (not sure it will work, but it will solve some of the frustration)

btw

No need to do that, if you flash using etcher it will format the drive and once it boots from it, it will put all in place automatically. Just flash and plug in… actually

1 Like

I changed the boot order as you said and it worked!

It should have boot from the SSD anyway since there was no SD card, but…

Thanks!

1 Like