In the name of Allah.
This can be done easily with dd or win32diskimager on windows. But the size would be bigger. If space is not a problem for you, then no need to read further. In fact this can be done in many way, probably there is easier way than I am writing. Anyway, these can be seen later.
Now, install all the programs on your raspberry-pi, google for more. When it is complete, follow the instructions bellow, I did it this way:
* Linux based backup and restore of raspberry-pi sdcard. Need these 2 programs – gparted and fsarchiver. The mini sdcard size was 8gb.
* Copy all the files from the 1st partition of which size is bellow 60mb to any folder – say for example the name of the new folder is “backup-rpi-fat16”. Since it is FAT16, this can be done on windows too. Simple copy paste.
* Start linux, insert sdcard, if it is auto mounted, unmount – like (sdcard can be different on your pc like here as sdb1 sdb2, check it):
* If fsarchiver is not installed, install it by something like bellow or other way (the static binary can be downloaded from fsarchiver site, download, copy it to /usr/sbin/ and run command: “chmod 755 fsarchiver”):
apt-get install fsarchiver
Run the following command to save the real OS partition:
fsarchiver -v savefs rpi.fsa /dev/sdb2
The above makes the backup complete. Now to restore:
* Run gparted (install if necessary) and make 2 partions on the sdcard. , 1st one will be FAT32 and size 60mb. 2nd one or remaining will be EXT4. (If you want make 1st partion’s fs as FAT16, hope this would work too.)
* Copy all the files you saved earlier from FAT16 partition (from “backup-rpi-fat16” folder, see above) to 60mb sized FAT32 partition.
* Unmount /dev/sdb2:
* Run the following command to restore OS on the ext4 partition or /dev/sdb2:
fsarchiver -v restfs rpi.fsa id=0,dest=/dev/sdb2
If resizing/expanding is needed for the sdcard, use gparted.
Best of luck.
On windows this can be done with “FTK Imager” and “Mini Tool Partition Wizard”. Make backup image with FTK Imager, at the time of restore mount it with FTK Imager. Copy and write source and destination disk with Mini Tool Partition Wizard.
March 18, 2015.