2

I have configured by raspberry pi as a wifi access point using a 32GB SD card, and installed postgres. I would like to clone the SD card (from my mac) to smaller size SD cards (like 16GB, or potentially 8GB cards). Is this possible (knowing that I use mush less than 8GB space on the card)?

Is there something more to do than just usual dd commands?

I tried with an 8GB card, but it didn't work, although I got no error message.

4
  • See here: raspberrypi.stackexchange.com/a/29952/5538 As per the hint at the beginning, there may be a slightly less tedious method you could use directly on the image with resize2fs, but only slightly, which is why I did not bother to go through it there. In either case you will need a linux system or the equivalent to do it.
    – goldilocks
    Commented Jan 17, 2016 at 12:08
  • thanks for you comment. I read this thread: raspberrypi.stackexchange.com/questions/1058/…, and although I didn't fully get what he/she was doing, it seemed to me it was simpler Commented Jan 17, 2016 at 14:40
  • 2
    It depends on whether you expanded the filesystem(s) at some point beyond 8/16 GB. E.g., if the total size of partitions is 3 GB and there are no gaps between them, you could just use dd on the first half of the card. However, if the total size is 10 GB, you could not fit that onto an 8 GB card without resizing the partitions and filesystems (they are two different things) first. You must do this even if a filesystem is mostly empty (if it is full, you cannot shrink it anyway).
    – goldilocks
    Commented Jan 17, 2016 at 14:45
  • Depending on whether you are using ext4 or ext3 as a file-system you may be able to resize both the file-system and THEN the partition. On the other-hand we do not know that you ARE using the full 32GB of the SD card. Can you include the output of sudo sfdisk -l (last character is lower cased 'ell') that particular incantation will not change anything about the partitioning but don't mess about with the sfdisk command generally!
    – SlySven
    Commented Jan 18, 2016 at 10:59

4 Answers 4

1

You can easily resize file systems and partitions using GParted to less then 8GB and then clone card to smaller one.

4
  • but what if you don't want to change the partition size on the original?
    – barlop
    Commented Jan 28, 2020 at 16:48
  • @barlop you can make a copy (using dd) on your hard disk, resize partitions inside the image and then write it on the second card
    – rav_kr
    Commented Jan 28, 2020 at 18:55
  • gparted can't read an image file though can it? so how would you resize the partition(s) that are inside the image? I guess gparted reads /dev, and it may be possible to mount the image file on /dev so gparted can work with it?
    – barlop
    Commented Jan 28, 2020 at 19:25
  • @barlop AFAIK gparted can open image file without any problems
    – rav_kr
    Commented Jan 28, 2020 at 20:12
0

I won't try this before but copying 8Gb to 16Gb is quite possible and easy. You could also use the un-allocated space as an extra space. Try to check here: [RaspberryPI 8Gb img to 16Gb]. It would really help!

In order to the un-allocated space, there are a few steps to follow.

The steps that I did:

  1. Copy the 8GB img to the 16GB storage drive/device using "Win32 Disk Imager".
  2. Boot you RaspberryPI using your old 8GB SD card or USB.
  3. Open LXTerminal and type or copy and paste "sudo apt-get install gparted".
  4. Connect the 16GB SD card or USB in the other USB slot.
  5. Type or copy and paste "gksudo gparted" in the LXTerminal. Wait for the GParted window will appear.
  6. In the drop menu located at the upper right side the GParted and select the 16GB SD card or USB.
  7. Click "Resize/Move" and move the GParted slider to the end.
  8. Click "Apply All Operations" to all apply the change you to the storage drive.
  9. Just close the GParted window and shutdown the RaspberryPI
  10. Remove the 8GB and keep the 16GB plug in the USB port.

The RaspberryPI will the display the text indicator in a startup but it will not continue in your desktop, but don't panic, it just detecting all the block and keeps all intact. I will restart in the second time, and it time that the RaspberryPI will boot to its desktop.

Check the storage if it increases in size/capacity, if "YES", congratulations, you made it and that's easy.

1
  • 2
    This does not answer the question. The asker want to shrink a 32 GB SD Card to 8 GB, not what you suggested with expanding a SD Card installation.
    – Ingo
    Commented May 11, 2019 at 10:39
0

I've implemented an experimental option to shrink or expand Linux partitions in ApplePi-Baker. Maybe it's worth a try.

0
  1. use gparted live make the partition smaller then 8gb

  2. use win32diskimager to make a image from the resized sdcard

  3. use win32diskimager to restore the small image to your sdcard

  4. use gparted live again to resize the sdcard so that you have all the space from your sdcard

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.