Hi,
I've finally found some time to look into this issue and managed to move the filesystem back to the second partition on my SD card. Below is a short description of what I've done. I'm definitely not an expert, so some of the steps below might not be required
.
BTW, these steps aren''t specific to Openhabian. These should work with Raspbian (at least some versions of Raspbian) without any modifications.
DISCLAIMER:
- Use at your own risk!
- These were tested against a fairly new Openhabian distribution (based on Raspbian Buster). Not sure how partitions are organized in the latest versions of Raspberry Pi OS. For sure in older version of Raspbian (those published before mid 2017) they were organized differently than in Buster. You should examine the contents of /opt/<my distribution name>/functions/ext-storage.bash before you start.
- These steps only show the happy path - when second partition on SD card is still there and partion uuid is properly set in /boot/cmdline.txt.sdcard.
1) Check if second partiton on your SD card is still there and remove its contents.
Code: Select all
sudo mount /dev/mmcblk0p2 /whatever
cd /whatever
rm -rf *
sudo umount /whatever
2) Make sure partition UUIDs match
a)
should print something like this:
Code: Select all
/dev/mmcblk0p2: LABEL="rootfs" UUID="8d008fde-f12a-47f7-8519-197ea707d3d4" VERSION="1.0" TYPE="ext4" USAGE="filesystem" PART_ENTRY_SCHEME="dos" PART_ENTRY_UUID="04c099f8-02" PART_ENTRY_TYPE="0x83" PART_ENTRY_NUMBER="2" PART_ENTRY_OFFSET="540672" PART_ENTRY_SIZE="30575616" PART_ENTRY_DISK="179:0"
b)
should print a command with some PARTUUID, e.g. "PARTUUID=04c099f8-02"
Make sure PARTUUID from the latter matches PART_ENTRY_UUID from the former.
3) May the God of your choice bless you ...
This one is Openhabian-specific:
These should be ok to be run against both Raspbian & Openhabian:
Code: Select all
sudo mount /dev/mmcblk0p2 /mnt
sudo rsync -aAXH --info=progress2 --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/boot/*"} / /mnt
sudo cp /boot/cmdline.txt.sdcard /boot/cmdline.txt
sudo reboot
... and pray ...