Resizing/shrink FreeBSD partition on RPi


New Member

Messages: 9


I have FreeBSD installed on a RPi B+ and iI have completed my task of making a "image" ready to be copied to multiple devices.

However iI installed FreeBSD on a 8GB SD card. But want to shrink it to as little as possible and then using the autosize_enable="YES" next time it boots. So it can find also 4GB cards.

Is that possible? At the moment my install only uses about 1.5GB of the total volume.

Best Regards
Thomas Nissen



Reaction score: 621
Messages: 1,773


New Member

Messages: 6


From NetBSD port, maybe help to FreeBSD users:
  • Growing the root file-system
    • During the partitioning process, do not delete or format the first MSDOS (FAT) partition, as the Raspberry pi firmware is hard coded to boot on the SDCAD / 1st MSDOS partition / Firmware updates and boot loader.
    • Copy /boot/cmdline.txt to /boot/cmdline.txt.orig
    • Edit /boot/cmdline.txt and add the '-s' flag to the end of the first line of text to boot into single-user mode.
    • For the next steps, the root filesystem mustn't be mounted rw. So reboot, and at the prompt to enter the pathname of shell, press return for the default (/bin/sh).
    • At the # prompt, type

      " disklabel -i ld0" and press return.

    • At the partition> prompt type "A" and press return.

      Adjust disklabel sector from 4194304 to 62333952 [n]?
      Type "y" and press return.

    • partition> prompt type "a" and press return.

      Filesystem type prompt, press return to use the current value (4.2BSD).
      Start offset prompt, press return to use the current value.
      Partition size prompt, type "$" and press return to grow the
      partition to use all available free space.

    • partition> prompt type "W" to save the changes to the disklabel.

      Confirm this choice by typing "y" at the Label disk prompt.
      Type "Q" and press return to quit disklabel.

    • At the # prompt (shell), type

      fsck -fy /dev/rld0a
      resize_ffs -y /dev/rld0a

    • This may take a few minutes, be patient!

      fsck -fy /dev/rld0a
      mount_msdos /dev/ld0e /boot
      mv /boot/cmdline.txt.orig /boot/cmdline.txt

    • When the system comes back up, the root file-system will have been expanded to fill the SD card.
Last edited by a moderator: