PINE64
terminal command for sd card size - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: PinePhone Software (https://forum.pine64.org/forumdisplay.php?fid=121)
+---- Forum: PostmarketOS on PinePhone (https://forum.pine64.org/forumdisplay.php?fid=124)
+---- Thread: terminal command for sd card size (/showthread.php?tid=9249)



terminal command for sd card size - pnphn - 02-22-2020

so i'm not super techy and i've postmarketos on a 32gb sd card

but it seems like i have the image allocated only to a partition of the sd

i tried so many commands (that i found on the internet) but i keep getting lack of storage space messages.

does anyone know the right command that wil work in the terminal of pmos?

i can recall i did something like resize2fs one for my retro single board computer

but that doesn't seem to work eather. i really want this fixes so i could clone some repos to my phone.

thanks!


RE: terminal command for sd card size - PureTryOut - 02-22-2020

Honestly I recommend just building your own image using pmbootstrap. When installing to the sdcard with it's "--sdcard" argument, it already will take up all the available space on the sdcard.


RE: terminal command for sd card size - Danny - 03-03-2020

I'm looking for the same thing.

I have no computer, replaced it with a smartphone over a decade ago, even then it was Win95,98,XP followed by about six months of Ubuntu and thanks to Synaptic Package Manager, I only used the terminal maybe half a dozen times. A record I beat with the Pinephone simply by turning it off ($ sudo poweroff) as I can't find any other way.

I thought I found the solution with parted ($ sudo parted) I think it came preinstalled, unless it was installed as a dependency by something else I installed. I'm assuming these operations need administrator privileges.
In parted I tried the print command which revealed partition 2 was what I probably wanted to resize.
Then I used the resizepart command and then entered 2.

It then prompted me for an end size, with the current size in brackets, something like [1120MB] I entered 14GB
Then I entered the print command again, which revealed the resized partition.

I tried again, but entered 200GB (it's a 256GB sdcard) which failed. Disk /dev/mmcblk2 evidently is the 16GB emmc storage.

I assume the command: select /dev/mmcblk? would get me on the right track, what is the microsdcard labelled as in postmarketos on a Pinephone?


RE: terminal command for sd card size - dukla2000 - 03-03-2020

(03-03-2020, 08:27 AM)Danny Wrote: I'm looking for the same thing.

I have no computer, replaced it with a smartphone over a decade ago, even then it was Win95,98,XP followed by about six months of Ubuntu and thanks to Synaptic Package Manager, I only used the terminal maybe half a dozen times. A record I beat with the Pinephone simply by turning it off ($ sudo poweroff) as I can't find any other way.

I thought I found the solution with parted ($ sudo parted)  I think it came preinstalled, unless it was installed as a dependency by something else I installed. I'm assuming these operations need administrator privileges.
In parted I tried the print command which revealed partition 2 was what I probably wanted to resize.
Then I used the resizepart command and then entered 2.

It then prompted me for an end size, with the current size in brackets, something like [1120MB] I entered 14GB
Then I entered the print command again, which revealed the resized partition.

I tried again, but entered 200GB (it's a 256GB sdcard) which failed. Disk /dev/mmcblk2 evidently is the 16GB emmc storage.

I assume the command: select /dev/mmcblk? would get me on the right track, what is the microsdcard labelled as in postmarketos on a Pinephone?

IIRC the SDcard is /dev/mmcblk0 - try lsblk command which will show what you have.

In parted 100% as the end sector should fill the disk.

Overall trying to re-size the disk you (or more particularly I think pnphn) are running from is way beyond my skills as I think you need to have it unmounted during the resize, which is tricky if it is your root partition. Although, Linux being what it is, I think in fact it can be done with some extreme sleight of hand. Of course booting from SDcard and installing to eMMC and then re-sizing eMMC before you boot from it is fine.


RE: terminal command for sd card size - Danny - 03-04-2020

(03-03-2020, 10:59 AM)dukla2000 Wrote:
(03-03-2020, 08:27 AM)Danny Wrote: I'm looking for the same thing.

I have no computer, replaced it with a smartphone over a decade ago, even then it was Win95,98,XP followed by about six months of Ubuntu and thanks to Synaptic Package Manager, I only used the terminal maybe half a dozen times. A record I beat with the Pinephone simply by turning it off ($ sudo poweroff) as I can't find any other way.

I thought I found the solution with parted ($ sudo parted)  I think it came preinstalled, unless it was installed as a dependency by something else I installed. I'm assuming these operations need administrator privileges.
In parted I tried the print command which revealed partition 2 was what I probably wanted to resize.
Then I used the resizepart command and then entered 2.

It then prompted me for an end size, with the current size in brackets, something like [1120MB] I entered 14GB
Then I entered the print command again, which revealed the resized partition.

I tried again, but entered 200GB (it's a 256GB sdcard) which failed. Disk /dev/mmcblk2 evidently is the 16GB emmc storage.

I assume the command: select /dev/mmcblk? would get me on the right track, what is the microsdcard labelled as in postmarketos on a Pinephone?

IIRC the SDcard is /dev/mmcblk0 - try lsblk command which will show what you have.

In parted 100% as the end sector should fill the disk.

Overall trying to re-size the disk you (or more particularly I think pnphn) are running from is way beyond my skills as I think you need to have it unmounted during the resize, which is tricky if it is your root partition. Although, Linux being what it is, I think in fact it can be done with some extreme sleight of hand. Of course booting from SDcard and installing to eMMC and then re-sizing eMMC before you boot from it is fine.

After my children came home from school and I had safely stowed away my Pinephone, I thought I should have tried mmcblk0 (I tried mmcblk1)! 

Well I made some notes (with some detail omitted) as I was proceeding, so I could paste them in here, hopefully it'll useful.

pine64-pinephone:~$ lsblk

mmcblk2 emmc
mmcblk0 microsdcard 
238.3G disk
p1 67M part /boot
p2 2G    part /

pine64-pinephone:~$ sudo parted

[sudo] password for demo: 147147

(parted) select /dev/mmcblk0
(parted) print
disk 256GB
p1 70.3MB boot
p2 2119MB

(parted) resizepart
partition number? 2

warning p2 being used, sure? 
Yes/No? Yes
End [2190MB]? 220GB (I used that instead of 100%, just so I have some spare, for adding things like a swap partition later on)

(parted) print
 disk 256GB
p1 70.3MB
p2 220GB

(parted) quit

Information: you may need to update /etc/fstab.
 
pine64-pinephone:~$ lsblk

mmcblk0p1 67M      part /boot
mmcblk0p2 204.8G part /

pine64-pinephone:~$ resize2fs /dev/mmcblk0p2

A message about mounting and resizing appears, just wait and wait a little more...

pine64-pinephone:~$ sudo reboot

only way I could think about checking whether I was successful was to try installing an application I had failed to install earlier. 

pine64-pinephone:~$ sudo apk add qemu-img qemu-system-aarch64

OK: 1917 MiB in 571 packages
pine64-pinephone:~$ 

Success, I can carry on playing now.

I think in my hesitation at the warning in parted, before I went for it anyway, I saw someone mentioned growing a partition on the UB Ports distro, I don't know whether there might be an alternative to this method, assuming it uses a utility in the Alpine linux repositories.

Thankyou very much for your help.


RE: terminal command for sd card size - someGermanGuy - 04-02-2020

to verify it worked you can use "df", e.g. "df -h"
if parted is not the tool of your choice, you can also use fdisk
just delete the partition, create a new one with the same starting cylinder and answer "no" when it asks "remove the filesystem information"