Install Gladys on an SSD instead of a micro-SD

We were talking about this this morning with @Terdious. For those with complex setups and a lot of data written daily, using a micro SD card isn’t necessarily optimal. Over time, you quickly end up with corrupted files and not great read/write performance.

However, for less than €30 you can switch your Pi to an SSD. Here are a few references I found:

Then you need to clone the Gladys image onto the SSD, connect the SSD via USB to the Pi, and run a small command to tell it to boot from it

EDIT 18/01/2022: I made a video on the subject, super simple without any command line!

Check it out here:

I know @terdious is going to try a setup like this to see if it can improve his performance and the stability of his instance.

I’m curious to know if any of you are already doing this? :slight_smile:

If so, it would be great to have a tutorial in the documentation to guide new users towards this option, as clearly using an SD card long-term is the best way to have data corruption and it spoils the Gladys experience a bit ^^

I’m on a RPi3 so the procedure is slightly different for USB boot (and permanent from what I understood).

For the installation, I just used etcher with the Gladys image to create my boot on the SSD.

If needed, I can find the SSD and the case I bought.

Hello,

A quick update on the installation of Gladys on an SSD and its performance. Unfortunately, I didn’t take the time to test it with an SD card.

For the installation, I followed the tutorial and generally had no issues. The only issue is that the menus are not exactly the same, so you just need to take the time to look around :slight_smile:

It’s important to understand that you first need an SD card, perform the manipulations, and then reboot by removing the SD card and you’re done.

pi@gladys:~ $ dd if=/dev/zero of=test bs=1048576 count=200
200+0 records in
200+0 records out
209715200 bytes (210 MB, 200 MiB) copied, 3.41732 s, 61.4 MB/s
pi@gladys:~ $ dd if=test of=/dev/null bs=1048576
200+0 records in
200+0 records out
209715200 bytes (210 MB, 200 MiB) copied, 0.405086 s, 518 MB/s

Quite honorable throughput :slight_smile:

I’m surprised by the write performance (it seems low to me), what SSD do you have?

If you could do a quick tutorial on the Gladys documentation, that would be great :smiley:

Edit: In any case, you will gain in stability. Performance will remain good over time, and you won’t have data consistency issues!

Low flow rate, I think we should also consider the fact that we’re using a USB port. I would like to see more feedback on this type of installation with more powerful SSDs (Samsung, etc.).

For the SSD: PNY CS900 SSD Interne SATA III 240Go, Lecture 535MB/s

No problem with the SSD then.

Wait, what generation is your Raspberry Pi?

If it’s a Pi 1, 2, or 3, there were indeed many limitations on the USB port, and it’s probably the bottleneck of your setup.

If it’s a Pi 4, be careful about the port you connected your SSD to, I think they are not all equal:

https://www.raspberrypi.org/documentation/hardware/raspberrypi/usb/README.md#:~:text=The%20Raspberry%20Pi%20also%20has,a%20maximum%20speed%20of%20480mbps.

AH! :smiley:

Indeed, with the raspberry being under a piece of furniture and hidden, I didn’t take the time to check that :slight_smile: It’s probably the issue, in any case, in read we are much higher than what an SD card can offer

I’m not sure it’s only due to the SSD, since you wrote just before that there is cache that may have biased your results ^^

I’m not sure, however, that your commands were correct, I advise you to do as in this tutorial: Your Web Host Doesn’t Want You To Read This: Benchmark Your VPS

To test write performance:

dd if=/dev/zero of=diskbench bs=1M count=1024 conv=fdatasync

Then you clear the cache:

echo 3 | sudo tee /proc/sys/vm/drop_caches

And finally you test in read:

dd if=diskbench of=/dev/null bs=1M count=1024

Can you tell us after that?

Yes, I did it in fast mode, I wanted to take the time to do a better test :smiley:

Hello !!

Well, it’s finally a conclusive test.

I started by following all the steps carefully, but I never managed to boot from the SSD… but I was stuck on USB 3.0. This morning, following the advice of @damalgos, I tried the complete procedure again but on USB 2 and this time it works perfectly. Then I restarted this time on USB 3.0 and it worked. I will detail the exact procedure later. I was able to perform this on a Raspberry Pi 4 1GB and on Pi 4 4GB. I will test tonight on the Pi 4 8GB, especially for performance. I used a Samsung T5 as an SSD - 75€ - tiny ^^

Following the procedure on Pi4 4GB on USB 2 port:

  • Write: 50-60 MB/s
  • Read: 500-600 MB/s

On USB 3.0 port:

  • Write: 200-250 MB/s
  • Read: 550-650 MB/s

For information, you need to perform the test

Several times to get the correct result.

Performance Comparisons:

- Hardware Used:

- Prerequisite:
The test was performed with the official Gladys V4.0.4 image by cutting the docker containers at startup and after performing the necessary operations to be able to boot on the Raspberry Pi’s USB ports.

- SSD Testing:*

  • Samsung 860 EVO SSD Test:
    • USB2 Port:
      • Write = 30 to 31 MB/s
      • Read = 570 to 620 MB/s
    • USB3.0 Port:
      • Write = 190 to 210 MB/s
      • Read = 560 to 610 MB/s
      • !! Warning !! Does not run in USB3.0 with the mentioned enclosure @pierre-gilles
In image

  • Samsung Portable T5 SSD Test:
    • USB2 Port:
      • Write = 30 to 60 MB/s
      • Read = 530 to 590 MB/s
    • USB3.0 Port:
      • Write = 190 to 220 MB/s
      • Read = 300 to 600 MB/s
In image

- Micro SD Testing:*

  • Samsung Pro Plus Micro SD Test:
    • Write = 19 to 23 MB/s
    • Read = 44 to 46 MB/s
In image

  • SanDisk Extreme PLUS Micro SD Test:
    • Write = 30 to 40 MB/s
    • Read = 44 to 46 MB/s
In image

Nice tests!!

Thanks for your feedback :slight_smile:

Could you convert this into a small tutorial in the documentation? (with your performance figures, it will show the benefits of using an SSD instead of a micro SD card)

@Terdious I assume you used the SSDs you had on hand? Because I’m not sure a 500GB SSD is very useful :slight_smile:

On my side, I bought this SSD: Transcend 64 GB paired with this case.

I just need to take the time to run the speed tests.

It’s because of the large number of scheduled scenes, and its huge dashboard!!

Yes I can do that!! Are the tax screens worth it? Should I keep the post with the links to Amazon for the doc or should I remove the links?

Yes with the links it’s great :slight_smile:

If you can put exactly the commands that you have made that would be great!

Well, yes and no. For the 860 Evo, I had it on hand. For the Samsung T5, I bought it partly for its small size (slightly smaller than the Pi) and it’s the only one available (didn’t find the 250GB for less than €156). And partly because I plan to put other things on it.

Just then, @pierre-gilles, is it possible to put multiple instances of Gladys on it? Does the port change automatically on a second Docker container? A tutorial on how to do it if that’s not the case?

You can use the code provided in the zigbee2mqtt article, you just need to change the port and the database name

A very big thank you @Jean34, I will look into it, try to find the code and come back if needed ^^

It’s in the Gladys documentation, under the « docker » section!