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.

  • zelifcam@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    6 days ago

    I’d use clonezilla

    E: It’s not that it can’t be done other ways, it’s just clonezilla will work and has worked for nearly 2 decades. Plus, it’s a nice tool to throw in the toolbox once you know how to use it.

    • InFerNo@lemmy.mlOP
      link
      fedilink
      arrow-up
      3
      ·
      6 days ago

      It’s not an active partition/disk I want to clone. Clonezilla seems like something I need to boot into?

  • Kazumara@discuss.tchncs.de
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    6 days 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

    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.

    • Ekky@sopuli.xyz
      link
      fedilink
      arrow-up
      1
      ·
      6 days ago

      This is the way!

      Way simpler than using any GUI tool or somehow recreating the partition and manually copying the files.

  • friend_of_satan@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    5 days ago

    If I understand the problem correctly it has a pretty simple solution that I have done before. Make a new partition on the destination and dd if=/dev/diskAsB of=/dev/diskXsY where A is the source disk and B is the source partition and X is the destination disk and Y is the destination partition. You may have to run fsck on the destination afterwards and maybe a gpt repair tool.

    Honestly though, since it’s an ext filesystem, if it were me I’d just mount the source and dest and rsync.

  • Rin@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    5 days 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.
  • avi2022@masto.ai
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    6 days ago

    @InFerNo if it’s not a boot drive, you can use gparted to copy the partition over - it’s copy and paste, literally. Then set flags using gparted as well. If it’s a boot drive you’ll need an additional step after to use boot-repair to fix the boot sector and load grub onto it.

    It’s really simpler than it sounds, I’ve used it a few times myself. You can also use an #Ubuntu iso to execute this process after booting from it to ensure the 16GB partition is not in use when trying to copy it.

    #Linux

  • Lucy :3@feddit.org
    link
    fedilink
    arrow-up
    1
    ·
    6 days ago

    Could be - just try it ig. And even if not, just create a new partition on the 32 GB disk and then dd it over.

      • azron@lemmy.ml
        link
        fedilink
        arrow-up
        1
        arrow-down
        1
        ·
        6 days ago

        Is the system Linux? If so, then yes you can. Rsync it on to the newly created device get the uiid and fix up the fstab and boot loader configs and you are back in business.