Tag Archives: dd

Install Raspbian RAW image into an SD Card in Linux

First download a Raspbian RAW image from here: http://www.raspberrypi.org/downloads

Plug-in your SD card into your PC. Then use df -h to see the name of the disk device of it:

$ df -h
S.ficheros     Tamaño Usado  Disp Uso% Montado en
/dev/sda1         55G   12G   40G  23% /
udev             994M  4,0K  994M   1% /dev
tmpfs            402M  804K  401M   1% /run
none             5,0M     0  5,0M   0% /run/lock
none            1003M  768K 1002M   1% /run/shm
none             100M   32K  100M   1% /run/user
/dev/mmcblk0p1   3,8G  4,0K  3,8G   1% /media/SDCARD

In my case the SD Card is mounted as /dev/mmcblk0p1. Once you know this unmount it:

$ umount /dev/mmcblk0p1

Now it’s time to copy the Raspbian image in the SD Card using dd but we don’t want to write it to the partition but to the whole device, so we have to remove the last p1 from the mounting point:

$ sudo dd bs=4M if=2014-01-07-wheezy-raspbian.img of=/dev/mmcblk0

Finally flush all the data just in case:

$ sudo sync

Ref: http://elinux.org/RPi_Easy_SD_Card_Setup#Using_the_Linux_command_line

Backup and restore hard drive with “dd”

Look for the hard drives device with mount or sudo fdisk -l and unmount it. In my case it’s going to be sda.

630px-Hard_disk_platters_and_head

Backup uncompressed image:

sudo dd if=/dev/sda of=/home/sda.bin bs=1024

Backup compressed image:

sudo dd if=/dev/sda bs=1024 | gzip > /home/user/sda.bin.gz

If the target file system where the image is going to be created can’t have files larger than 4GB for example (as for FAT32) you’ll have to split the output:

sudo dd if=/dev/sda conv=sync,noerror bs=64K | gzip -c | split -b 2000m - /media/usbdrive/sda.bin.gz

Restore uncompressed image:

sudo dd if=/home/user/sda.bin of=/dev/sda bs=1024

Restore compressed image:

sudo gzip -dc /home/user/sda.bin.gz | dd of=/dev/sda bs=1024

Restore compressed and splited image:

sudo cat /media/usbdrive/sda.bin.gz.* | gzip -dc | dd of=/dev/sda conv=sync,noerror bs=64K

You can do the same with only one partition of the hard drive if you replace sda with sdaX being X the partition number.

Ref: https://help.ubuntu.com/community/DriveImaging#Creating_Disc_Images_Using_dd
http://ubuntuforums.org/showthread.php?t=1540873

Install Raspbian RAW image into an SD Card in Mac OS X

First download a Raspbian RAW image from here: http://www.raspberrypi.org/downloads

SDHC_memory_card_-_8GB

Plug-in your SD card into your Mac. Then use diskutil to see the name of the disk device of it:

$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *320.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            319.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *4.0 GB     disk1
   1:             Windows_FAT_32                         4.0 GB     disk1s1

In my case it is /dev/disk1.

Unmount it so we can write the image into it:

$ diskutil unmountdisk /dev/disk1
Unmount of all volumes on disk1 was successful

Now copy the image (it will take quite long and you won’t get any feedback until the end so be patient):

$ sudo dd if=2013-09-25-wheezy-raspbian.img of=/dev/disk1 bs=1m
4297+0 records in
4296+0 records out
2199552 bytes transferred in 1.877077 secs (1171796 bytes/sec)

Finally eject the disk:

$ diskutil eject /dev/disk1