1

I have a Linux system with a storage device containing multiple partitions. Specifically, the device (/dev/sdX) has three partitions (sda1, sda2, and sda3). The third partition (sda3) is intended for user data (/data) and currently has a fixed size of 10GB. I'd like to implement an automatic partition resizing mechanism during the system boot to utilize any remaining unallocated space on the device.

The current partition layout, as seen in lsblk, is as follows:

NAME      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
...
sda       8:0    0  59.7G  0 disk
|-sda1    8:1    0     2G  0 part
|-sda2    8:2    0     2G  0 part /
`-sda3    8:3    0    10G  0 part /data
...

The /etc/fstab entry for /dev/sda3 is configured to use a mechanism (e.g., x-systemd.growfs) for automatic resizing:

/dev/sda3       /data                ext4       defaults,x-systemd.growfs              0  3

However, the automatic resizing during boot seems to be encountering issues. The system logs indicate an attempt to resize the filesystem from a certain number of blocks to the same number, suggesting it's not detecting additional unallocated space.

I've come across information about tools or mechanisms that could facilitate automatic partition resizing during boot. How can I properly configure and implement such a mechanism to ensure that /dev/sda3 automatically utilizes any available unallocated space on /dev/sda during the boot process?

Are there any general steps or considerations I should be aware of when implementing automatic partition resizing in this context?

Note: my Linux is -> Linux my-device 5.11.5-rt11 #1 SMP PREEMPT_RT Tue Mar 9 10:21:23 UTC 2021 aarch64 GNU/Linux

I don't have GUI or any fancy tools, I build my linux using yocto

Thank you for your assistance!

9
  • in the context of systemd maybe repart would work, see github.com/systemd/systemd/issues/14052 freedesktop.org/software/systemd/man/latest/… Commented Nov 18, 2023 at 21:15
  • @frostschutz repart is not supported in my system... Commented Nov 20, 2023 at 10:38
  • @don_crissti gdisk is not supported in my system Commented Nov 20, 2023 at 10:38
  • 1
    @AravindEkan then parted /dev/sda resizepart 3 100% and another reboot? (you can use any other partitioner instead of parted, just make sure the start sector of the partition doesn't change) Commented Nov 20, 2023 at 10:47
  • # lsblk -p -o NAME,PTTYPE,PARTTYPE NAME PTTYPE PARTTYPE /dev/loop0 /dev/loop1 /dev/loop2 /dev/loop3 /dev/mtdblock0 /dev/mtdblock1 /dev/mtdblock2 /dev/mtdblock3 /dev/mtdblock4 /dev/mtdblock5 /dev/mtdblock6 /dev/mtdblock7 /dev/mtdblock8 /dev/mtdblock9 /dev/sda dos |-/dev/sda1 0x83 |-/dev/sda2 0x83 `-/dev/sda3 0x83 Commented Nov 20, 2023 at 16:02

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.