Openhabian based SD card clone - doesn't boot

Tags: #<Tag:0x00007f617dd6edf0> #<Tag:0x00007f617dd6e990> #<Tag:0x00007f617dd6e670>

Hi

With the upcoming announcement of Release 2.5 I remembered my SD card Images for my openHAB installation.
So I thought let’s create a new image from my openhabian installation, take the same type / size SD Card and test a restore - it turned out to be a BAD IDEA :frowning: the cloned SD card didn’t boot in my Pi3.

I got nervous, checked our community and googled for different tools on Mac to create an SD card clone
Tested native DD, Etcher, ApplePiBaker, reformated several times with SD Card Formatter etc. - created an image, restored it on another card --> PI doesn’t start.

So I’m still nervous…and would appreciate your thoughts regarding my observations:

  • When I put in my productive openhabian based installation SD Card into the MAC, the MAC can not mount it (but recognizes it and PiBaker can capture it, visible as 0 in diskutil).
    This is not the case with another native Jessie installation SD Card from my other Pi. It can be mounted
    and I can see the visible files in the main structure (like cmdline.txt boot.txt etc…)

  • The cloning process of the openhabian based installation works without any errors. When I format the new SD card it is correctly mounted in the MAC, after I restored the openhabian image it can not be mounted anymore - like the productive / running SD Card which is working great in the Pi…

Is it normal that the openHABian based SD-Card can not be mounted in a Mac while I can see the files from another “non-openhabian image” installed Pi Card (mounted) ?

As I currently do not know what or where to modify / change the image capture procedure I’m pretty lost to search for reasons why an SD card clone does not boot up in the same Pi…

Would appreciate your thoughts / help where to further investigate…

With still nervous regards,
Bernd

Have you looked at this link https://beebom.com/how-clone-raspberry-pi-sd-card-windows-linux-macos/

It has worked for me in the past.

Also, why not make a backup, install a fresh image, then restore from your backup?

Make a Backup

openhab-cli backup --full
Move the backup zip file to PC or other device.

To restore the backup:

Place the backup zip file into the backups folder 

then,

sudo systemctl stop openhab2.service
openhab-cli restore /path/to/zipped/backup (var/lib/openhab2/backups)
sudo systemctl start openhab2.service

This will backup /etc/openhab2/ and /var/lib/openhab2/
This way, the information about installed addons is backuped, but not the addons itself, so when installing openhab2 new, the actual version of the bindings will be installed.
The only things to backup in addition, are the manually installed addons.

Thanks for sharing. I tried the described “dd” commands unter MacOS instructions. --> Pi didn’t boot… no blinking LED nothing…
The strange thing is that I only see the marked partition 0 in the MacOS related screenshot on the openhabian based SD card.

I make regular backups of openhab with the backup script - but I also want to capture the configurations and installations outside openhab (like USB/serial client).

Sounds like a Pi issue.:expressionless: Did you try installing a different OS on the same SD card and Pi to see if that worked?

You can also manually backup those then reinstall afterwards.

Here’s another link that may help with using dd https://linux.die.net/man/1/dd

No, this would kill my running openhabian installation :wink: currently Pi boots fine with my productive SD Card running openhabian. If I clone this card to another SD card the Pi is silent…
But could give it a try with another SD and totally different OS installation…

@bernd_d Did you ever set the Pi to boot from external mass storage?

If not sure check the /boot/config.txt and see if program_usb_boot_mode=1 is there. Or this command showing

$ vcgencmd otp_dump | grep 17:
17:3020000a

would indicate the OPT has been set to boot with without SD card.

No, I have not activated boot from external mass storage.

Here’s a topic that worked for another user. SD Clone - Have anyone tried the SD Cloner?

@H102 Are you using an openhabian Image? What happens when you put it in your SD card reader? Is it mounted and do you see all partitions or do you also get a notification that it can not be mounted ?
(only partition 0 visible by using e.g. diskutil list)

I’m using linux OS and I can see all partitions and no message about mounting error.

Try using something like GParted (or other partition tool) to see if you can view the files.

@bernd_d it kinda sounds like the SD card is bad.:thinking: I still think it’s worth a shot to install raspbian or some other OS on SD card and see if that will work in your Pi. At least this will prove the SD card is good.

Will give it a try with a raspbian on this SD Card and maybe try another new SD card for the openhabian based image…

While I wait for a new my SD Card to be delivered:
Is it normal that the openHABian based SD-Card (that boots in my Pi) can not be mounted in a Mac while I can mount and see the files from another “non-openhabian image” installed Pi Card ?

Or is just the SD Card crap and I’m lucky that my openhabian boots in the Pi at all? :face_with_raised_eyebrow:

Dunno a Mac’s capabilities in terms of file systems, but the openHABian image is just standard, i.e. ext4 and a FAT-32 boot partition.

1 Like

Not familiar with Mac either and agree with @mstormi about it being a standard ext4 and FAT-32.

Do you have another OS to try with?

@mstormi This is what worries me at my current installation setup. I got new SD Cards, tried with another one to restore the openhabian based image. Same result. Doesn’t boot. If I check the paritions on the running openhabian sd card I see this:

If I check the SD Card of another PI (regular Jessie based image) I see more:

So it looks like some partitions do not show up in the openhabian based image, although the sd card boots, but not if I create another one with this image… :thinking:

What partitions do you see on your openhabian based sd card?

Like I already said, an ext4 and a FAT-32 boot partition.
Don’t understand what you mean by “openhabian image restore” but if you flash the (original) openHABian 1.5 image to an SD (and have not messed with your Pi’s firmware), it’ll boot.
So if yours does not use a different tool to flash (such as Etcher on Windows or dd on the Pi itself)

[17:32:59] root@openhabianpi:/home/openhabian# fdisk -l /dev/sda
Disk /dev/sda: 14,9 GiB, 15931539456 bytes, 31116288 sectors
Disk model: STORAGE DEVICE
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xfc7531cb

Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1        8192    93236    85045 41,5M  c W95 FAT32 (LBA)
/dev/sda2       94208 14774271 14680064    7G 83 Linux
1 Like

Yes, the Fat-32 boot partition can’t be seen on the openhabian sd card. I wonder why it boots on the Pi. :wink: Unfortunately the clone of the sd card looks the same - but this can’t boot…
What I meant with “image restore” was that I tried to clone the productive / running openhabian installation by capturing an image of the configured environment.

@H102 @mstormi thank you for your feedback and food for thoughts.

I finally made it - it turned out that with the new SD card it seemed to be the same issue. So I tried with another SD card reader - using the micro sd card adapter that is shipped with the cards. My “old” card reader supposed to be able to write to micro sd card directly without an adapter but it turned out that the last several clones I created that way didn’t contain a bootable partition (etcher warned here, applepibaker didn’t…).

It looks like the combination of using the micro sdcard adapter with another sd card reader helped.

Thanks again for your thoughts!
Regards, Bernd (who isn’t nervous about the backup anymore :wink: )

1 Like

If that’s what you’re after, why don’t you use Amanda ? openhabian-config option 51