Prepare Raspbian SD Card (appliance) via sda, do not resize partition at first boot

Move to the root user:
sudo su
Set device:
device=sdc
Since booting from USB can provide more speed I will prepare new raspbain OS through USB (sda):
dd if=2018-10-09-raspbian-stretch-lite.img of=/dev/$device bs=1M status=progress; sync
Create directory for mounting:
mkdir ~/rpi-img
Mount the boot partition:
mount /dev/$(echo $device|sed "s/$/1/") ~/rpi-img
Enable instant SSH access:
touch ~/rpi-img/ssh
I have to remove "init=/usr/lib/raspi-config/init_resize.sh" portion from "cmdline.txt". This can be done with:
sed -i "s/.init=\/usr\/lib\/raspi-config\/init_resize.sh//" ~/rpi-img/cmdline.txt
Umount the boot partition:
umount /dev/$(echo $device|sed "s/$/1/")
Mount the main partition:
mount /dev/$(echo $device|sed "s/$/2/") ~/rpi-img
Remove "resize2fs_once":
rm -rf ~/rpi-img/etc/init.d/resize2fs_once
Remove "S01resize2fs_once":
rm -rf ~/rpi-img/etc/rc3.d/S01resize2fs_once
Umount the main (ext4) partition:
umount /dev/$(echo $device|sed "s/$/2/")
Remove tmp dir:
rm -rf ~/rpi-img
Next topic:Extend Raspberry Pi main partition a little bit longer

No comments: