Is there a script to move SD partitions to HDD, leaving boot RO

Starting a new server with a PI3 and emoncms. But i’ve had multiple sd crashes. Can the MMC blk devices be replaced with a HDD on USB.

I’ve seen a few scripts around but none seems to work flawlessly and only seem to copy the rootfs and not the writeable /var

Are you using the emonSD image?

i have been using emonSD-17Oct19 image for the last 8 years. But I have got through a number of SD cards that become non recoverable. I now have a Pi3 and was hoping the run direct from a USB HDD or SSD. We suffer from frequent power cuts.
Is my best bet to install raspian direct to the HDD and install all the packages manually.
I’ve tried the usb to hdd script and although it successfully transfers mmcblk2, when it reboots it is still using the sd card. And this script only transfers one of the sd card partitions.

Which script?

I suggest installing Raspbian to the SDCard, transferring the rootfs to the HDD and then install using emonScripts but without the initial bit re preparing the SD card - i.e. just do the curl and run the script.

Also I strongly suggest not booting from the HDD, but continue to use the SDCard for boot as long term it is more reliable.

An HDD is just as susceptible to power cuts as they are often accompanied by slight power surges. As a minimum have a surge protector, but I’d invest in a small UPS so the power down can be controlled.

There are a couple of bit on the Raspbian forum on moving to HDD
https://www.raspberrypi.org/forums/viewtopic.php?t=44177
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=196778

Use the PARTUUID not the device name.

the script in /var/www/emoncms/scripts/usb_hdd/usb_hdd**

i was reading John banks post

That is quite old. Follow the Raspbian methods I posted to move the rootfs. Start with a fresh Raspbian Lite and move before installing emoncms.