mount writable partition?

90 views
Skip to first unread message

John Warwick

unread,
Dec 3, 2014, 5:44:47 PM12/3/14
to nerves-...@googlegroups.com
Not sure if this is a Nerves question or a buildroot question, but is there an option or config file setting to the rel2fw script that would allow me to mount some of the additional space on my SD card as a writable filesystem?

It looks like the existing script shrinks down the root partition, but I can't quite follow if there are any other partitions created (though it looks like there are some on the card after dd'ing).

On the RaspberryPi if that makes a difference.

thanks,
john

Frank Hunleth

unread,
Dec 4, 2014, 8:12:45 AM12/4/14
to nerves-...@googlegroups.com
Hi John,

On Wed, Dec 3, 2014 at 5:44 PM, John Warwick <jwar...@gmail.com> wrote:
>
> Not sure if this is a Nerves question or a buildroot question, but is there an option or config file setting to the rel2fw script that would allow me to mount some of the additional space on my SD card as a writable filesystem?
>

You have a couple options:

1. You can remount the root filesystem read-write and then grow it
to fill the partition. I do this frequently for debugging:

mount -o remount,rw /
resize2fs /dev/mmcblk0p1

The resize2fs program is part of the e2fsprogs package which you can
enable in the buildroot configuration. In "make menuconfig", it is
under Target packages -> Filesystem and flash utilities.

2. You can format the 4th partition and then write your data to
that. That's what I normally do for saving application data since it
allows me to do a firmware update (i.e. completely replace the rootfs)
and the data is still there. Also, since I'm paranoid about filesystem
corruption, it gives me the option of reformating the whole
application data partition if I get an error that I don't understand
in the field. The unfortunate part is that while I do this frequently
with my C/C++ projects, I haven't done it with nerves yet. The script
is similar to the following:

# Mount the application partition. If mounting fails, format it and try again
if [ ! mount -t ext4 /dev/mmcblk0p4 /mnt ];
then
mke2fs -t ext4 -L appdata /dev/mmcblk0p4
mount -t ext4 /dev/mmcblk0p4 /mnt
fi

If you've looked in the fwup.conf file for the raspberry pi board in
nerves, you'll see that I allocated quite a bit of space to the 4th
partition (referred to as APP_PART_*). You could probably grow it
further if you have a big SDCard.

3. If having a writable root filesystems is no big deal for your
project, then you could configure fwup to give you a big root file
system and mount it read-write. I have an example of that for the
Beaglebone Black at https://github.com/fhunleth/bbb-buildroot-fwup.

I hope this helps. I've been stuck in C/C++ land and dying to get back
to Elixir!

Thanks,
Frank


> It looks like the existing script shrinks down the root partition, but I can't quite follow if there are any other partitions created (though it looks like there are some on the card after dd'ing).
>
> On the RaspberryPi if that makes a difference.
>
> thanks,
> john
>
> --
> You received this message because you are subscribed to the Google Groups "nerves-project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to nerves-projec...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.




--
Frank Hunleth
Troodon Software LLC
Embedded Software Development
http://troodon-software.com/

John Warwick

unread,
Dec 5, 2014, 1:45:34 PM12/5/14
to nerves-...@googlegroups.com
Thanks for the detailed response. I managed to programatically format and mount the application partition, so I think I'm on the right track now.
Appreciate the help!

thanks,
john

Reply all
Reply to author
Forward
0 new messages