[Solved] Use complete capacity of SSD

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
jacobacci
Posts: 22
Joined: Tue Sep 04, 2018 10:38 am

[Solved] Use complete capacity of SSD

Post by jacobacci »

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:

Code: Select all

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
Screen.png
The system rebooted, but after the reboot the partition was still 28G.
How can I expand the partition?
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Use complete capacity of SSD

Post by MichaIng »

Can you please paste output of:

Code: Select all

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.
jacobacci
Posts: 22
Joined: Tue Sep 04, 2018 10:38 am

Re: Use complete capacity of SSD

Post by jacobacci »

Thanks, Dan
here it is

Code: Select all

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
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Use complete capacity of SSD

Post by MichaIng »

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 ;), but maybe he has some idea how such a situation can occur @Fourdee?
jacobacci
Posts: 22
Joined: Tue Sep 04, 2018 10:38 am

Re: Use complete capacity of SSD

Post by jacobacci »

Aha, there seems to be something off

Code: Select all

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:~#
jacobacci
Posts: 22
Joined: Tue Sep 04, 2018 10:38 am

Re: Use complete capacity of SSD

Post by jacobacci »

@MichaIng Got it resolved, thanks:

parted -l
then fix
then run fs resizer

Code: Select all

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
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Use complete capacity of SSD

Post by MichaIng »

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?
jacobacci
Posts: 22
Joined: Tue Sep 04, 2018 10:38 am

Re: Use complete capacity of SSD

Post by jacobacci »

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.
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Use complete capacity of SSD

Post by MichaIng »

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.
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: [Solved] Use complete capacity of SSD

Post by MichaIng »

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