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.

  • smb@lemmy.ml
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    11 months ago

    you can copy your system live, but that would involve other tools than dd too.

    with dd when copying the whole device (instead of just partitions) everything gets cloned. This includes uuids, labes, lvm devices with the names of their lv and vg names and raid devices in case you have any. all of these (c|w)ould collide unless the original disk was taken out or either the new or old disks labrls uuids etc are previously to the boot changed to prevent collusions or accidently mounting/booting the original partitions. also if (!) you use device names i.e. in fstab, crypttab, scripts or such, like with the uuids things could break. also you might have to take action for your bios to actually boot from the stick. most people disable usb boot on notebooks for security reasons.

    using dd, cloning the full disk to the full stick, then removing the original disk + set bios boot setting might work out of the box, i’ld try that first as it takes only the effort to boot from another os to do the dd-copy offline (preventing filesystem damage while copying).

    a live copy could be done by cloning only the partition layout and bootloader, then setting up new filesystems (with new uuids) and new lvm group/volumes etc if any, copying original disk using rsync then (maybe “bind” mounting to separate partitions if needed), then adjusting boot config to match new uuids/labels. This could be done while running the system to be copied, but of course even running rsync twice might lack some updates of currently open files by sth like desktop programs or logfiles.

    Without knowing the exact setup, only limited answers can be given, but you have to make sure the boot process will work, so at least the boot loader (grub?) and its files will be needed, which -at least in the past and for old lilo/grub- could not reside at some position on the disk after some “high value” like some number GBs. if that limitation is still there, your new exact partition layout on the usb stick might be relevant for success, but try/error should give you the hints you need.

    you might use “language models” for getting hints, but they are language models, not friends, their “solution” might break your system and delete your data, and they are trained to say they are sorry afterwards, but the are’nt sorry, its just a sequenze of probabilities and words to them not more.

    So always only work on data that has been backed up and prooven to be suitable for you to recover everything you need from scratch, no matter if friends, language models or lemmy users assist you ;-)

    UPDATE: just learned that batocera is “designed” to be just copied to usb stick and run from there, so it will most likely already include everything you need. best is to follow their instructions how to create the usb stick to boot from. if you already have it running from partition, you most likely can copy your current data using rsync. but beware, if you have two copies with the same uuids (partition +usb) that might not work as expected.

  • ricecake@sh.itjust.works
    link
    fedilink
    arrow-up
    0
    ·
    11 months ago

    It might work, but probably not without a little tweaking.

    A lot of things will reference drive identifiers or drive path to know where to mount them. These things don’t get copied by dd.

    • Deckweiss@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      11 months ago

      huh?

      Isn’t it the other way around?

      I once cloned an nvme with dd and had to physically remove one of the two, because they had the same id and the bios couldn’t differentiate between them and would randomly boot into either the first or the second one, inconsistently.

      And removing either one would boot into an identical system with everything mounted and working. Which caused some confusion until I realized that the id was copied over.

      So unless you didn’t use the id in fstab, you should be fine. Sure the device path may differ, but that can happen anyway to usually devices should be referenced by id.

    • stewi@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      11 months ago

      dd’ing /dev/sdx will copy all IDs

      dd’ing /dev/sdx1 will keep UUID but PARTUUID will remain the same on the destination