[Tips] Expand Partition to Full SD Card

General discussion about RuneAudio. Do not post any support or feature requests here.

[Tips] Expand Partition to Full SD Card

Postby rern » 15 Jun 2017, 11:57

[Tips] Expand Partition to Full SD Card
Tested on RuneAudio RPi3

    - RuneAudio install to 2GB partition by default.
    - This left the rest of the SD card not available for use.
    - The following script will expand the partiton to full capacity without reboot.

View code - GitHub

Expand
Code: Select all
wget -qN --show-progress https://github.com/rern/RuneAudio/raw/master/expand_partition/expand.sh; chmod +x expand.sh; ./expand.sh


For precaution:
    - Basically, it's just a friendly script for:
    echo -e 'd\n\nn\n\n\n\n\nw' | fdisk /dev/mmcblk0
    but use it at your own risk.
    - Remove any connected USB drives before running the script
    - Or the script will prompt for removal of any still-connected USB drives.
Last edited by rern on 18 Jun 2017, 15:34, edited 3 times in total.
Raspberry Pi 3 > SMSL M8 DAC
GitHub
rern
 
Posts: 64
Joined: 14 Jul 2016, 08:15

Re: [Tips] Expand Partition to Full SD Card

Postby zomtec » 17 Jun 2017, 19:41

i get

Code: Select all
[root@runeaudio ~]# wget -qN --show-progress https://github.com/rern/RuneAudio/raw/master/expand_partition/expand.sh; chmod +x expand.sh; ./expand.sh
wget: unrecognized option '--show-progress'
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.
chmod: cannot access 'expand.sh': No such file or directory
-bash: ./expand.sh: No such file or directory
zomtec
 
Posts: 4
Joined: 17 Jun 2017, 19:39

Re: [Tips] Expand Partition to Full SD Card

Postby rern » 19 Jun 2017, 02:50

1. Find the --show-progress option
Code: Select all
wget --help | grep 'show-progress'

It should show this if the option is there:
Code: Select all
#       --show-progress             display the progress bar in any verbosity mode


2. Try wget without options
Code: Select all
wget https://github.com/rern/RuneAudio/raw/master/expand_partition/expand.sh; chmod +x expand.sh; ./expand.sh
Raspberry Pi 3 > SMSL M8 DAC
GitHub
rern
 
Posts: 64
Joined: 14 Jul 2016, 08:15

Re: [Tips] Expand Partition to Full SD Card

Postby irishwill2008 » 19 Jun 2017, 08:41

Good post but runeaudio already has a published method: http://www.runeaudio.com/documentation/ ... tition-sd/
irishwill2008
 
Posts: 120
Joined: 26 Jul 2016, 14:49
Location: Ireland

Re: [Tips] Expand Partition to Full SD Card

Postby hondagx35 » 19 Jun 2017, 09:40

Hi rern,

thank you for posting this.
I would like to see this as an option on the settings page.

Frank
User avatar
hondagx35
Moderator
 
Posts: 2649
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: [Tips] Expand Partition to Full SD Card

Postby rern » 20 Jun 2017, 13:54

Hi Frank,

I've been thinking it should be done by default at the very first boot.

May be something like:
- a systemd service
- an fdisk script
- remove the service and the script

rern
Raspberry Pi 3 > SMSL M8 DAC
GitHub
rern
 
Posts: 64
Joined: 14 Jul 2016, 08:15

Re: [Tips] Expand Partition to Full SD Card

Postby rern » 23 Jun 2017, 06:08

Hi Frank,

This systemd run once method was tested successfully:
(Scripts and files in the link were included to the SD card before first boot.)

Code: Select all
# systemd startup service
### script: /etc/systemd/expand.service
ln -s /etc/systemd/expand.service /etc/systemd/system/multi-user.target.wants/expand.service

# fdisk script
### script: /root/expand.sh
chmod +x /root/expand.sh

# 'partprobe' to avoid reboot
### file: /usr/bin/partprobe
chmod +xr /usr/bin/partprobe

### file: /usr/lib/libparted.so.2.0.1
ln -s /usr/lib/libparted.so.2.0.1 /usr/lib/libparted.so.2


rern
Raspberry Pi 3 > SMSL M8 DAC
GitHub
rern
 
Posts: 64
Joined: 14 Jul 2016, 08:15

Re: [Tips] Expand Partition to Full SD Card

Postby zomtec » 24 Jun 2017, 19:24

Work it with a Raspberry Zero?

20160618_runeaudio_raspberry1_raspberryZero.img.gz
raspberry-pi-zero-support-in-0-4-t3711-70.html#p20577
zomtec
 
Posts: 4
Joined: 17 Jun 2017, 19:39

Re: [Tips] Expand Partition to Full SD Card

Postby hondagx35 » 24 Jun 2017, 22:05

Hi zomtec,

expanding the sd card works on all devices and you can use both methods
The one posted here or the one explained in the docs.

