Difficulty importing tar.gz file from usb drive

In migrating to my new system, I’m having problems importing a tar.gz file from the old system (Emoncms Core v11.10.3 | App v3.1.6 | EmonHub Config v2.1.6) into the new. I did this once but can’t seem to get it to work again with a later update. The usb isn’t recognized or at least it sees it as an unmounted drive at /dev/sdb. I have a mounted usb drive at /dev/sda (/mnt/usb0) which I use for backups and this seems to be working.

=== USB Emoncms import start ===
2026-05-28-10:15:50
Backup module version:
    "version"      : "2.3.7",
EUID: 1000
Reading /opt/emoncms/modules/backup/config.cfg....
Location of data databases: /var/opt/emoncms
Location of emonhub.conf: /etc/emonhub
Location of Emoncms: /var/www/emoncms

Scanning for USB card reader:
- Mounted disk: /dev/disk/by-id/usb-Kingston_DataTraveler_3.0_94DE80724791E2C0793E1C41-0:0 at /dev/sda
- Unmounted disk: /dev/disk/by-id/usb-Mass_Storage_Device_121220160204-0:0 at /dev/sdb
- Error: Unmounted disk has incorrect number of partitions
- No card reader found on sdc
- No card reader found on sdd
- No card reader found on sde
USB drive not found

# Emoncms Export and Import scripts config file
## DEFAULT CONFIG ##
# These settings are used for both the export and import scripts.
# To export from one location and import into another
# Used by both PHP and Bash and comments are not ignored
# Change all capitalised placeholders to relevant locations
# user
user="pi"
backup_script_location="/opt/emoncms/modules/backup"
# Directory location of Emoncms
emoncms_location="/var/www/emoncms"
# Destination location of exported backup .tar.gz - Must be writable
#backup_location="/var/opt/emoncms/backup"
backup_location="/mnt/usb0"
# location of phpfina phpfiwa and phptimeseries databases
database_path="/var/opt/emoncms"
# Location of emonhub.conf - leave blank if backup not required
emonhub_config_path="/etc/emonhub"
# Location of specimen emonhub config
emonhub_specimen_config="/opt/openenergymonitor/emonhub/conf"
# Location of compressed backup data to import .tar.gz
backup_source_path="/var/opt/emoncms/backup/uploads"

pi@emonpi:~ $ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0  961M  0 loop
sda           8:0    1 57.8G  0 disk
└─sda1        8:1    1 57.7G  0 part /mnt/usb0
sdb           8:16   1 29.7G  0 disk
└─sdb1        8:17   1 29.7G  0 part
mmcblk0     179:0    0 59.5G  0 disk
├─mmcblk0p1 179:1    0  512M  0 part /boot/firmware
├─mmcblk0p2 179:2    0  6.5G  0 part /var/log.bak
│                                    /
└─mmcblk0p3 179:3    0 52.4G  0 part /var/opt/emoncms
zram0       254:0    0    2G  0 disk [SWAP]

Not sure what is going on here but I must be doing something wrong. The system seems to be working ok otherwise, anyway as far as I can tell so far.
Thanks. I can send more details if needed.
Cheers,
Bob

If you still have the original SD Card, you can try the method here. - Update & Upgrade — OpenEnergyMonitor 0.0.1 documentation

Try doing a reboot from cold (i.e. remove power completely). If you remove and reinsert an SD card/drive the UAB number changes each time. From a cold boot it will start from scratch again.

Thanks, Brian, I seem to have had success from backing up the old system on the SD card and importing on to the new system using the old SD on a card reader. I guess my problem was backing up the old system to a usb drive and then trying to import from that usb drive. The old machine gave no errors backing up to the usb drive but luckily I never had to restore from that.

My question now is how should I configure my system to use a usb drive as a backup/restore storage? The answer must be in how the /backup/configure.cfg is coded to correctly export and import data rather than storing it on the SD card. Can you or anyone comment on this? Thanks.

Cheers,

Bob

@glyn.hudson @TrystanLea I suspect the script needs to be a little better at detecting USB devices.