• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Use larger SD-Card with original Hilscher-Image
Hello everyone,

since Revision #2 it is possible to change the micro-sd-card of the netPi. Therefore it is possible to use larger micro-sd-cards as the original 8GB-one. Since I like the original Hilscher-Image with its security features quite a lot, I would not want to miss it on a larger sd-card.

Therefore I have backuped the original Image with win32-Disk-Imager, which worked well. I was also able to flash this image to the new card using balenaEtcher. When I inserted the new card into the netPi, everything worked well. The only problem is that I forgot to extend the filesystem/logical Volume on the new card to be able to use the additional space. So my 16 GB-card still worked like a 8 GB-one. After googeling, try and error, I actually managed to extend the Logical Volume which is used by the netPi for storing our data, with the underlying volume group and physical volume. After that I was able to use the complete 16-GBs of the new card on this netPi.

I thought "hey, now I know what to do" and wrote a quick manual of how to do the extension. Trying this at the second netPi, I wasn't able to do it again. After hours of trying, I surrendered and found a kind of a "hack" which helped me out. I flashed the Image of netPi(1), which I was able to sucessfully extend to 16GBs, to the netPi(2). After that of course the netPi(2) did not boot, since the Hardware-ID of the netPi did not match the hardware-ID written to the image by Hilscher. But I managed to change the hardware-ID wirtten to the Image by coping one Partition of the original netPi(2)'s Image to the 16-GB Image of netPI(1). Now I am able to reproduce 16GB netPi Images, but as you might guess, I can't handle e.g. 32GB cards now  Blush

To cut a long story short.....Would anyone who is trying to do the same/has done the same and is more into filesystems and logical volumes than me be willing to share his way of doing it with me (and everyone else) in form of a quick manual? Or would one of the Support-Team be that kind? Rolleyes 

Thanks in advance,
Well Andi,

the SD card image of netPI consists of 3 partitions:

Partition 1 : Filesystem FAT32 , name RESC
Partition 2 : Filesystem FAT32, name BOOT
Partition 3 : Filesystem lvm2, noname, containing two logical volumes named SYSTEM and BACKUP, both ext4 formatted.

What is quite easy in the first instance is to extend the size of the Partition 3 from 6GB to 32GB easily and is what you might have successfully done already. For this you probably used for example a partition tool like"gparted" under Linux and was a thing of a minute. But this is not enough because the logical volume SYSTEM - responsible for netPI's usable flash memory - within Partition 3 was not changed in its size during this procedure.
In order to change the size of the SYSTEM volume you need help of a Linux system like Ubuntu with the LVM file system support using the command

apt-get install lvm2

After that call

vgdisplay -v

just to display all the found LVM volumes. One of the listed volumes will be:

--- Logical volume ---
 LV Path                /dev/rootfs/SYSTEM
 LV Name                SYSTEM
 VG Name                rootfs
 LV UUID                HmnD5O-wBzR-PME6-LxZV-gbMM-ucQW-MaCWuA
 LV Write Access        read/write
 LV Creation host, time (none), 2019-03-27 15:54:47 +0100
 LV Status              available
 # open                 0
 LV Size                <6,19 GiB
 Current LE             2096
 Segments               1
 Allocation             inherit
 Read ahead sectors     auto
 - currently set to     256
 Block device           253:0

After that you know the name of the volumes. Then continue with a command like the following to add +1Gbyte (or more) memory to this volume

lvresize -L +1G -n -f --resizefs rootfs/SYSTEM

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

Hello Andi,

I had the opinion that my described way works ... but I have to admit it didn't.

I need to investigate further.

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

Meanwhile I found out why the command

lvresize -L +1G -n -f --resizefs rootfs/SYSTEM

did not work as expected.

Physically the LVM volume BACKUP is directly following the SYSTEM volume. If you now resize the SYSTEM volume with the command above then the original SYSTEM volume remains as it is and at its place - cause there is no immediate space left due to followin BACKUP - and a second socalled "segment" for SYSTEM is created behind the BACKUP volume. So SYSTEM is split in two segments and this cannot be resolved by netPI.

The trick is now to delete the BACKUP volume first and then resize the SYSTEM volume. Volume BACKUP is of no relevance for netPI so you can delete it without remorse. So call first
lvremove /dev/rootfs/BACKUP

Make sure you have not called resizing before, so take a fresh copy of your image. Once a second segment during resizing was created the procedure will not work.

Now call

lvresize -L +1G -n -f --resizefs rootfs/SYSTEM

with any size (1G = example) you want.

If you want to create the BACKUP volume afterwards too call

lvcreate -L 372M -n BACKUP rootfs

and you are fine.

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to unpack netPI to replace the microSD card tad 2 101 September-2nd-2020, 05:47 AM
Last Post: tad
Wink SD card on NIOT-E-NPI3-51-EN-RE Lingyue 3 216 March-6th-2020, 07:34 AM
Last Post: Lingyue
  Sealed microSD memory card (no more) Armin@netPI 1 263 August-13th-2019, 10:51 AM
Last Post: Armin@netPI
  Broken SD card dusrma24 10 658 August-24th-2018, 02:31 AM
Last Post: dusrma24
  SD card durability Armin@netPI 1 438 May-18th-2018, 11:48 AM
Last Post: Armin@netPI

Forum Jump:

Users browsing this thread: 1 Guest(s)