1

I want to create a copy of my current raspberry pi image with all the data and programms so that I can flash it on another sd card and run it from there.

I have following problems:

  1. For some reason there are two partitions on the SD card one etx4 partition. (I can't read it from Windows but I think this is where all the data is) and one fat32 partition with all the starting files and the kernel. When I want to use a tool like win32 imager to read the image into an .img file I can't select both partition at once?

  2. The OS and all data and programs only need around 8GB but they are on a 64GB SD card so if I read the image it will create a 64GB image. How can I keep this minimal so that I can install it later on a 16GB sd card.

tdlr: need to make a copy of my rasbian so that I can flash it on any other SD card and run it.

2

This tool allows you to clone your sd card to a bootable usb drive or another sd card

https://github.com/billw2/rpi-clone

0

You seem to have missed the following very useful SD Card utility:

SD Card Copier

The most important feature of the utility is the following:

You can copy cards of different sizes, even a large card to a small card, as long as the small card can hold all the files in the large card.

The other very good thing for newbies is :

SD Card Copier is not a command line tool, every step GUI!

After recommending the SD Copier, let me answer the OP's other question. It is about the files in the ext4 and fat32 partitions, and how to read them in in Windows, and if there is any tool like Win32DiskManager to do the copying and reading user files in the SD card.

Actually it is not necessary to know the newbie scary things like flash memory partitioning and which files go where. For newbies, all you need to do is reading and writing files to/from SD card to/from another SD card, to/from Windows where you can then use Win32 Disk Manager to do what you wish using Windows tools.

One important thing for newbies to know is that all their program and data files are stored in the default user directory "pi", which is under the home directory "home". This a a bit complicated, so let me show you a picture.

user files in rpi

The above rpi screen capture by scrot shows how I transfer all my user files from Rpi /home/pi folder to a USB flash drive (USB stick/finger).

I use the Rpi desktop file manager to go to /home/pi where are all user program and data files (in case you haven't intentionally placed your secret file outside the default file directory /home/pi.

For me I used to place all my program files in the directory Python_Programs. So I just drag and drop the whole directory's files from Rpi SD card image into my USB stick (named Transcend in this case). A couple of hundreds of MBs might take you more than 10 minutes, but then all you user files are now in the USB stick (or SD card in a copier, if you use a copier), which you can physically keep in a safe place, or go to your PC and read them as ordinary windows text/program/data files.

This way you don't need to use any bewbie scary and error prone linux terminal commands at the rpi side, and also no need to use Win32DiskMan at the PC side.

One more thing you can do (warning: the following is not recommended for absolute newbies) is to use Win32DiskManager to easier duplicate or store the SD card image you make using the SD Card Copier.

Let me show you as an example, the screen capture of my creating the stretch 2019apr version of SD card image for Rpi.

Win32DiskManagerV1.0

The above picture shows how to create the SD card image for stretch version 2019Apr (downloaded from Rpi's official download site).

I am using this picture as an example to show that you can read the SD card image copied using Rpi SD Card Copier, into a Windows file, named, say "myRpiImage.img".

You can then place this PC Windows Win32DiskMan compatible image file in a safe place, like a locked safe, physically in your home/office, or virtually in the cloud.

Moreover, you can use this read by SD Card Copier image as the master, to create more working copies, or backup copies, using Win32DiskManager.

The advantage of using DiskManager here to make more copies is that you can use SHA256 hash to verify the copies you make are very safe.

This way you can also pretend that you are no ordinary newbie, because you can duplicate Rpi SD card images with SHA256 security (not like other ordinary newbies do, using Rpi SD Card Copier).

A couple of more things:

8GB and 16GB sizes are best for newbies.

For newbies, 8GB SD Card is more than enough to store a couple of hundreds of MBs of user program/data files. You might like to use 16GB card, because the per GB money is optimal, but there is no need to use sizes bigger than 16GB, because they make your copying time longer, and actually increases the risk of damaging you card because of longer reading/writing/formatting time.

Use MicroSD Adaptor for the Micro SD Card for safer reading/writing and stupid human handling

I found using microSD copier not very reliable, because it has short and too close gold fingers which easily make poor electrical contacts (often you need to try a couple of times to make sure the very small card/writer is properly inserted). I usually use an SD card adapter to "expand" the Micro card to standard size big card, and the reading/coping is then more reliable.

Use SD Card Formatter to make a safer, more reliable copy

I often find micro SD cards intermittently fail to start, or making errors in the first couple of seconds. I usually use SDFormatter to format the SD card first. This way I found less intermittent failing starts.

One other thing is to use as short as possible USB cables. The longer the cable, the more unreliable is the reading writing. Of course the best thing to do is not to use any USB extender cable, and just plug the SD card copier direct to the PC/Rpi USB socket.

micro SD card adapter

Reference

SD card copier - The latest update to Raspbian - Simon Long 2016may13

One query which comes up a lot on the forums is about the best way to back up
your Pi.

People also want to know how to migrate their Raspbian install to a new SD 
card which is larger or smaller than the one they are using at the moment. 

This has been difficult with the command-line tools that we’ve recommended 
in the past, so there is now a new application to help with this, and you’ll 
find it in the menu under ‘Accessories’.

The SD Card Copier application will copy Raspbian from one card to another 
– that’s pretty much all it does – but there are several useful things that 
you can do as a result. 

To use it, you will need a USB SD card writer.

To take a common example: what if you want to back up your existing Raspbian 
installation? Put a blank SD card in your USB card writer and plug it into 
your Pi, and then launch SD Card Copier. 

In the ‘Copy From Device’ box, select “Internal SD Card”, and then select 
the USB card writer in the ‘Copy To Device’ box (where it will probably be 
the only device listed). Press ‘Start’, watch the messages on the screen 
and wait – in ten or fifteen minutes, you should have a clone of your current 
installation on the new SD card. 

You can test it by putting the newly-copied card into the Pi’s SD card slot 
and booting it; it should boot and look exactly the same as your original 
installation, with all your data and applications intact.

You can run directly from the backup, but if you want to recover your 
original card from your backup, simply reverse the process – boot your Pi 
from the backup card, put the card to which you want to restore into the 
SD card writer, and repeat the process above.

The program does not restrict you to only copying to a card the same size 
as the source; you can copy to a larger card if you are running out of 
space on your existing one, or even to a smaller card (as long as it has 
enough space to store all your files – the program will warn you if there 
isn’t enough space). 

It has been designed to work with Raspbian and NOOBS images; it may work 
with other OSes or custom card formats, but this can’t be guaranteed.

The only restriction is that you cannot write to the internal SD card reader, 
as that would overwrite the OS you are actually running, which would cause 
bad things to happen.

Please also bear in mind that everything on the destination card will be 
overwritten by this program, so do make sure you’ve got nothing you want to 
keep on the destination card before you hit Start!

.END

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.