Creating New Partition on SDCARD for LocalStorage

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

Creating New Partition on SDCARD for LocalStorage

Postby rune_tinker » 10 Sep 2020, 03:00

I'm new to this forum, but long post. :D

Just got into this wonderful ecosystem, and finally got my Raspberry Pi2b streamer up, after exploring and failing with other software. Many thanks to the founders and developers who have crafted this beautiful piece of software.

Wanted to share my experience in creating an ext4 partition for local storage, on 32GB SDCARD for my library of flac music files. I will be looking to repeat the process for Pi 4 (which I intend to order). Just wanted to document
here the creation and mounting of the new ext4 partition. In a follow up post, I will write (haven't started yet) on how to sftp files into the local storage folder.

Please kindly let me know in case I may miss any important step in this process.


Steps:
---------
1. Determine from Rune_UI what the ip address is.
http://runeaudio.local
Then click on Menu | Network
The ip addresses (192.168.x.yy) show up as either on Wlan0 (if connected on wifi) or ETH0 (on Lan)

2. ssh and login as root to Raspberry Pi2 (password is in the DOCS).
Code: Select all
> ssh root@192.168.x.yy


3. To see the existing partitions on your SDCARD, type
Code: Select all
[root@runeaudio ~]# fdisk -l


Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 2048 206847 204800 100M c W95 FAT32 (LBA)
/dev/mmcblk0p2 206848 4401151 4194304 2G 83 Linux

As you can see, the OS takes only about 2GB, leaving the rest of the 32GB SDCARD 'free'.

4. Type fdisk /dev/mmcblk0 to start the creation of a new partition.
/dev/mmcblk0 is basically your SDCARD in the Raspberry Pi.

Code: Select all
[root@runeaudio ~]# fdisk /dev/mmcblk0

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

Command (m for help):
1. Press "p" in case you want to show the current partitions and note down the details of the main one that
RuneOS is on. We have done it previously so we already know we have /dev/mmcblk0p1 & /dev/mmcblk0p2.
2. Press "n" to make a new partition,
and "p" to select a primary partition. It should also prompt you that the new partition should be 3.
I have also used the default start block provided - since that is the start of the free space on the SDCARD. And the
default end block (the last block available on the SDCARD). So my 3rd partition will just use the last remaining
space on the SDCARD.
3. Press "t" and enter the value "83" to mark it as a Linux partition.
4. Press "w" to write changes and exit. You may have to reboot after this for changes to be registered. If you
miss this step, the changes are not permanent and you may have to repeat steps 4.1 to 4.4 above. (On the
other hand, if you want to exit without making changes, use the command "q".)

If all goes well, you will have the following partitions ( use the "p" command to list the partitions) :

Code: Select all
Command (m for help): p

Disk /dev/mmcblk0: 29.8 GiB, 32010928128 bytes, 62521344 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: dos
Disk identifier: 0x00005f47

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 2048 206847 204800 100M c W95 FAT32 (LBA)
/dev/mmcblk0p2 206848 4401151 4194304 2G 83 Linux
/dev/mmcblk0p3 4401152 62521343 58120192 27.7G 83 Linux

NB: This has created the partition, but not yet the filesystem. Need to use mkfs next to format this new partition.

5. Format the new partition
Code: Select all
mkfs.ext4 /dev/mmcblk0p3


6. Mount the new partition to /mnt/MPD/LocalStorage

7. Change owner and group to mpd, and audio respectively so that Runeaudio can access the new partition

8. Go to Rune_UI to rebuild the MPD Sources and check that the shows up.
Menu | Sources| Rebuild MPD Library
Then click on the Library tab at the bottom of Rune_UI. There should be a new icon for LocalStorage - locally
stored music.

9. Edit the /etc/fstab file to make permanent changes to LocalStorage. Otherwise LocalStorage may not show up again on a reboot.
Code: Select all
[root@runeaudio ~]# nano /etc/fstab   

Add the line as below, and ^O to write the changes to the file (^X to exit) :
/dev/mmcblk0p3 /mnt/MPD/LocalStorage ext4 noatime,rw 0 0

The resulting file should look like:

#
# /etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
/dev/mmcblk0p1 /boot vfat defaults 0 0
/dev/mmcblk0p3 /mnt/MPD/LocalStorage ext4 noatime,rw 0 0
logs /var/log tmpfs nodev,nosuid,noatime,mode=1777,size=5M 0 0
rune-logs /var/log/runeaudio tmpfs nodev,nosuid,noatime,mode=1777,size=5M 0 0

10. Reboot the device and go to the Rune_UI to check of the LocalStorage shows up again.

In a future post, I plan to share how to add user "mpd" with group "audio", and how to sftp music files to this
folder on the SDCARD. Please feel free to let me know if these steps help, or if there are anything unclear.

Cheers!
rune_tinker
 
Posts: 2
Joined: 10 Sep 2020, 01:11

Re: Creating New Partition on SDCARD for LocalStorage

Postby ceejayemm » 10 Sep 2020, 20:55

Rune_Tinker

You have obviously put a lot of effort into this 'How To', thanks for your efforts. I wonder, however, if you would have been better using a smaller capacity SD Card for the RA system and putting your music on a USB flash drive, powered hard drive or network device. The reason being that if (when ?) you have to reflash the SD card you will potentially loose your music in the new partition. Newer versions of RA will expand the file system automatically to use the whole SD card. I would really suggest that you DONT put your music on the SD Card and consider a USB drive of some sort or use a network device to hold your music. It will also be easier to transfer music to such a device in the long run.

Regards.

Chris
ceejayemm
 
Posts: 131
Joined: 29 Oct 2016, 18:13

Re: Creating New Partition on SDCARD for LocalStorage

Postby rune_tinker » 13 Sep 2020, 05:29

Thanks Chris.

Good point. It didn't occur to me that future OS versions might need more than 2GB. :D
So I might need to resize the card again.

I had started with plugging in a USB memory card with my music files. But as it was quite wide, and blocked another USB Port on the Pi (those ports are spaced so close to each other), I thought of using the onboard SDcard instead.

Good suggestion !
rune_tinker
 
Posts: 2
Joined: 10 Sep 2020, 01:11

Re: Creating New Partition on SDCARD for LocalStorage

Postby BettyHatch » 14 Sep 2020, 11:02

rune_tinker wrote:Thanks Chris.

Good point. It didn't occur to me that future OS versions might need more than 2GB. :D
So I might need to resize the card again.
I had started with plugging in a USB memory card with my music files. But as it was quite wide, and blocked another USB Port on the Pi (those ports are spaced so close to each other), I thought of using the onboard SDcard instead.
texttospeech.onl
Good suggestion !

Yeah you are right there, future OS versions will definitely need more space than 2 GB.
BettyHatch
 
Posts: 1
Joined: 14 Sep 2020, 10:57
Location: San Francisco

support RuneAudio Donate with PayPal


Return to General discussion

Who is online

Users browsing this forum: No registered users and 0 guests