From 610613d7b3f9fc175448863a462e5cec8c0fecfc Mon Sep 17 00:00:00 2001 From: cimryan Date: Mon, 15 Oct 2018 07:20:44 -0700 Subject: [PATCH] Update the partition Ids in /etc/fstab and /boot/cmdline.txt after modifying partitions with parted Parted changes the disk Ids, rendering the Pi unbootable without this step. --- windows_archive/create-backingfiles-partition.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/windows_archive/create-backingfiles-partition.sh b/windows_archive/create-backingfiles-partition.sh index 0fa45c8..e8b7013 100644 --- a/windows_archive/create-backingfiles-partition.sh +++ b/windows_archive/create-backingfiles-partition.sh @@ -8,8 +8,15 @@ LAST_ROOT_PARTITION_SECTOR=$(echo "$ROOT_PARTITION_LINE" | sed 's/s//g' | cut -d FIRST_BACKINGFILES_PARTITION_SECTOR=$(( $LAST_ROOT_PARTITION_SECTOR + 1 )) +ORIGINAL_DISK_IDENTIFIER=$( fdisk -l /dev/mmcblk0 | grep -e "^Disk identifier" | sed "s/Disk identifier: 0x//" ) + parted -m /dev/mmcblk0 u s mkpart primary ext4 "$FIRST_BACKINGFILES_PARTITION_SECTOR" 100% +NEW_DISK_IDENTIFIER=$( fdisk -l /dev/mmcblk0 | grep -e "^Disk identifier" | sed "s/Disk identifier: 0x//" ) + +sed -i "s/${ORIGINAL_DISK_IDENTIFIER}/${NEW_DISK_IDENTIFIER}/g" /etc/fstab +sed -i "s/${ORIGINAL_DISK_IDENTIFIER}/${NEW_DISK_IDENTIFIER}/" /boot/cmdline.txt + mkfs.ext4 -F /dev/mmcblk0p3 echo "/dev/mmcblk0p3 $BACKINGFILES_MOUNTPOINT ext4 auto,rw,noatime 0 2" >> /etc/fstab