Saving database etc to external drive

156 views
Skip to first unread message

Ken Asmus

unread,
Feb 27, 2021, 7:16:03 PM2/27/21
to weewx-user
I am a very new user of Raspberry Pi and a LINUX neophyte!

I have WeeWx running now on my RPI4 and it is working fine.

I have read in numerous locations about the limited life of the micro SD cards. So I acquired and mounted an external SSD drive to my RPI4.

But how do I save the database and any other files that are are being swapped to the SD card to the SSD to decrease wear on the SD card?

Any guidance will be appreciated.

Thanks
Ken

vince

unread,
Feb 27, 2021, 8:19:30 PM2/27/21
to weewx-user
On Saturday, February 27, 2021 at 4:16:03 PM UTC-8 ken....@gmail.com wrote:
I am a very new user of Raspberry Pi and a LINUX neophyte!


If you're willing to invest some of your time and do some free self-paced training, one course that over 675,000 people have taken is https://www.edx.org/course/introduction-to-linux - it will definitely help make Linux less of an unknown.

Les Niles

unread,
Feb 27, 2021, 8:28:23 PM2/27/21
to weewx-user
I just put everything on the SSD, so there’s no SD card to fail.  It turned out to be really easy (running Debian Buster):

1. With the RPi set up on an SD card, shut down, plug in the SSD, and start up the RPi.  Don’t try to mount it or anything; if the system tries to mount it automatically, tell it no. 
2. Figure out what “device” is associated with the SSD.  It’s probably /dev/sda as long as you don’t have any other storage like a USB stick. (If you do, take it out.) Running “fdisk /dev/sda” is a good way to check — a “p” command should show a storage device of the correct size.
3. Shut down weewx, any database, and any other services that aren’t necessary for running the OS.  Probably the best thing is to boot into single-user mode, but I didn’t bother with that.  The important thing is to make sure weewx (and mysql, if you use it) are shut down.  
4. Copy the image of the SD card to the SSD.  dd bs=1M if=/dev/mmcblk0 of=/dev/sda should do it, assuming your SD card is /dev/mmblk0 and the SSD is /dev/sda. 
5. Then shut down, remove the SD card, and start the RPi back up.  It should just boot from the SSD, and look just like it did before.  The last step is to launch raspi-config and run “Expand Filesystem" from the Advanced menu to resize the filesystem to use the available space on the SSD.  For some reason I had to do this twice; the first time only got about 90% of the space.  Note that you need to reboot after each resize.  

This worked for me on an RPi 3 B+, and should be fine on a 4.  It may not work on pre-3 versions.  Also, you should probably do an update/full-upgrade before starting, in part to make sure you have the latest firmware.  

  -Les



--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/6f74a17e-080a-4889-8475-35bd3b25e9acn%40googlegroups.com.

tomn...@frontier.com

unread,
Feb 28, 2021, 9:04:21 AM2/28/21
to weewx-user
I've used the methods in this link several times without issue.  Just my advice, but read it slowly and a couple of times
until it makes sense.  :^)


RPi 3's and 4's can be configured to boot straight from the alternate device (permanent change).  I have a few Model B+'s,
so I still have the /boot on the SD card, but in this config, it's read only, so no worries about read/write wear.

Chris

Ken Asmus

unread,
Feb 28, 2021, 7:12:08 PM2/28/21
to weewx-user
Thanks for the help. I have been trying to boot from RPI4 for 3 days now without success. I will keep trying.

John Kline

unread,
Feb 28, 2021, 10:18:47 PM2/28/21
to weewx...@googlegroups.com
I have been trying to boot from RPI4 for 3 days now without success. I will keep trying.

I went through some drives and enclosures until I found some that work.  I’m running 1TB drives on three RPi 4s and 500GB drives on three other RPi 4s.

This enclosure (for NVMe SSDs) works:

And this NVMe SSD works:
You might want to go with the 250GB.  I’m saving a ton of data from seismographs that led me to bigger sizes.

If you don’t like these, please search for known working hardware.  Even doing that, I had some misses.

On Feb 28, 2021, at 4:12 PM, Ken Asmus <ken....@gmail.com> wrote:

Thanks for the help. I have been trying to boot from RPI4 for 3 days now without success. I will keep trying.
--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages