Skip to content

Moving the system from an SD card to a HDD / SSD or other memory card – Raspberry Pi

  • by

Aby przenieść lub wykonać kopię zapasową karty pamięci z systemem naszego Raspberry należy wyciągnąć kartę pamięci i podłączyć do naszego komputera. Następnie wpisujemy polecenie diskutil list i sprawdzamy gdzie zamontowana jest nasza karta pamięci przykładowo u mnie jest to /dev/disk2

To transfer or backup the memory card with the Raspberry system, remove the memory card and connect it to our computer. Then enter the command diskutil list and check where our memory card is mounted, for example for me it is /dev/disk2

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *31.9 GB    disk2
   1:             Windows_FAT_32 boot                    268.4 MB   disk2s1
   2:                      Linux                         31.6 GB    disk2s2

To copy whole content, type the command:

sudo dd bs=4k if=/dev/disk2 of=/Users/patryk/raspberry.bin

In if we give our source and in of we give the place where the copy should be saved.

When we make a copy of our card, disconnect it from the computer and connect the hard drive. Then we check where it is mounted, i.e. similarly to the memory card we use the command diskutil list

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *320.1 GB   disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:       Microsoft Basic Data WD                      319.9 GB   disk2s2

And copy our copy to the hard drive:

sudo diskutil unmountDisk /dev/disk2
sudo dd bs=4k if=/Users/patryk/raspberry.bin of=/dev/disk2

Similarly, we give the source (in this case our backup) and the destination, i.e. the hard drive or USB flash drive.

How to enlarge partition to full disk size?

The easiest way to enlarge the partition is to run the raspberry with the connected disk / pendrive, then use the command:

sudo raspi-config

Then go to 7. Advanced Options -> A1. Expand Filesystem, next restart the operating system! However, it should be remembered that if we enlarge the partition with the operating system, it will be more difficult to backup, so I recommend that you leave e.g. 32GB for the system and make an additional one for any files :).

Leave a Reply

Your email address will not be published. Required fields are marked *