this post was submitted on 19 Aug 2024
48 points (94.4% liked)

Selfhosted

40296 readers
251 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Hello, it's me again. I read a lot about how unreliable micro SD cards are if you use your RPi to selfhost some stuff. Now I wanted to ask if some of you might have recommendations for cheap but reliable external SSDs. I did some research on Amazon but there are some brands I never heard before (Intenso, SSK, Netac, etc.) and don't know if they can be trusted.

all 49 comments
sorted by: hot top controversial new old
[–] Engywuck@lemm.ee 11 points 3 months ago* (last edited 3 months ago) (2 children)

I'm using a couple of cheap Kingston A400 for my setup (120 and 480 GB) and they work just fine. One thing I noticed is that the 120 GB one's health went down to 92%, from 100%, in "just" one year (smart parameter). But that's implies a lifetime of more that 12 years, so I'm not excessively concerned.

EDIT: of course, just after writing this comment the smaller SSD began to behave strangely (errors in dmesg).

[–] theorangeninja@lemmy.today 5 points 3 months ago (3 children)

Are you using SATA to USB adapters? If yes, which one work well?

[–] thayer@lemmy.ca 3 points 3 months ago (2 children)

You can go with something like this if you want a clean solution.

I use a drive dock station for my backup drives, and I have a few of these for one-offs too.

[–] theorangeninja@lemmy.today 1 points 3 months ago

Thank you, I think I will go with this and a SSD from crucial to start off and then add some HDDs for backup and NAS. Do you think this kind of enclosure is reliable enough for a NAS? And is there enough airflow if you add two 3.5" HDDs together in the dock station?

[–] Engywuck@lemm.ee 0 points 3 months ago

Yeah, I use something like this, a no-brand enclosure.

[–] paf@jlai.lu 2 points 3 months ago* (last edited 3 months ago)

I'm not 100% sure but this might also depend which OS you are running on your pi. Did change from SD card to SSD few years back for my home assistant setup (now running with a mini pc) at the time I went for a geekpi adapter (can't recall exact model).

Try a quick ducduck search "sata adapter #yourOS#" and see if a list come up. Here is one for HA (but surely more models are compatible than the ones listed here) https://community.home-assistant.io/t/working-usb-enclosures-and-adapters-with-hassos/212763

Edit: as for SSD, I went for Samsung EVO model

Sidenote: all SSD will be more reliable than a sd card because they are less sensitive to rewrite counts

[–] Engywuck@lemm.ee 1 points 3 months ago

I have a couple of no-brand SATA-USB enclosers with some jmicron chipset. Can't remember the exact chipset right now, as my RPi is not working ATM (see edit).

[–] FarraigePlaisteach@lemmy.world 2 points 3 months ago (1 children)

Is there a one-line command to check my SSD? I have a headless setup. When I’ve tried on the past there was more results coming back than I knew what to do with.

[–] Engywuck@lemm.ee 1 points 3 months ago (2 children)

sudo smartctl -a /dev/sdX should do the job

[–] FarraigePlaisteach@lemmy.world 1 points 3 months ago (1 children)
[–] Engywuck@lemm.ee 1 points 3 months ago
[–] theorangeninja@lemmy.today 1 points 3 months ago

Is this command to check the health of the SSD/drive in general?

[–] just_another_person@lemmy.world 8 points 3 months ago (1 children)

Just stick to the brands with multi-year warranties.

[–] theorangeninja@lemmy.today 5 points 3 months ago (1 children)

For example? Kingston, Crucial?

[–] just_another_person@lemmy.world 2 points 3 months ago

Have a look here: https://www.backblaze.com/blog/ssd-edition-2023-mid-year-drive-stats-review/

I've never had a single problem with Crucial, Seagate, WDC. I've had a few issues with Seagate 990 Pros having issues, though it was later made known that Samsung had some bad batches out in the world. Hopefully that is not the case anymore.

[–] seaQueue@lemmy.world 8 points 3 months ago* (last edited 3 months ago) (3 children)

