OpenWrt Forum Archive

Topic: Extend filesystem on RPI2

The content of this topic has been archived on 7 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi everyone,

I have a 8GB SD card installed and have loaded the latest RPI2B .img on it successfully.

However, I noticed that I only have 33MB free so I presume that I need to extend the filesystem.

I found this but don't quite know how to use it. I put the code into a file on the root (ssh'd in), made it executable and and then ran it but it just hangs, forcing me to control+c out of it.

https://github.com/rpi-openwrt/rpi-extendfs

Please can someone guide me in the right direction, keeping in mind that I am still in the learning phase wink

Thanks!

EDIT: ls /dev/ | grep mmc results in these being found, my understanding is that this is two partitions on the SD card.

mmcblk0
mmcblk0p1
mmcblk0p2

I think that extending the root (p1?) will do the job for me.

(Last edited by mulletman87 on 12 Feb 2016, 09:10)

mmcblk0p1 = is your "W95 FAT32 (LBA)" bootpatition with vfat Filesystem.
        it contain the bootloader, firmware, kernel and config.
mmcblk0p2 = is your "Linux" System Partitions (most choice ext4).
        it contein your rootfs



a better choice is to install openwrt manuell:
(I assume you use Linux on your PC, and the sd-card is in a adapter so the resulting device is /dev/sdb)

0.) Carry yourself with the special features of flash memory Familiar.
  (sorry i self have this not really understand)
  After parting, use this command:

parted /dev/sdb align-check opt
1
2
..

  the result should be: (aligned)

 
 
1.) Format your SD-Card
  be sure that the device what are you formating is the sdcard
  use:

fdisk -c -u /dev/sdb
(delete all partions with 'd')
n    (make a new partion)
1    (partion 1)
p    (primary)
(accept the default value normally 2048)
+64M    (it mean +64MB to the start value / choice a value beetween 32-64MB divisible by 4MB)
t    (choice filesystem)
1    (on partition 1)
c    (W95 FAT32 (LBA))
a    (add bootflag (no idea if i reale need this))
1
n
2
p
(accept the default value)
(accept the default value (or enter +[YourValue]M  valueshould  divisible by 4MB))
w    (write all your choices to /dev/sdb    (be sure your sdcard is /dev/sdb))

  and at the end:

partprobe

end make a align check see 0.



2.) make the FS

mkfs.vfat /dev/sdb1
mkfs.ext4 -b 4096 -E stride=2,stripe-width=512 /dev/sdb2

(mkfs.ext4 /dev/sdb2 work too, but with parameter should be better for flash memory)

partprobe
and mount your partitions



3.) mount the Image and copy the data
  download the openwrt-15.05-brcm2708-bcm2709-sdcard-vfat-ext4.img image

fdisk -l openwrt-15.05-brcm2708-bcm2709-sdcard-vfat-ext4.img

  remember the start values (8192 for p1 / 57344 for p2)
  and run:

mkdir -p /mnt/owrtimg/p1
mount -t vfat -o loop,offset=$(($8192 * 512)) openwrt-15.05-brcm2708-bcm2709-sdcard-vfat-ext4.img /mnt/owrtimg/p1
mkdir -p /mnt/owrtimg/p2
mount -t ext4 -o loop,offset=$(($57344 * 512)) openwrt-15.05-brcm2708-bcm2709-sdcard-vfat-ext4.img /mnt/owrtimg/p2

  copy the data from /mnt/owrtimg/p1 to your first partition on sdcard
  copy the data from /mnt/owrtimg/p2 to your second partition on sdcard.

 
 
Better them as the original image is your own hardfloat builded image.
see this thread

Hi Plonk34, thanks so much for the detailed response, I appreciate your time.

I understand the steps, I will give them a whirl this week.

Quick one, I did some research myself but could you briefly explain why I would opt to build a hardfloat version instead of using the default softfloat? Is there a performance boost, perhaps less chance of corruption of the SD card?

Thanks!

I would opt to build a hardfloat version instead of using the default softfloat? Is there a performance boost, perhaps less chance of corruption of the SD card?

good question hardfloat mean it support the hardware floating point arithmetrik on the CPU, and it should give a performance boost.
But no idea how will shows it.
No idea what are the advantages of softfloat (does they exist?) and why openwrt are softfloat.

I am thankfull too for a answer.

It has nothing to do with the corruption of the SD card.

The discussion might have continued from here.