I'm not coming up with a lot of useful (clear) results when searching for a solution to this issue.

Is it OK to simply dd the 128GB disk to the 32GB disk using count to stop after the 16GB partition was cloned?

A bit more context: I had to clone a 16GB eMMC and only had a 128GB SD around. Now I purchased a 32GB eMMC and want to clone it again. The partition holds a root filesystem for an ARMv8 device. I don't have the 16GB eMMC anymore, that would have been the easy way out.

  • Kazumara@discuss.tchncs.de
    ·
    edit-2
    1 month ago

    Is it OK to simply dd the 128GB disk to the 32GB disk using count to stop after the 16GB partition was cloned?

    I think it would work, but it seems a little overcomplicated, you can just use the partition paths as if and of of dd directly, as long as the output partition is not smaller than the input partition. For example dd if=/dev/sdc1 of=/dev/sdd1 bs=4M status=progress

    Your method would also copy the partition table I suppose, which might be something you want under specific circumstances, but then it would be a little harder to get the count right, just taking the size of partition 1 would be wrong, because there is some space before it (where the partition table lives) and dd would start at 0. You'd need to add up the start position and the size of partition 1 instead.

    Personally I would prefer making a new partition table on the new eMCC, and create a target partition on it. Then you clone the content of the partition (i.e. the file system). This way the file system UUID will still be the same, and the fstab should still work because these days it usually refers to mounts by filesystem UUID in my experience.

    If you make the target partition larger than the source partition, and you intend to use the full partition going forward you will additionally need to resize the filesystem to fit the new larger partition, for example with resize2fs.

  • Rin@lemm.ee
    ·
    1 month ago

    Do you only have the root parition or do you have everything else too (like /boot)?

    1. If you only have root, reinstall the OS then just overwrite the root partition with your old one.
    2. Run fsck on the root partition and/or use gparted to expand the ext4 partition. You might have to fuck around with the disk UUIDs to get it to boot again. You'll most likely have to at the very least change your /etc/fstab file to update the UUID of the boot partition.

    if you have everything, you can just dd the sd disk to the emmc, provided that you didn't mess around with the partitions after.

    1. Copy with dd to the emmc with or without the count, it doesn't matter that much if time isn't a priority. (something like dd if=/dev/sdcard of=/dev/newemmc). If it fails and says the device is out of memory after 32GB, that's fine. Any other error is not fine.
    2. Use gparted to expand the root partition.
    3. fsck the partition.