How do you expand the filesystem to use all the sdcard

I have installed httpd via busybox and get it all runnning. But I need a lot more space for what I’m trying to do.
How do I expand the filesystem to use all my 16gb sdcard? Any help would be apreciated.

Screenshot_2023-10-02-12-46-26_24059

I have figured it out now. I set the size in /duo-buildroot-sdk/milkv/genimage-milkv-duo.cfg then rebuilt.

2 Likes

You have a solution, but for future reference… (and I don’t have my Duo up yet…)

The Raspian way (Raspian GNU/Linux 11 (bullseye), do_resize, in /usr/lib/raspberrypi-sys-mods/firstboot) is to:

  1. ‘parted’ the second partition to take up the whole SD card
    (parted -m “$ROOT_DEV” u s resizepart “$ROOT_PART_NUM” "$TARGET_END”)

then;
2. ‘resize2fs’ the second partition’s file system to make it use the whole partition’s space. ie. something like
resize2fs “$ROOT_PART_DEV” > /dev/null 2>&1

or, the old way:

1a. fdisk /dev/whatever_the_SD_card_device_is
(/dev/mmcblkXp2 - /dev/mmcblk0p2 or /dev/mmcblk1p2 ???);

1b. delete the second partition;

1c. create a new second partition, making the start = the original start, making the end the end of the disk, etc.

1d. it will find a “signature” of your original 2nd partition - DON’T wipe it out!!!

ie.
Created a new partition 2 of type ‘Linux’ and of size 27 GiB.
Partition #2 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: n

then;

2. ‘resize2fs’ the second partition to make the filesystem the same size as the partition: something like: 

resize2fs /dev/mmcblkXp2

’sudo’ the commands if you’re not logged in as ‘root’.

Hopefully, ‘busybox’ will let you do this…
YMMV…

1 Like

I’ve just received a DUO today and also want to expand the file system to use the whole sd card. But I’m not familiar enough with the procedure … Here is what I see after installation … what do I need to do?

Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/root ext4 763327 157697 562213 22% /
devtmpfs devtmpfs 14540 0 14540 0% /dev
tmpfs tmpfs 14616 0 14616 0% /dev/shm
tmpfs tmpfs 14616 48 14568 0% /tmp
tmpfs tmpfs 14616 32 14584 0% /run

brw------- 1 root root 179, 0 Jan 1 1970 /dev/mmcblk0
brw------- 1 root root 179, 1 Jan 1 1970 /dev/mmcblk0p1
brw------- 1 root root 179, 2 Jan 1 1970 /dev/mmcblk0p2
brw------- 1 root root 179, 3 Jan 1 1970 /dev/mmcblk0p3

And from var/log/messages …

Jan 1 00:00:01 milkv-duo kern.notice kernel: [ 0.000000] Kernel command line: root=/dev/mmcblk0p2 rootwait rw console=t tyS0,115200 earlycon=sbi loglevel=9 riscv.fwsz=0x80000
Jan 1 00:00:01 milkv-duo kern.info kernel: [ 0.913430] mmc0: SDHCI controller on 4310000.cv-sd [4310000.cv-sd] using AD MA 64-bit
Jan 1 00:00:01 milkv-duo kern.info kernel: [ 1.060762] mmc0: new high speed SDHC card at address aaaa
Jan 1 00:00:01 milkv-duo kern.info kernel: [ 1.067462] mmcblk0: mmc0:aaaa SD32G 29.7 GiB
Jan 1 00:00:01 milkv-duo kern.info kernel: [ 1.090245] mmcblk0: p1 p2 p3
Jan 1 00:00:01 milkv-duo kern.info kernel: [ 1.156009] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
Jan 1 00:00:01 milkv-duo kern.info kernel: [ 1.273396] EXT4-fs (mmcblk0p2): re-mounted. Opts: errors=remount-ro