-
Notifications
You must be signed in to change notification settings - Fork 27
Home
Background to making a raspberry pi reset tool.
A common technique for providing for rescue of filesystem or OS level issues is to provide an alternative bootable partition, which can be used to repair a failed (or otherwise messed up) situation. For example my Dell laptop has a rescue partition which can be used to restore the laptop to a factory state. This sort of thing inspired me to come up with a similar technique for resetting a raspberry pi.
The default Pi OS image looks like the following:
$ sfdisk -g -l ./sources/2021-05-07-raspios-buster-armhf.img
Disk ./sources/2021-05-07-raspios-buster-armhf.img: 3.71 GiB, 3980394496 bytes, 7774208 sectors
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: 0xf4481065
Device Boot Start End Sectors Size Id Type
./sources/2021-05-07-raspios-buster-armhf.img1 8192 532479 524288 256M c W95 FAT32 (LBA)
./sources/2021-05-07-raspios-buster-armhf.img2 532480 7774207 7241728 3.5G 83 Linux
This is a disk image with 2 partitions. The first is a vfat partition which gets mounted on /boot
and a bigger ext4 filesystem which gets mounted on /
the initial attempt at this works for the simple case, but if you actually want to use all the empty space, its not a good solution