Is there an way to clone the SD card to a larger one. I have an 32GB SD and want to clone the image to an 64GB card. I suppose that the disk size will be preserved when I clone with disk dump (dd).
There are many ways to do that. In what follows be very very careful to get the right device special file names. I am assuming this is on a host PC with both cards present at the same time (a minor variation works if you can’t have both connected at the same time). I am going to use “
/dev/mmc32GB” for the 32GB card, and “
/dev/mmc64GB”, but this is obviously intended for you to substitute the actual device names as a whole (not individual partitions) your PC uses…I just don’t know what those are. As long as you don’t mind losing anything on the 64GB destination card, try this:
sudo -s dd if=/dev/mmcSD32 of=/dev/mmcSD64 bs=512 gparted /dev/mmcSD64
…you might need to install gparted, “
sudo apt-get install gparted”. When in gparted you will expand just the rootfs (APP) partition and tell it to also maintain the ext4 filesystem. gparted is able to avoid ext4 corruption when it expands the partition.
Seems to be clear, apart from the fact that I have a Mac.
Mac is Unix.
dd should work;
GParted can be used on x86 and x86-64 based computers running Linux, Windows, or Mac OS X by booting from media containing GParted Live.
Although GParted is not available for macOS, I was able to access my flash drive as a raw disk in GParted easily by using the GParted Live bootable image in VirtualBox and creating a raw disk image from my flash drive with the device file retrieved using
/dev/disk2in my case). Both
VirtualBoxmust be run as sudo from a command line, and the flash drive must be unmounted before the virtual machine will launch
Other than having different names for device special files in “
/dev” it should work. As @Andrey1984 mentioned, Mac has a lot in common with Linux (at least on the command line world). The supported host environment is Linux, at least by default, so unless stated otherwise, people here will assume your host PC is Linux.
It is also possible on a Mac that your default search path is set up differently, or security is set up differently, and so there might be another step for finding
dd or getting root permission.
Dd will work. After you’ve written the image on a new card you can boot it up and do a resize2fs on the root partition and it’ll extend to the whole disk size. You can do this without unmounting anything (shrinking, however, requires an unmount). GParted will also work, but i recommend gnome-disks as it’s simpler, a more modern design, and harder to shoot your foot off with. You can use it to image and restore the card as well (again, safer than dd).