Page 1 of 2

How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 1:52 pm
by RaspbianUser1
I know this question has probably been answered 1000 times but I can't find the answer after using google for 20 minutes and searching this forum.

Anyway, my question is kind of in the title, but if you don't understand what I want to do is.
While on the raspberry pi, I want to make a replica of the image its using.
I don't want it flashed on another SD card or anything, I want a .img file with everything in.

I have tried searching for a program/command but I can't find anything.

Thanks in advance

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 2:39 pm
by scotty101
Did your search turn up this page?

https://www.raspberrypi.org/documentati ... /backup.md

This describes how to create an image from an existing SD card using the SD Card Copier application.

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 3:11 pm
by RaspbianUser1
Thank you but is there a premade program as I plan to make quite a few in different installs

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 3:52 pm
by pasman1

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 3:56 pm
by bls
If you're going to make several different install configurations, you might want to think about going the "other way". That is, starting from building customized images and then blast them to SD Cards when you need one. An easy way to do this is to use a tool like https://github.com/gitbls/sdm

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 4:10 pm
by trejan
bls wrote:
Tue Oct 13, 2020 3:56 pm
If you're going to make several different install configurations, you might want to think about going the "other way". That is, starting from building customized images and then blast them to SD Cards when you need one. An easy way to do this is to use a tool like https://github.com/gitbls/sdm
This is the proper way to build images. Trying to create one from a live install is bad idea and you'll leak data like logins and passwords unless you're very meticulous about cleaning up and scrubbing the unused portion of the image. If nothing else, you must ensure that the SSH host keys are deleted from /etc/ssh as it is a security vulnerability to leave them there.

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 8:17 pm
by emma1997
I second that. In particular RonR's Image-Backup program made it so easy and efficient I now backup all the time instead of once in a while. I can't believe the hoops I used to jump through and some of my pals still do. If it ain't easy it tends to not get done.

The image shrink function had major impact on my disk space usage too.

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 9:38 pm
by RaspbianUser1
I am really struggling here, I don't know how to use RonR's software, I don't understand what its asking from me, I can get it installed and started but I don't understand the questions its asking.

Is there a simple GUI program which can just do exactly what rpclone is doing but instead of writing to a external device, writing to an image file. I just want to be able to store my backups on the cloud rather than using an entire SD card

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 10:05 pm
by Botspot
RaspbianUser1 wrote:
Tue Oct 13, 2020 9:38 pm
I am really struggling here, I don't know how to use RonR's software, I don't understand what its asking from me, I can get it installed and started but I don't understand the questions its asking.

Is there a simple GUI program?
Yes! At least, there is a simple GUI program to make your own image. It's Pi-Power-Tools.
img-mode.png
img-mode.png (21.47 KiB) Viewed 711 times

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 10:11 pm
by RonR
RaspbianUser1 wrote:
Tue Oct 13, 2020 9:38 pm
I am really struggling here, I don't know how to use RonR's software, I don't understand what its asking from me, I can get it installed and started but I don't understand the questions its asking.

Is it really that complicated?: :)

Code: Select all

pi@raspberrypi:~ $ sudo ./image-backup

Image file to create? /mnt/backup.img

Initial image file ROOT filesystem size (MB) [3584]?

Added space for incremental updates after shrinking (MB) [0]?

Create /mnt/backup.img (y/n)? y

Except for the image file to create (/pathto/filename), simply take the defaults.

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 10:13 pm
by RaspbianUser1
Initial image file ROOT filesystem size (MB) [3584]?

Added space for incremental updates after shrinking (MB) [0]?
What do I enter here

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 10:15 pm
by RaspbianUser1
Botspot wrote:
Tue Oct 13, 2020 10:05 pm
RaspbianUser1 wrote:
Tue Oct 13, 2020 9:38 pm
I am really struggling here, I don't know how to use RonR's software, I don't understand what its asking from me, I can get it installed and started but I don't understand the questions its asking.

