Echo Posted November 21, 2016 Posted November 21, 2016 Hi, following the documentation, I used nand-sata-install to boot from SD, system on SATA / USBwithout 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é
martinayotte Posted November 21, 2016 Posted November 21, 2016 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 1
Echo Posted November 21, 2016 Author Posted November 21, 2016 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
martinayotte Posted November 21, 2016 Posted November 21, 2016 Right ! This method could also be used when you wish to re-install a small image on smaller SDCard.
Echo Posted November 21, 2016 Author Posted November 21, 2016 Thanks. I though it might be possible to shrink while the system is running, but this is a way I can live with.
Echo Posted February 14, 2017 Author Posted February 14, 2017 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?
Recommended Posts