Another way to modify the space size of second partition: using tool "fdisk" to resize the partition, below are the example steps.
~$ sudo fdisk -l /dev/sdc
Disk /dev/sdc: 7.4 GiB, 7948206080 bytes, 15523840 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: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 131072 655359 524288 256M c W95 FAT32 (LBA)
/dev/sdc2
655360
1703935 1048576 512M 83 Linux
# Notice: we need this start sectors "655360" of second partition when create new partition.#
~$ sudo fdisk /dev/sdc
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Partition number (1,2, default 2):
Partition 2 has been deleted.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (2-4, default 2):
First sector (2048-15523839, default 2048):
655360
Last sector, +sectors or +size{K,M,G,T,P} (655360-15523839, default 15523839):
Created a new partition 2 of type 'Linux' and of size 7.1 GiB.
Partition #2 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: n
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
~$ sudo fsck.ext4 /dev/sdc2
e2fsck 1.44.1 (24-Mar-2018)
/dev/sdc2: clean, 3493/32768 files, 26617/131072 blocks
~$ sudo resize2fs /dev/sdc2
resize2fs 1.44.1 (24-Mar-2018)
Resizing the filesystem on /dev/sdc2 to 1858560 (4k) blocks.
The filesystem on /dev/sdc2 is now 1858560 (4k) blocks long.
~$ sudo fdisk -l /dev/sdc
Disk /dev/sdc: 7.4 GiB, 7948206080 bytes, 15523840 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: 0x00000000
NXP Semiconductors
Introduction
Open Industrial User Guide, Rev. 1.8, 05/2020
User's Guide
13 / 199