Is there a simple GUI program?
Yes! At least, there is a simple GUI program to make your own image. It's Pi-Power-Tools.
img-mode.png
I did look at your software, does it allow you to copy the current raspberry pi install to an img file?

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 10:17 pm
by Botspot
RaspbianUser1 wrote:
Tue Oct 13, 2020 10:15 pm
Botspot wrote:
Tue Oct 13, 2020 10:05 pm
Yes! At least, there is a simple GUI program to make your own image. It's Pi-Power-Tools.
img-mode.png
I did look at your software, does it allow you to copy the current raspberry pi install to an img file?
Yes it does. Pi-Power-Tools includes an IMG Flasher.
flash.png
flash.png (18.26 KiB) Viewed 689 times
In addition to that, PPT includes many unique features that no other tool on earth can do. See more on its instruction file (README)

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 10:26 pm
by RaspbianUser1
You misread/misunderstood my question.
Can you turn the current working system into an image file

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 10:32 pm
by Botspot
RaspbianUser1 wrote:
Tue Oct 13, 2020 10:26 pm
You misread/misunderstood my question.
Can you turn the current working system into an image file
Oh, sorry.
No, PPT cannot do that.

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 10:37 pm
by RaspbianUser1
Ah ok, thank you for at least trying :)

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 10:42 pm
by RonR
RaspbianUser1 wrote:
Tue Oct 13, 2020 10:13 pm
Initial image file ROOT filesystem size (MB) [3584]?

Added space for incremental updates after shrinking (MB) [0]?
What do I enter here

Simply hit the RETURN key to accept the default values.

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 10:43 pm
by Botspot
RaspbianUser1 wrote:
Tue Oct 13, 2020 10:37 pm
Ah ok, thank you for at least trying :)
No problem, thanks for asking. Once you've made your image, PPT will come in quite handy either for making a quick edit or for flashing your SD cards.

Re: How to make turn a custom raspberry pi install into a image?

Posted: Tue Oct 13, 2020 10:56 pm
by kerry_s
it's a lot easier to backup if it's not the os your running.
if you have a spare sd card, do the clone, then you can convert the clone to an clone.img.gz.
i'm in fact doing it right know with my ubuntu install on a ssd. using a script i made.
i'm running from my usb flash drive(sda) & i'm copying my ssd drive(sdb) on to the flash drive(sda) as an .img.gz, afters i just copy the .img.gz to a backup drive. when i want it i just write it back.

this is the command i use from that part of the script.

Code: Select all

sudo dd if="$(zenity --entry --title="Device" --text="$(lsblk)" --entry-text="/dev/sdb")" | gzip > "$(zenity --entry --title="Backup" --text="Backup Name").img.gz"

Re: How to make turn a custom raspberry pi install into a image?

Posted: Wed Oct 14, 2020 12:45 am
by Milliways
RaspbianUser1 wrote:
Tue Oct 13, 2020 9:38 pm
I am really struggling here, I don't know how to use RonR's software, I don't understand what its asking from me, I can get it installed and started but I don't understand the questions its asking.

Is there a simple GUI program which can just do exactly what rpclone is doing but instead of writing to a external device, writing to an image file. I just want to be able to store my backups on the cloud rather than using an entire SD card
I routinely use a procedure (based on RonR's code - but with documentation) https://raspberrypi.stackexchange.com/a/103991/8697

This is my normal day to day backup tool which produces installable images. I use this to image a working Pi OS to a Samba share on my Mac.

Re: How to make turn a custom raspberry pi install into a image?

Posted: Wed Oct 14, 2020 1:03 am
by RaspbianUser1
Thank you, I will give it a look later but from initial glance it seems ok, RonR needs to edit the post to include a walkthrough/documentation

Re: How to make turn a custom raspberry pi install into a image?

Posted: Wed Oct 14, 2020 10:36 pm
by RaspbianUser1
Ok, I have learnt you can't really make an img from a running install.

I can plug the install/setup into a usb adaptor then run a different raspberry pi image.
I want a img file.
What command can I use?
My install appears as /dev/sda
what command can I make an image from this

Re: How to make turn a custom raspberry pi install into a image?

Posted: Wed Oct 14, 2020 10:42 pm
by RonR
RaspbianUser1 wrote:
Wed Oct 14, 2020 10:36 pm
Ok, I have learnt you can't really make an img from a running install.

How did you come to this (totally incorrect) conclusion?

Re: How to make turn a custom raspberry pi install into a image?

Posted: Wed Oct 14, 2020 10:59 pm
by RaspbianUser1
I don't know, im just guessing as no one seems to be helping, as usual Kerry_S is being helpful and I am trying the zenity GUI script they sent

Re: How to make turn a custom raspberry pi install into a image?

Posted: Wed Oct 14, 2020 11:06 pm
by RonR
RaspbianUser1 wrote:
Wed Oct 14, 2020 10:59 pm
I don't know, im just guessing as no one seems to be helping, as usual Kerry_S is being helpful and I am trying the zenity GUI script they sent

I was under the impression you were having success using image-backup. It definitely creates image files from a running install.