Long story short, I need to perform this all automatically on boot (embedded system).
Our engineers will flash images to production devices. These images will contain a small partition table. On boot, I need to automatically expand the last partition (#3) to use all the available space on the disk.
Here is what I get when I look at the free space on my disk.
> parted /dev/sda print free
Model: Lexar JumpDrive (scsi)
Disk /dev/sda: 32.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
17.4kB 1049kB 1031kB Free Space
1 1049kB 25.3MB 24.2MB fat16 primary legacy_boot
25.3MB 26.2MB 922kB Free Space
2 26.2MB 475MB 449MB ext4 primary
3 475MB 1549MB 1074MB ext4 primary
1549MB 32.0GB 30.5GB Free Space
I need to expand partition 3 by N (30.5GB) number of bytes
How do I perform this step automatically, with no prompt? This needs to work with a dynamic size of space available after the 3rd partition.
resizepart
command, and it works, but it requires an exact size. I need it to be dynamic. – Paul Knopf Jun 23 '17 at 20:28resize2fs
might be what I am looking for. https://linux.die.net/man/8/resize2fs – Paul Knopf Jun 23 '17 at 20:29