Can I just use dd to clone my laptop to a bootable USB stick? - eviltoast

I know about Clonezilla and copy pasting partitions with gparted, but can I just use dd to copy a partition with batocera to a USB stick and will it then boot from the stick? Do I have to set the boot flag or take any other steps?

Thank you for any tips.

  • bartolomeo@suppo.fiOP
    link
    fedilink
    arrow-up
    2
    ·
    9 months ago

    Ok, thanks. That sounds pretty good.

    If i want to compress it and save it as a backup can I do

    cat /dev/sda3 | gzip -9 > drive.img.gz

    ?

    • kuneho@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      edit-2
      9 months ago

      fill up the remaining space on the drive completely with 0s with a dummy file you delete then, before gzipping

    • MonkderZweite@feddit.ch
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      9 months ago

      Yes, but like @kuneho said, since “deleted” stuff only is marked as deleted (not wiped), there’s always a bunch of random on the “empty” space part of a disk, which compresses badly.

      Do cat /dev/zero > /path/to/mounted/partition/zeroes and delete it after cat errored out because no space, to fill the “empty” space with zeroes.

      • bartolomeo@suppo.fiOP
        link
        fedilink
        arrow-up
        2
        ·
        9 months ago

        That worked really well! I got a 50gb partition with about 30gb free space into a 10gb zipped image. Is there any way to show progress during the operation like with dd’s status=progress?

        • MonkderZweite@feddit.ch
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          9 months ago

          I often use pv instead of cat for this. And there’s some ‘hack’ where some tool looks at some kernel feature to guess progress of cp & co. But i forgot it’s name.