Jump to content

Shrink boot partition on SD card


Echo

Recommended Posts

Hi,

following the documentation, I used

nand-sata-install

to

  • boot from SD, system on SATA / USB

without any problems. My backup solution (raspiBackup.sh) now creates a 16GB image for the SD card, even if it is just used to boot.

Is it possible to shrink the partition?

 

Thank you

René

Link to comment
Share on other sites

Here is how to shrink an existing image.

In "gparted", do "edit/resize" of the partition, but leave a certain percentage of free space, then "Apply".

Replace the "endsect" by the actual number shown by fdisk.

sudo modprobe loop
sudo losetup -f
sudo losetup /dev/loop0 myimage.img
sudo partprobe /dev/loop0
sudo gparted /dev/loop0
sudo losetup -d /dev/loop0
fdisk -l myimage.img
truncate --size=$[(endsect+1)*512] myimage.img

Link to comment
Share on other sites

If I understand correctly, the steps apply to the already taken backup img file.

After shrinking, I could write it to another SD card and test if the root partition is smaller, correct?

 

Thank you

Link to comment
Share on other sites

I'm still working on this issue.

In the documentation I found that it is possible to specify a size in percentage, that is used to adjust the sd card partition:

I put 25% in the file /root/.rootfs_resize

Then I wanted to run the firstrun script again to apply the change (and create a new ssh key).

But the file is not present on my disk. However I found it under /media/mmc/etc/init.d. I am running "ARMBIAN 5.25 stable Debian GNU/Linux 8 (jessie) 3.4.113-sun8i".

 

Is the file supposed to be missing after the initial resize and copying everything to the hdd?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines