steffo
Posts: 25
Joined: Sat Jan 18, 2014 12:43 pm

SD-card and HDD relations

Tue Feb 26, 2019 6:28 pm

Hello,
I have a home automation system om my Rpi3 B+
I have a SD-card to boot from and the root file system on a HDD, the reason is to not wear out the SD-card.
Earlier I hade a SSD as boot disk but the system was unreliable to reboot from the SSD so I reverted to SD-card for boot.
The HDD is a WD Elements Portable 1TB, I oswer from Rpi with a 'original 5V 2.5A supply and no power issues in dmesg.


Now I have this set-up:

Code: Select all

pi@raspberrypi:/usr/share/hassio/homeassistant $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       916G  2.8G  867G   1% /
devtmpfs        460M     0  460M   0% /dev
tmpfs           464M     0  464M   0% /dev/shm
tmpfs           464M   13M  452M   3% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           464M     0  464M   0% /sys/fs/cgroup
/dev/mmcblk0p1   44M   22M   22M  51% /boot
tmpfs            93M     0   93M   0% /run/user/1000

Code: Select all

pi@raspberrypi:/usr/share/hassio/homeassistant $ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 931.5G  0 disk
└─sda1        8:1    0 931.5G  0 part /
mmcblk0     179:0    0  14.9G  0 disk
├─mmcblk0p1 179:1    0  43.9M  0 part /boot
└─mmcblk0p2 179:2    0  14.8G  0 part

Can I tell from this that the SD-card is only used at boot and all my application work is done to the HDD?
If so - is this the best way to get a longlife robust system that don't let me down on re-boots..
Thanks in advance

User avatar
HawaiianPi
Posts: 5847
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SD-card and HDD relations

Tue Feb 26, 2019 7:01 pm

Having /boot on SD card is kind of old school. It works, but the SD card is still written to during firmware and kernel updates.

The newer way to USB boot is to write a recent Raspbian image directly to the USB drive, and if it won't boot on its own, format an SD card with the FAT32 file system and only put the bootcode.bin file on it. This will often fix USB boot problems, and it's also how you USB boot older models or the Pi Zero. You can download the latest stable branch bootcode.bin here (bootcode.bin).

For drives with a slow start up you can add an empty file named "timeout" to the bootcode.bin SD card to increase wait time to 5 seconds (default is 2).

When using a bootcode.bin only SD card the entire OS runs from the USB drive and the SD card is not used by the OS at all.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

User avatar
rpdom
Posts: 17189
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: SD-card and HDD relations

Tue Feb 26, 2019 7:15 pm

HawaiianPi wrote:
Tue Feb 26, 2019 7:01 pm
Having /boot on SD card is kind of old school. It works, but the SD card is still written to during firmware and kernel updates.

The newer way to USB boot is to write a recent Raspbian image directly to the USB drive, and if it won't boot on its own, format an SD card with the FAT32 file system and only put the bootcode.bin file on it. This will often fix USB boot problems, and it's also how you USB boot older models or the Pi Zero. You can download the latest stable branch bootcode.bin here (bootcode.bin).

For drives with a slow start up you can add an empty file named "timeout" to the bootcode.bin SD card to increase wait time to 5 seconds (default is 2).

When using a bootcode.bin only SD card the entire OS runs from the USB drive and the SD card is not used by the OS at all.
This is a good use for one of those fake cards that misreports its capacity. Just create a small FAT32 or FAT16 file system on it, 2MB would be plenty and follow the instructions above.
Unreadable squiggle

steffo
Posts: 25
Joined: Sat Jan 18, 2014 12:43 pm

Re: SD-card and HDD relations

Thu Mar 14, 2019 3:26 pm

Thanks guys -
Bought the new Pi to be able to direct boot from HDD...
I had problems booting from my USB disk for quite a while and I searched and searched...
Did this "old school" without knowing your solution..

If I would have- I would not have bought a new Pi and now I need to re-install all my stuff again...

u think thos old school will wear my SD-card so I should change my strategy?

fruitoftheloom
Posts: 23392
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: SD-card and HDD relations

Thu Mar 14, 2019 3:32 pm

steffo wrote:
Tue Feb 26, 2019 6:28 pm
Hello,
I have a home automation system om my Rpi3 B+
I have a SD-card to boot from and the root file system on a HDD, the reason is to not wear out the SD-card.
Earlier I hade a SSD as boot disk but the system was unreliable to reboot from the SSD so I reverted to SD-card for boot.
The HDD is a WD Elements Portable 1TB, I oswer from Rpi with a 'original 5V 2.5A supply and no power issues in dmesg.


Now I have this set-up:

Code: Select all

pi@raspberrypi:/usr/share/hassio/homeassistant $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       916G  2.8G  867G   1% /
devtmpfs        460M     0  460M   0% /dev
tmpfs           464M     0  464M   0% /dev/shm
tmpfs           464M   13M  452M   3% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           464M     0  464M   0% /sys/fs/cgroup
/dev/mmcblk0p1   44M   22M   22M  51% /boot
tmpfs            93M     0   93M   0% /run/user/1000

Code: Select all

pi@raspberrypi:/usr/share/hassio/homeassistant $ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 931.5G  0 disk
└─sda1        8:1    0 931.5G  0 part /
mmcblk0     179:0    0  14.9G  0 disk
├─mmcblk0p1 179:1    0  43.9M  0 part /boot
└─mmcblk0p2 179:2    0  14.8G  0 part

Can I tell from this that the SD-card is only used at boot and all my application work is done to the HDD?
If so - is this the best way to get a longlife robust system that don't let me down on re-boots..
Thanks in advance

Special bootcode.bin-only boot mode

https://www.raspberrypi.org/documentati ... bootmodes/
Rather than negativity think outside the box !
RPi 4B 4GB (SSD Boot)..
Asus ChromeBox 3 Celeron is my other computer...

steffo
Posts: 25
Joined: Sat Jan 18, 2014 12:43 pm

Re: SD-card and HDD relations

Thu Mar 14, 2019 5:06 pm

Hello -strange things emerging...

Tried and it does not really work for me this "new way" to do hdd booting.

1) I used etcher to burn a full image to hdd (latest light)
2) I formated a SD-card FAT32 and called it "new card"
- booting up saye (can't expand file system and boot and root partitions on different devices)

This is on a Pi v2
Tried on Pi v3 B+ with same hdd & SD-card - same result

3) used the full image hdd in my Pi v2 without the SD-card - boot failure as expected
4) used the full image hdd in my Pi v3 B+ without the SD-card - boot success with msg "resizing boot file system - rebooting in 5 sec" - ish - system works fine
5) moved sd-card & hdd to Pi v2 and it boots perfectly (obviously due to the resize made by the Pi B+ when booting without SD-card)

So - I needed to boot from hdd only in a Pi3 to prepare the HDD fileexpansion first time, then it works either way Pi version..

What is the way for pepol that only have Pi v2 laying around?

I am fine now apart from that I really like to understand what happened

again thanks guys!!

User avatar
HawaiianPi
Posts: 5847
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SD-card and HDD relations

Thu Mar 14, 2019 7:13 pm

steffo wrote:
Thu Mar 14, 2019 5:06 pm
Hello -strange things emerging...

Tried and it does not really work for me this "new way" to do hdd booting.