Frank
User avatar
hondagx35
Moderator
 
Posts: 2649
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: [Tips] Expand Partition to Full SD Card

Postby zomtec » 27 Jun 2017, 14:17

It do not work on a zero.

Code: Select all
[root@runeaudio ~]# wget --help | grep 'show-progress'
[root@runeaudio ~]# wget https://github.com/rern/RuneAudio/raw/master/expand_partition/expand.sh; chmod +x expand.sh; ./expand.sh
--2017-06-27 15:16:11--  https://github.com/rern/RuneAudio/raw/master/expand_partition/expand.sh
Resolving github.com (github.com)... 192.30.253.112, 192.30.253.113
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/rern/RuneAudio/master/expand_partition/expand.sh [following]
--2017-06-27 15:16:12--  https://raw.githubusercontent.com/rern/RuneAudio/master/expand_partition/expand.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.112.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.112.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2893 (2.8K) [text/plain]
Saving to: 'expand.sh'

100%[==========================================================================================================>] 2,893       --.-K/s   in 0.001s

2017-06-27 15:16:13 (2.75 MB/s) - 'expand.sh' saved [2893/2893]

./expand.sh: line 34: python2: command not found
sfdisk: invalid option -- 'F'

Usage:
 sfdisk [options] <device>...

Options:
 -s, --show-size           list size of a partition
 -c, --id                  change or print partition Id
     --change-id           change Id
     --print-id            print Id
 -l, --list                list partitions of each device
 -d, --dump                idem, but in a format suitable for later input
 -i, --increment           number cylinders etc. from 1 instead of from 0
 -u, --unit <letter>       units to be used; <letter> can be one of
                             S (sectors), C (cylinders), B (blocks), or M (MB)
 -1, --one-only            reserved option that does nothing currently
 -T, --list-types          list the known partition types
 -D, --DOS                 for DOS-compatibility: waste a little space
 -E, --DOS-extended        DOS extended partition compatibility
 -R, --re-read             make the kernel reread the partition table
 -N <number>               change only the partition with this <number>
 -n                        do not actually write to disk
 -O <file>                 save the sectors that will be overwritten to <file>
 -I <file>                 restore sectors from <file>
 -V, --verify              check that the listed partitions are reasonable
 -v, --version             display version information and exit
 -h, --help                display this help text and exit

Dangerous options:
 -f, --force               disable all consistency checking
     --no-reread           do not check whether the partition is in use
 -q, --quiet               suppress warning messages
 -L, --Linux               do not complain about things irrelevant for Linux
 -g, --show-geometry       print the kernel's idea of the geometry
 -G, --show-pt-geometry    print geometry guessed from the partition table
 -A, --activate[=<device>] activate the bootable flag
 -U, --unhide[=<device>]   set partition as unhidden
 -x, --show-extended       also list extended partitions in the output,
                             or expect descriptors for them in the input
     --leave-last          do not allocate the last cylinder
     --IBM                 same as --leave-last
     --in-order            partitions are in order
     --not-in-order        partitions are not in order
     --inside-outer        all logicals inside outermost extended
     --not-inside-outer    not all logicals inside outermost extended
     --nested              every partition is disjoint from all others
     --chained             like nested, but extended partitions may lie outside
     --onesector           partitions are mutually disjoint

Override the detected geometry using:
 -C, --cylinders <number>  set the number of cylinders to use
 -H, --heads <number>      set the number of heads to use
 -S, --sectors <number>    set the number of sectors to use

For more details see sfdisk(8).
./expand.sh: line 40: python2: command not found
./expand.sh: line 41: +  : syntax error: operand expected (error token is "+  ")
./expand.sh: line 43: ((: < 10: syntax error: operand expected (error token is "< 10")

=========================================================

    Expand partition

=========================================================

Current partiton: /dev/mmcblk0p5
Available free space  MB
Available unused disk space:  MB

Expand partiton to full unused space:
  0 Cancel
  1 Expand

0 / 1 ?
1
---------------------------------------------------------
Get package file ...
---------------------------------------------------------

wget: unrecognized option '--show-progress'
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.
loading packages...
error: 'parted-3.2-5-armv7h.pkg.tar.xz': could not find or read package
rm: cannot remove 'parted-3.2-5-armv7h.pkg.tar.xz': No such file or directory

---------------------------------------------------------
Expand partiton ...
---------------------------------------------------------

./expand.sh: line 81: partprobe: command not found
resize2fs 1.42.12 (29-Aug-2014)
The filesystem is already 434944 (4k) blocks long.  Nothing to do!

./expand.sh: line 89: python2: command not found


 i  Partiton /dev/mmcblk0p5 now has  MB free space.

---------------------------------------------------------

[root@runeaudio ~]#
zomtec
 
Posts: 4
Joined: 17 Jun 2017, 19:39

support RuneAudio Donate with PayPal

Next

Return to General discussion

Who is online

Users browsing this forum: No registered users and 0 guests