I need the whole system, all scheduled data, settings, and overall everything I have on the SD card (linux) with 4GB convert to another SD card. How can I do this? My notebook have ubuntu.

Both cards in my PC.

Old card (4GB): / dev/mmcblk0

New card (8GB): / dev/sda1


Probably you don't want a 4G partition table, a 4G partition, and a 4G filesystem on your 8G card, but that's what you'll get when you use dd. This should work, unless you have bad blocks on your 8G, which dd will just assume are good. To use the additional space, you would need to expand the partition, resize the filesystem, and maybe then edit the /etc/fstab file for new UUIDs. The alternative is to partition the 8G disk the way you want it, setting the size of root, and deciding if you really want swap. Format the partition(s) with the filesystem you want -- maybe no journaling on an SD card, so ext2 or ext4 without journaling. Copy the files over with any copy program which can copy file attributes and not follow links (look at the option switches). tar works just fine with the following:

cd /mnt/4g

sudo tar -cf - * |(cd /mnt/8g;sudo tar -xpBf -)

Get the new UUIDs with

 sudo blkid

Edit the /etc/fstab with the new UUIDs. Install grub to the 8G disk (assume it's sdc)

 sudo grub-install --boot-directory=/mnt/8g/boot   /dev/sdc

Bad blocks on the target card should be recognized and avoided, so you get a working system without a perfect card.

  • is it worth the effort if the rest of the 8G card could have a second data partition formated at any point - nothing wrong with what you are saying though – peterretief Jul 14 '14 at 17:06

What filesystem?

For ext, you can create an 8gb partition, then use DD to copy the 4gb partition on top, then use resize2fs to expand it to fill the space.

There might be similar utilities for other file systems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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