Learning with Raspberry PI, Delivery III – Make or overturn a SD card style Clonezilla image

I've been looking for a backup comfortable and effective for Raspberry PI, Although I have never found a procedure that completely convince me as to stop search and stay with the finally. So far, before I've already tried with different forms, How to copy paste, or copying partitions to another SD, thing requiring to have two cards all the time.

This new (for my) method of backup, what I have found and implemented for the final project of Medium level training cycle that I am doing this last month of class, and it has been very useful to me, Although it must be done with the operating system standing and not in production; When you run the, We will obtain a file extension .img ready to burn.

For this task I have chosen the command DD, It creates an identical copy in the output that you indicate, both devices, as files, and eas simple as running s DD using as arguments"If” y “of”, where If is the origin, and of the fate of the image; We see as:

usuario@maquina:~$ sudo umount /dev/mmcblk0p1 && sudo umount /dev/mmcblk0p2
usuario@maquina:~$ sudo dd if=/dev/mmcblk0 of=/media/Backups/raspberrypi_$(date "+%x_%H:%M"|tr -s "/" "_").img bs=1M

The first line, dismounts the partition /boot (/dev/mmcblkp01) and (/dev/mmcblkp02) of the SD of Raspbian, the second line cloned the SD; the argument BS = 1M tells you to DD that transfer in blocks of 1MB, with this I managed to save time, and that the backup is carried out in 3,5 minutes with a SD SanDisk GB HC.

The variable “$(give you “+%x_ %H:%M”|TR - s “/” “_”)” Adds the name of the backup the date format “dia_mes_ano_hora:minute“.

Apart from previously being an effective method like this, before should always have of a converter to SD card USB so that the system will detect the card as /dev/sdc, Since USB Imagewritter only points towards /dev/sd *, and did not recognize the reader of my laptop, Since the device is housed in /dev/mmcblk0.

Now with the inverse operation, rearranging the routes of If and of, We can dump the image of Raspbian, or our already pre-configured image, or in the event of corruption of the file system or any problem, We can always go back and not lose all configurations and/or data overturning our backup most recent, and it even offers the possibility to directly copy a SD to another.

usuario@maquina:~$ sudo umount /dev/mmcblk0p1 && sudo umount /dev/mmcblk0p2
usuario@maquina:~$ sudo dd if=/media/Backups/raspberrypi.img bs=1M of=/dev/mmcblk0

If you like you can follow me on Twitter, Facebook, Google +, LinkedIn, or share it with the buttons under this publication, If you have any questions or suggestions please do not hesitate to comment.

Help us to reach more readers Share on LinkedIn
Share on Facebook
Tweet about this on Twitter
Share on Google+
Google +
Email this to someone

2 thoughts on"Learning with Raspberry PI, Delivery III – Make or overturn a SD card style Clonezilla image

    • Hello, thank you very much for your question 🙂

      If you want to copy directly from an SD card to another, only must replace the destination path of the dd command of=/***.img by of=/dev/sd*, where you have to replace /dev/sd* by the device name of the destination SD.

Leave a Reply