Buy used Samsung mSata or m.2 2230 drives on fleaBay. Stick with Samsung and other well known brands with decent spec sheets and warranties, that's the cheapest way to handle durable storage on a pi. USB enclosures are like $5-7 on AliExpress or fleaBay.

Buy MLC drives if you need higher endurance (check the model no and look up the datasheet.) TLC will usually be fine for a few years, MLC will last a bit longer. If you're killing drives faster than you expect buy larger (512 instead of 256GB), blkdiscard the entire device once it's installed and then only partition 60-80% of it. Never touch the rest of the freed storage and the drive controller should be able to use those blocks for wear levelling to reduce the NAND wear rate.

Edit: One heads up, I usually buy used drives from eBay because their buyer protection is top tier, if there's anything wrong with the drive when it's delivered or when I test it it goes right back for a refund. This makes buying blind viable thanks to an easy return policy.

If you're sourcing used drives somewhere else insist on seeing SMART data before purchasing and don't buy heavily worn drives. Look at the drive model datasheet, find the warranted endurance of the drive (if it's a 512GB drive rated for 1 DWPD over 3y that means the rated endurance is ~ 0.5T * 365 * 3 or roughly ~550TB written over 3y. Pass on buying drives approaching their rated endurance, try to buy lightly used drives wherever possible and you shouldn't have problems with reliability.

[–] Peffse@lemmy.world 3 points 3 months ago (2 children)

whoa whoa, I would not recommend a cheap AliExpress USB enclosure at all. As others have already pointed out there's a whole ever-growing blacklist of partially incompatible enclosures that basically flake out whenever they feel like it. Worse yet, not every device is on the list so you frequently have to research and add devices yourself.

The last generic Inland m.2 enclosure I bought worked fine... for 1 hour. Then it disconnected and reconnected. I thought it was just random chance, until it happened again and again and again. Did the deep-dive research, found the chipset was partially incompatible and I had to return it.

DO NOT BUY CHEAP ENCLOSURES FOR EXTERNAL MEDIA ON RPI

[–] seaQueue@lemmy.world 2 points 3 months ago

My approach to this has always been to buy one enclosure and validate it, then go buy like 8 more after thorough testing. Obviously don't place an order for 10 units of an unknown tech item from AliExpress or you're looking at a bad time. Look for enclosures that use known good chipsets and there's not as much risk as you're expecting. I have something like 8 msata enclosures here that work flawlessly and another half dozen sata+nvme rtl9210b enclosures that also work well.

[–] theorangeninja@lemmy.today 1 points 3 months ago (1 children)

What about enclosures from Sabrent? That should be a reliable manufacturer, no?

[–] Peffse@lemmy.world 1 points 3 months ago

Unfortunately I don't have any recommendations I can give you as each enclosure could use a different chipset. It seems that the brand does not have a good reputation for compatibility but that list is fairly old at this point. All I can say is if you find an enclosure you like, plug the model number into the raspberry pi forum and see if anybody had to add it to the quirks list.

[–] khorak@lemmy.dbzer0.com 1 points 3 months ago (1 children)

Since you mentioned MLC, maybe you have some suggestions for eg used server grade disks? Would the Rpi be able to run something like the Intel datacenter SSDs eg S3700? The power loss protection is really something I would like to have, especially in a homelab scenario. Or any other notable MLCs with larger capacities? I am having trouble finding a good list sorted by max potential storage.

[–] seaQueue@lemmy.world 3 points 3 months ago* (last edited 3 months ago) (1 children)

Most enterprise drives are TLC these days, MLC just doesn't provide the storage density that enterprises require anymore. I only mentioned MLC because you'll occasionally find mSATA drives in the <=256GB range that use MLC. You have to check the datasheet for each model, look for endurance rated at 5DWPD or higher, those will typically be MLC or heavily over provisioned TLC. If you want enterprise drives with greater endurance than the usual 0.5 or 1 DWPD look for the over provisioned models with capacities like 400GB, 800GB, 1.6T or 3.2T. those are 512GB, 1TB, 2TB and 4TB raw capacity drives with a bunch of flash set aside for wear leveling purposes. You don't often see 300GB, 600GB, 1.2T or 2.4T drives anymore but those are often very high endurance (write intensive, 10 DWPD or so) models.

Check the datasheets for drives when you're shopping and you can get a pretty good idea of what their durability is like, I usually buy 1 DWPD drives for write occasional bulk storage and 3+ DWPD for anything with a serious write workload. You can also help the drive controller a bit by running blkdiscard against the entire device before partitioning, then only partition and use ~80% of available space. The drive controller will typically grab free unused blocks and use them for wear leveling but only if they've been marked free (TRIMmed) and never allocated after. If you can't find or can't afford high endurance drives you can usually buy a larger lower endurance drive and over provision it in this way to extend its lifespan.

(The last time MLC flash was really common was back in maybe 2014-2015, some of the older Samsung pro drives like the 850/860 pro were built using MLC. Those had legendary real world endurance, I think they'd get up to 10+PB written before actually failing. It's a shame they didn't have PLP because they would have made good budget array storage if they did.)

[–] khorak@lemmy.dbzer0.com 1 points 3 months ago

Legend, thank you!

[–] theorangeninja@lemmy.today 1 points 3 months ago

I heard it's not so good practice to buy used drives so I will not do that for now but thanks for the second part I will consider that!

[–] empireOfLove2@lemmy.dbzer0.com 4 points 3 months ago (1 children)

I've personally been using a Teamgroup 1tb from Amazon and a few KingSpec (from Aliexpress) 500gb SATA and PCIe M.2 drives for about a year and a half now without much problem or reported health loss. They are not performance winners of course but they still beat the pants off spinning rust.

YMMV of course, always keeps backups or don't keep anything you'd be super sad to lose on them.

[–] theorangeninja@lemmy.today 2 points 3 months ago (1 children)

What does YMMV mean? And yeah sure, I just want to run the OS on the SSD and a few containers but the rest on HDDs and also backups on other HDDs.

[–] Markaos@lemmy.one 5 points 3 months ago* (last edited 3 months ago)

Your mileage may vary - your experience might be different for one reason or another

[–] inagy@lemmy.world 4 points 3 months ago (2 children)

As the Pi can boot from USB, I wonder if anyone tried to use those "SSD in pendrive form factor" devices for this, eg. the Transcend ESD310S 512GB?

[–] theorangeninja@lemmy.today 3 points 3 months ago (1 children)
[–] inagy@lemmy.world 4 points 3 months ago

Is cake day even a thing on day zero? Haha.. thanks! :)

[–] PracticalChameleon@feddit.org 2 points 3 months ago

Jeff Geerling ran some benchmarks on USB storage options in 2020, including a pen drive SSD: https://www.jeffgeerling.com/blog/2020/fastest-usb-storage-options-raspberry-pi

[–] colebrodine@midwest.social 2 points 3 months ago (1 children)

Which Raspberry Pi do you have? There are some very reasonably priced M2 hats out there that you can boot from on the Pi 5, including the Raspberry Pi branded one.

[–] theorangeninja@lemmy.today 1 points 3 months ago (1 children)

But an M.2 is usually more expensive than a normal 2.5" SSD. Is it better to boot from a M.2 HAT than from USB?

[–] rbesfe@lemmy.ca 2 points 3 months ago (1 children)

M.2 would technically be the best performance available, but realistically I don't think you'd notice the difference over a USB SSD. Maybe a few extra seconds on boot.

[–] theorangeninja@lemmy.today 1 points 3 months ago (1 children)

Okay and what about longevity of the drives? That should just depend on the number of writes, right?

[–] colebrodine@midwest.social 2 points 3 months ago

I'm not sure what kind of money you want to spend? The M2 Hat is ~$14 USD and a 2242 NVME SSD can be had for ~$30-$40 USD since you don't care as much about performance.

The USB to SATA adapter is going to run ~$10 USD and the SATA SSD drives are going to start ~$20 USD are go up from there depending on size, performance, etc.

If size of storage is an issue, the SATA SSD is probably the better route. I believe the NVME would be better performance since it utilizes the bus on the Pi more fully.

I would guess that for the money, most M2 drives and SATA SSD drives are going to be similar lifespans

[–] Decronym@lemmy.decronym.xyz 2 points 3 months ago* (last edited 3 months ago)

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
HA Home Assistant automation software
~ High Availability
NAS Network-Attached Storage
PCIe Peripheral Component Interconnect Express
RPi Raspberry Pi brand of SBC
SATA Serial AT Attachment interface for mass storage
SBC Single-Board Computer
SSD Solid State Drive mass storage

[Thread #925 for this sub, first seen 19th Aug 2024, 07:35] [FAQ] [Full list] [Contact] [Source code]

[–] Dirk@lemmy.ml 2 points 3 months ago

Samsung T7 totally worth every cent. You connect it via USB-C.

[–] TheBigBrother@lemmy.world -2 points 3 months ago (1 children)

Look for log2ram on a LLM.

[–] theorangeninja@lemmy.today 1 points 3 months ago (1 children)
[–] khorak@lemmy.dbzer0.com 6 points 3 months ago (1 children)

Log2ram is a service which keeps your log files in RAM, avoids the constant writes to disk and really helps with SDcard longevity. Probably helps with SSDs too.

You can just Google it and check out the github page, no need for LLM accuracy lottery

[–] theorangeninja@lemmy.today 1 points 3 months ago (1 children)

Thank you very much, this helped way more than the other comment!

[–] TheBigBrother@lemmy.world -2 points 3 months ago

what it's log2ram

Log2Ram is a utility designed to extend the lifespan of storage devices, particularly SD cards in Raspberry Pi systems, by reducing write operations[1][4]. Here's an overview:

How it works

Log2Ram redirects log files from being written directly to storage (/var/log) to being written to RAM instead[1]. It creates a mount point in RAM for /var/log, so all logs are written to temporary memory (tmpfs) rather than the physical disk[2].

Benefits

  1. Extended storage life: By reducing write operations to SD cards or SSDs, Log2Ram helps prolong their lifespan[1][4].

  2. Improved performance: Writing to RAM is faster than writing to disk, enhancing system responsiveness[4].

  3. Transparency: Applications continue to write logs to /var/log as usual, unaware that it's now in RAM[1].

Key features

  • Configurable RAM allocation for logs (default 40M)[2]
  • Daily synchronization of RAM logs to disk via a cron job[1]
  • Synchronization on system shutdown to preserve logs[1]
  • Optional use of rsync for synchronization[2]
  • Compatibility with zram for space-efficient log storage[3]

While Log2Ram offers significant benefits, it's important to note that logs may be lost in case of unexpected power loss or system crashes before synchronization occurs[3].

Citations: [1] How log2ram works. | The World's Linux Journal https://linuxfun.org/en/2021/01/01/what-log2ram-does-en/ [2] Log2Ram https://nimno.net/dev/linux/log2ram/ [3] Extend The Lifespan of Your Raspberry Pi's SD Card with log2ram https://ikarus.sg/extend-sd-card-lifespan-with-log2ram/ [4] Optimizing Performance with Raspberry Pi Log2Ram https://fleetstack.io/blog/raspberry-pi-log2ram-guide [5] Using Log2RAM on the Raspberry Pi - Pi My Life Up https://pimylifeup.com/raspberry-pi-log2ram/ [6] How To Write Log Files In RAM Using Log2ram In Linux - OSTechNix https://ostechnix.com/how-to-write-log-files-in-ram-using-log2ram-in-linux/ [7] Extend your Pi's SD Card Life with Log2Ram! - YouTube https://www.youtube.com/watch?v=MrRGa7kAhQo [8] How to extend the lifespan of memory cards on the Raspberry Pi with Log2Ram https://www.geekbitzone.com/posts/2020/log2ram/log2ram-raspberry-pi/