Closed synaption closed 2 years ago
If you just swap the entries for the data and upload partitions in the genimage.cfg file, you should get data at the "end" of the disk where you can extend it if desired. I don't use parted much, but based on a Google search, libparted doesn't like extended partitions that don't have unused sectors between them: http://gparted-forum.surf4.info/viewtopic.php?pid=33028#p33028 which is what I suspect is causing your problems.
I recommend using lower-level utilities, eg: sfdisk. From a br2rauc image on a 64G uSD card attached (/dev/sda) to my RPi 4 running the latest Raspberry Pi 64-bit Bullseye OS:
pi@raspberrypi:~ $ echo ", +" | sudo sfdisk /dev/sda -N 4
Checking that no-one is using this disk right now ... OK
Disk /dev/sda: 59.48 GiB, 63864569856 bytes, 124735488 sectors
Disk model: SD Transcend
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: 0x00000000
Old situation:
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 8192 532479 524288 256M c W95 FAT32 (LBA)
/dev/sda2 1056768 1581055 524288 256M 83 Linux
/dev/sda3 1581056 1843199 262144 128M 83 Linux
/dev/sda4 1843200 7372802 5529603 2.6G f W95 Ext'd (LBA)
/dev/sda5 1843201 3686400 1843200 900M 83 Linux
/dev/sda6 3686402 5529601 1843200 900M 83 Linux
/dev/sda7 5529603 7372802 1843200 900M 83 Linux
/dev/sda4:
New situation:
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 8192 532479 524288 256M c W95 FAT32 (LBA)
/dev/sda2 1056768 1581055 524288 256M 83 Linux
/dev/sda3 1581056 1843199 262144 128M 83 Linux
/dev/sda4 1843200 124735487 122892288 58.6G f W95 Ext'd (LBA)
/dev/sda5 1843201 3686400 1843200 900M 83 Linux
/dev/sda6 3686402 5529601 1843200 900M 83 Linux
/dev/sda7 5529603 7372802 1843200 900M 83 Linux
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or partx(8).
Syncing disks.
pi@raspberrypi:~ $ echo ", +" | sudo sfdisk /dev/sda -N 7
Checking that no-one is using this disk right now ... OK
Disk /dev/sda: 59.48 GiB, 63864569856 bytes, 124735488 sectors
Disk model: SD Transcend
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: 0x00000000
Old situation:
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 8192 532479 524288 256M c W95 FAT32 (LBA)
/dev/sda2 1056768 1581055 524288 256M 83 Linux
/dev/sda3 1581056 1843199 262144 128M 83 Linux
/dev/sda4 1843200 124735487 122892288 58.6G f W95 Ext'd (LBA)
/dev/sda5 1843201 3686400 1843200 900M 83 Linux
/dev/sda6 3686402 5529601 1843200 900M 83 Linux
/dev/sda7 5529603 7372802 1843200 900M 83 Linux
/dev/sda7:
New situation:
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 8192 532479 524288 256M c W95 FAT32 (LBA)
/dev/sda2 1056768 1581055 524288 256M 83 Linux
/dev/sda3 1581056 1843199 262144 128M 83 Linux
/dev/sda4 1843200 124735487 122892288 58.6G f W95 Ext'd (LBA)
/dev/sda5 1843201 3686400 1843200 900M 83 Linux
/dev/sda6 3686402 5529601 1843200 900M 83 Linux
/dev/sda7 5529603 124735487 119205885 56.8G 83 Linux
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or partx(8).
Syncing disks.
Before I upgraded to the latest version of br2rauc, I had a working script to expand the data partition to take up the rest of the disk space. The update has caused two issues so far. that data partition was moved to the middle instead of the end of the partition table. That was easy to solve by moving its location in genimage.cfg. Where I am having trouble is that an "extended" partition has been made that overlaps to the end of the partition table presumably in order to overcome the limitation of msdos partition tables to only 4 partitions. Do you have any idea how to work around this? If I simply make the data partition table bigger in genimage.cfg this will greatly increase my upload time. Below is the output of parted if that helps explain.