[Solved] Use complete capacity of SSD

Noob warning, please bear with me.
I have installed dietpi on a NUC7PJYH with a 240GB SSD. The install went fine and Roon Server runs.
dietpi created two partitions on the SSD:

root@DietPi:~# fdisk -l
Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 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: gpt
Disk identifier: 6EDB5609-6D5F-4403-B841-B429FE75390D

Device       Start      End  Sectors  Size Type
/dev/sda1     2048  1050623  1048576  512M EFI System
/dev/sda2  1050624 60620766 59570143 28.4G Linux filesystem

Now I would like to expand /dev/sda2 to use the full capacity of the SSD. I have tried the expand disk_manager


The system rebooted, but after the reboot the partition was still 28G.
How can I expand the partition?

Can you please paste output of:

cat /var/tmp/dietpi/logs/fs_partition_resize.log

There was an issue with v6.17 fs resize service, but should not affect your device+drive.
If everything goes well on first run resize, there is no manual drive step required any more btw., so lets see what went wrong.

Thanks, Dan
here it is

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 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: gpt
Disk identifier: 6EDB5609-6D5F-4403-B841-B429FE75390D

Device       Start      End  Sectors  Size Type
/dev/sda1     2048  1050623  1048576  512M EFI System
/dev/sda2  1050624 60620766 59570143 28.4G Linux filesystem

Command (m for help): Partition number (1,2, default 2):
Partition 2 has been deleted.

Command (m for help): Partition number (2-128, default 2): Partition number (2-128, default 2): First sector (1050624-60620766, default 1050624): Last sector, +sectors or +size{K,M,G,T,P} (1050624-60620766, default 60620766):
Created a new partition 2 of type 'Linux filesystem' and of size 28.4 GiB.

Command (m for help):
Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 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: gpt
Disk identifier: 6EDB5609-6D5F-4403-B841-B429FE75390D

Device       Start      End  Sectors  Size Type
/dev/sda1     2048  1050623  1048576  512M EFI System
/dev/sda2  1050624 60620766 59570143 28.4G Linux filesystem

Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

root@RoonCoreRuscheling:~#

I tried shutdown -r now, but the partition is still at 28G

Hmm strange, fdisk somehow estimates 60,620,766 as max last sector of the partition being created. But actually the drive has 500,118,192 overall sectors, which should be the max (and default) last sector or second partition. No other partitions show up, that could block this real max value.

Can you validate: parted /dev/sda -ms unit s p showing only the two partitions and 500,118,192 overall sectors?
Perhaps the disk is somehow broken or flash went somehow wrong. Do you have a Linux system, where you can do a fsck of the SSD?

Btw. not Dan here :wink:, but maybe he has some idea how such a situation can occur Fourdee?

Aha, there seems to be something off

root@RoonCoreRuscheling:~# parted /dev/sda -ms unit s p
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 439497392 blocks) or continue with the current setting?
BYT;
/dev/sda:500118192s:scsi:512:512:gpt:ATA MTFDDAK256MAM-1K:;
1:2048s:1050623s:1048576s:fat32::boot, esp;
2:1050624s:60620766s:59570143s:ext4::;
root@RoonCoreRuscheling:~#

MichaIng Got it resolved, thanks:

parted -l
then fix
then run fs resizer

root@RoonCoreRuscheling:~# fdisk -l
Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 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: gpt
Disk identifier: 6EDB5609-6D5F-4403-B841-B429FE75390D

Device       Start       End   Sectors  Size Type
/dev/sda1     2048   1050623   1048576  512M EFI System
/dev/sda2  1050624 500118158 499067535  238G Linux filesystem

Great.

Saw already above that you used a GPT partition. Perhaps fdisk does not use the maximum sectors in this case as default upper value. Did you manually enter the overall sector size when doing fdisk partitioning?

No, I simply ran parted -l and then I was given a choice whether I wanted to fix the GPT issue or continue.
I answered yes and then ran the resizer again.

Ah okay, whatever the issue was or maybe simply fdisk does not reliably work on GPT, while parted does the job then.

At least worth some testing. However thank for reporting back.

We switched the method for v6.18 to auto detect GPT and maximum sectors. Will hopefully work more reliable.

I’ve just created this account to tell that I had a similar issue and the following did work for me too:
parted -l
then fix
then run fs resizer

Tks :slight_smile:

I almost did a new install :roll_eyes: