Take a plain uSD card, use etcher (https://www.balena.io/etcher) to write the Raspbian image file (https://www.raspberrypi.org/downloads/raspbian/) to it. Insert into your Pi, reboot and - as said already - file size will be expanded as first action. Reboots automatically and once finished you can start working with it.laquica wrote: ↑Mon Oct 29, 2018 11:41 amHi guys,
First, I am sorry, if topic's location is wrong, let me briefly explain my issue.
I want to resize pi's root partition, and I know I did this with gparted, but I want to do writing img file before SD card, so I mounted raspbian .img files to on my system, but I don't know which files I should change. Thank you for your attetion.
Yeah, I am aware what I am doing, just maybe I misrepresented, so I just want to know, let say we have 32 GB SD card and I want to root partition have 8 GB area, then other files have different size (configs 3GB etc.) Can we set .img file like this before writing the SD card?B.Goode wrote: ↑Mon Oct 29, 2018 8:29 pmWelcome to the Raspberry Pi forums.
Are you aware that by default one of the first actions of a newly-installed version of the Raspbian Operating System is to resize the root partition to occupy the largest possible area of the microSD card?
At first sight, therefore, what you are proposing appears pointless. Unless you already know this and plan to take steps to inhibit this default action.
Is there some background to your query that might allow someone to give a more informed reply?
If we could make this custom image, this provide us huge save time.
No need to disclose any details! Sounds like you need some more, hence do as described by me (standard install, resize, etc) and then take an image of your SD card.laquica wrote:I am working for IOT company, I cant tell the details but If we could make this custom image, this provide us huge save time.
4. You mentioned making the root partition a fixed 8GB in size. What will you be doing with the other ~24GB of SD card space? Did you mean to create other partitions (of 3GB etc) for your configs?I want to root partition have 8 GB area, then other files have different size (configs 3GB etc.)
5. Yes, But there are several ways you can do this. What is your motivation?Can we set .img file like this before writing the SD card?
6. What is taking too long at the moment? Do you mean the expansion of the partition is taking too long?If we could make this custom image, this provide us huge save time.
thank you, this looks like useful, thanks.TimG wrote: ↑Wed Oct 31, 2018 6:42 amTo prevent the automatic re-partitioning from taking place on first boot, edit cmdline.txt to remove the "quiet init=/usr/lib/raspi-config/init_resize.sh".
Once this is done you can re-partition by hand and save the resulting disk image. Or you can alter /usr/lib/raspi-config/init_resize.sh to do what you want (look for $TARGET_END in the script). The first option is easier, but the second is more flexible.
If you also want to automate resizing of the root file-system you'll need to edit /etc/init.d/resize2fs_once. You won't find it on a running RPi because it deletes itself on first boot, but you can restore it from https://github.com/RPi-Distro/pi-gen/bl ... ze2fs_once
Code: Select all
sed -i 's| init=/usr/lib/raspi-config/init_resize.sh||' /boot/cmdline.txt
Code: Select all
sed --in-place=o 's| init=.*sh||' /boot/cmdline.txt # once resized do not invoke me again.