1) I used etcher to burn a full image to hdd (latest light)
2) I formated a SD-card FAT32 and called it "new card"
- booting up saye (can't expand file system and boot and root partitions on different devices)

This is on a Pi v2
Tried on Pi v3 B+ with same hdd & SD-card - same result
Something is missing in your description. That error happens when you put /boot on the SD card. With bootcode.bin-only it should work. Which "full-image" are you using, and what was on the SD card?

What is the way for pepol that only have Pi v2 laying around?
The way is what I said above. Write the latest image directly to the USB drive, and put just bootcode.bin on a FAT32 micro SD card. The error you received typically happens when all of /boot is on the SD card and should not happen with bootcode.bin only. Unless you are using a very old image. Which version of Raspbian are you using?

Or maybe your HDD is taking too long to spin-up? Did you try it with a "timeout" file (on the bootcode.bin-only SD card)?

Do you have a Pi 2B v1.1 or v1.2?

FYI:
I have tested this on an old Pi 2B v1.1 and it works. I did need to use a powered HDD (the Pi 2B could not spin up the HDD its own), and I also needed the timeout file. Hard drives are more of a problem on the older systems (Pi B+ and 2B v1.1), because they only have 600mA on the USB ports until the firmware loads and bumps it up to 1.2A (the Pi 3B/3B+ have the full 1.2A at start up).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

LTolledo
Posts: 3475
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: SD-card and HDD relations

Thu Mar 14, 2019 9:57 pm

I've tested the bootcode.bin method on the following specs

Hardware:
Raspberry Pi Model B+ (not the RPi3B+)
with heatsinks, fan-cooled
5V 2.4A PSU from dollar store
1GB known fake microSD
2.5" Seagate 2TB HDD
Eluteng SATA to USB3.0 adaptor (the black version, not the blue version)
Ethernet LAN connection

Software:
bootcode.bin copied to the FAT32 formatted fake microSD
Raspbian Stretch with Desktop, flashed to the HDD using Etcher
Samba, Deluge, RPi-Monitor, Webmin

Setup was used as a test system for NAS and torrent-box,

It worked. No problems on first boot and succeeding boots and reboots. No edits to config files for longer wait times.
Used the system for about 3 months, before upgrading the system to RPi3B that doesnt use the bootcode.bin method
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

steffo
Posts: 25
Joined: Sat Jan 18, 2014 12:43 pm

Re: SD-card and HDD relations

Fri Mar 15, 2019 4:38 pm

Something is missing in your description. That error happens when you put /boot on the SD card. With bootcode.bin-only it should work. Which "full-image" are you using, and what was on the SD card?
I had a 2018-11-13-raspbian-stretch-lite on the powered hdd burned with etcher
Yesterday version of https://github.com/raspberrypi/firmware ... otcode.bin

Formated SD-card to FAT32 and coppied above bootceode.bin

  • Mounted sd-card and hdd on RPpv2 - failed due to "cannot expand file system"
    Mounted sd-card and hdd on Rpiv3 B+ - failed due to "cannot expand file system"
    Mounted hdd on RpiV2 - failed as it can not nativlly boot on HDD
    Mounted hdd on RpiV3B+ - booted fine with the message "resizing file size" as described before.
After booting on RpiV3 B+ I inserted SD-card and now it seems boot stable.

Maybe I made a misstake when I burned hdd with etcher - I really like to know what I am doing wrong.. and dont know how to find out what version I have on my old Rpi :|

For my knowledge I would really like to understand why I see this scenarios.
regards Steffo

User avatar
HawaiianPi
Posts: 5847
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SD-card and HDD relations

Sat Mar 16, 2019 9:58 pm

I'm stumped by your problem. With what you have posted, you should NOT be getting that error. :?

The only thing I can think of at this point is some kind of boot-loader incompatibility that's throwing an odd error. You said you switched to the HDD because you were having trouble with reboots from an SSD. Try the SSD again with the bootcode.bin-only SD card and let us know how that goes. Or just go back to /boot on SD, since that seemed to be working for you.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

steffo
Posts: 25
Joined: Sat Jan 18, 2014 12:43 pm

Re: SD-card and HDD relations

Sun Mar 17, 2019 7:35 am

Hello,
Now after I booted without the SD-card and file system was resized it works good.
I made a few re-boots and again a few hung and I needed to power toggle.

Then after pushing in the SD-card with bootcode.bin it have not failed me.

I will keep it like this for my Homeassistant but still I dont know why it did not work as below.
I will exeperiment with my old Rpi (V2), a poswered HDD and a bootcode SD-card later and keep you posted!

Thanks for all help!

Return to “Beginners”