9 ms·
One thing to watch out for when doing something like this is that the Raspberry Pi will by default put your file system on the SD card it boots from. SD cards
by antognini 6y ago
One thing to watch out for when doing something like this is that the Raspberry Pi will by default put your file system on the SD card it boots from. SD cards aren't meant to support a lot of write/erase cycles, so it's easy to end up with a corrupt SD card after a few months to a year depending on what you're doing on your Pi.
A workaround that can save you some headaches here is to only boot from the SD card (which means you're effectively only ever reading from the card), and then mount a filesystem on an external SSD drive. There are a couple of good guides here [1] [2].
[1]: https://www.stewright.me/2019/10/run-raspbian-from-a-usb-or-ssd-on-a-raspberry-pi-4/ https://www.stewright.me/2019/10/run-raspbian-from-a-usb-or-...
[2]: https://www.pragmaticlinux.com/2020/08/move-the-raspberry-pi-root-file-system-to-a-usb-drive/ https://www.pragmaticlinux.com/2020/08/move-the-raspberry-pi...
- christian_fei 6y agoGood points, thanks! Just stumbled upon this today by coincidence, will definitely follow the suggestion, cheers
- rovr138 6y agoLatest Pi’s can boot from external media. It’s possible to boot from an SSD
- codetrotter 6y agoYou can't just say that without including a link :P Anyways, I assume that the following is what you are referring to: https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md https://www.raspberrypi.org/documentation/hardware/raspberry... In that case, the following from the linked page might be worth making note of: > To enable USB host boot mode, the Raspberry Pi needs to be booted from an SD card with a special option to set the USB host boot mode bit in the one-time programmable (OTP) memory. Once this bit has been set, the SD card is no longer required. Note that any change you make to the OTP is permanent and cannot be undone. Not that it matters much to me but still something worth being aware of if you later try to repurpose your RPi for something else I think.
- kaszanka 6y agoThe OTP programming doesn't prevent the Pi from booting from an SD card, so it should be fine.
- rovr138 6y agoThat's specific to the > Raspberry Pi 2B v1.2, 3A+, 3B, Compute Module 3 Further down, >Raspberry Pi 3B+, Compute Module 3+ > The Raspberry Pi 3B+ and Compute Module 3+ support USB mass storage boot out of the box. The steps specific to previous versions of Raspberry Pi do not have to be executed. Then the last one, > Raspberry Pi 4 >The Raspberry Pi 4 currently requires non-default firmware to enable USB mass storage boot: see the USB mass storage boot section of the Pi 4 Bootloader Configuration page for more information. But overall, it's possible in some way with all these versions, >Available on Raspberry Pi 2B v1.2, 3A+, 3B, 3B+, and 4B only.
- bhauer 6y agoFor whatever it's worth, I use Samsung Endurance SD cards [1] in all of my Raspberry Pi 4s. While I wouldn't say any of them are subjected to heavy load, I've never had an SD failure in the ~1 year of usage they've each seen. [1] https://www.samsung.com/us/computing/memory-storage/memory-cards/microsdxc-pro-endurance-memory-card-w-adapter-64gb-mb-mj64ga-am/ https://www.samsung.com/us/computing/memory-storage/memory-c...
- jakobdabo 6y agoMost writes are the logs, I use log2ram [1], it reduces SD writes substantially. [1] https://github.com/azlux/log2ram https://github.com/azlux/log2ram
- rwbhn 6y agoThx! Looks like just what I need.
- petre 6y agoBusybox's syslog logs to RAM by default. And it can be built with runit requiring no systemd if the distribution was built for this. Also Alpine Linux runs out of RAM entirely by default. Too bad RAM is constrained on these devices and I haven't been able to make it load g_serial in Alpine for the USB gadget console on the OTG port. I used a Pi Zero W.
- dundarious 6y agoOr for those using journald, use Storage=volatile in /etc/systemd/journald.conf and then `systemctl force-reload systemd-journald`. Remove /var/log/journal to get rid of the old persisted logs.
- ocdtrekkie 6y agoI've been using a RasPi for a Pihole for years and this is a constant peeve. No matter how many precautions it takes, it eventually dives. RasPi is neat for a lot of things but I'm not convinced it's an ideal selfhosting platform. By the time you invest in the necessary addons, you might as well have gotten a used actual server.
- daniellarusso 6y agoThis is where I am at right now. I have wasted alot of time and lost a not insignificant amount of external data. I am about to buy a FreeNAS mini tower.
- deleted 6y ago[deleted]
- justinclift 6y ago> I am about to buy a FreeNAS mini tower. FreeNAS is a good choice. Should last you for years, baring any kind of weird/unusual hardware problems (which aren't expected anyway). :)
- gerdesj 6y agoVery true for a given value of true 8) You need to evaluate all the components. The RPi itself is a decent piece of kit, well tested and safe to use. Get a decent power supply to it - either a RPi branded one or at least a decent mobile charger from a brand that you trust. I generally use a decent USB stick nowadays. RPi 4 from about a month or so ago onwards will do this out of the box. You can also put a second USB stick in and clone the thing every now and then. You can PXE boot them as well (citation needed) and that brings nfs and iSCSI to bear. That's my long term plan for fleets of them. For the semi casual user, I recommend the dual USB stick combo. Quite easy to set up and you can always whip out the backup and test it on another device.
- mikenew 6y ago> RPi 4 from about a month or so ago onwards will do this out of the box Are you saying you don't need an SD card at all and it will just boot off USB?
- m_t 6y agoYes, it can do that now.
- gerdesj 6y agoI buy quite a few of them as a tinkerer and recent (~two months) ones don't need firmware/BIOS fiddling to boot off USB. Make sure you get reasonably recent stock.
- sjy 6y agoIs the documentation outdated? https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/bootflow_2711.md https://www.raspberrypi.org/documentation/hardware/raspberry... says “USB booting is still under development“ and https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/README.md https://www.raspberrypi.org/documentation/hardware/raspberry... says “The Pi 4B bootloader currently only supports booting from an SD card.”
- bscphil 6y agoYou can also netboot them, which adds a little latency but in terms of speed is likely even better than the SD card, now that the Pis have real Gbit.
- charwalker 6y agoNewer Pi's do support booting to USB drives (flash or SATA adapter) and I think the firmware update enabling that on the 3/3b/4/4b allows SATA hats and others to work but I haven't read into or tested any of them. Booting to USB protects the install better, allows easier access or setup on a PC, and I have more of them around to set up random OS or systems to test. I have several pis around and each that can boots to USB including the pihole systems at my parents place and grandma's apartment. Plus, the SD copier tool in Raspbian works with USB drives (and VHDs) so I set up the pihole for my grandma, cloned the usb drive, then sent both drives to her with the pi and called to walk her through plugging things in then used my existing remote tool on her laptop to finish set up. Now she has a backup USB drive that may need updates but is ready to go if the existing USB fails with pihole ready and everything. Plus once I update the backup drive I can clone it to the corrupt USB and she can store that as backup. I know many people have hard lines for supporting friends/family. I've taken it in stride with super useful setups for relatives (pihole and a remoting tool if I set up their laptop/desktop) and beer or similar cost for friends. One recently spilled warm garlic sauce in their laptop so I pulled it apart while they scrubbed and wiped and some local beer is cheaper than a new laptop any day.