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.

  • @[email protected]
    link
    fedilink
    7
    edit-2
    11 months ago

    You can just use `# cat /dev/your-disk > /dev/your-stick, no need for a (dd) scalpel there.

    If your system uses UUID’s in /etc/fstab, you have to change them to match the current partitions to have it bootable. lsblk -o+UUID is nice for that.

    • @[email protected]OP
      link
      fedilink
      211 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
        link
        4
        edit-2
        11 months ago

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

      • @[email protected]
        link
        fedilink
        2
        edit-2
        11 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.

        • @[email protected]OP
          link
          fedilink
          211 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?

          • @[email protected]
            link
            fedilink
            111 months ago

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