Sunday, September 6, 2015

Backup Micro SD Card As An Image File On Ubuntu

Back up Micro SD Card is an important procedure, as we don't know life cycle of them. We can make backup into a File with whatever name you wish. Below is my steps:

  • Insert Micro SD Card into its adaptor and plug to PC
  • Issue Command df -h from Terminal to know its name [see figure below].

    We see micro SD card was assigned as /dev/sdb1 and /dev/sdb2. mounted as /media/avpulsa/boot ..
    Above that there was /dev/sdc1 it was a USB Drive that I plan to save backup in it, but got fail because it was formatted as FAT32 which has limited file size to 6GB.
  • Umount them using their mounted name. eg Umount /media/avpulsa/boot or use nautilus file manager.
    • /dev/sdb1 and /dev/sdb2 is a name for partition in micro SD card
    • /dev/sdb [without number] is a name for assigned to whole micro SD card. Since we will back up the whole micro SD card, this location name is what we notice.
  • Now create a folder to hold backup file, in my case I plan to back it up into another partition and new folder.
  • Type sudo dd if=[source: micro SD card location name] of=[destination: directory and name file] bs=4M
    As I mentioned before, I will back it up in another partition, in my case it was /media/avpulsa/D3 in new Folder I create and name it as RaspiBackup and I will make a img file with name raspi.img, so complete location is /media/avpulsa/RaspiBackup/raspi.img
    So I type:
    sudo dd if=/dev/sdb of=/media/avpulsa/D3/RaspiBackup/raspi.img bs=4M
  • Type sudo sync After minutes when it finished [see figure above] to flush all process.
If need to restore just follow those steps [exclude umount part] whith file img as source and /dev/sdb as destination.

Summary commands:
  1. df -h
  2. umount /media/avpulsa/boot
  3. sudo dd if=/dev/sdb of=/media/avpulsa/D3/RaspiBackup/raspi.img bs=4M

No comments:

Post a Comment