Would this work or would I have problems:

Using dd command to backup an entire SSD containing dual boot Windows/Ubuntu partitions into an .iso file, with the intent to then dd that iso back onto the same size SSD in the case of a drive failure?

  • just_another_person@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    As long as it’s not a mounted and running live system, it should work. Not the most efficient way to do such a thing, but I would think it should work.

  • bloodfart@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    Yes. Make sure neither are mounted.

    Use larger block sizes with bs=<like, idk, 16M> will make it go faster.

  • BrightCandle@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    I have done this a few times, so long as the drive isn’t mounted it works fine.

    One advantage of this approach compared to clonezilla is you can pipe it through netcat or similar and move it to another machine. You can also first pipe it through gzip as well to save on the transfer bytes a bit as well and then on the other end just store the compressed image or unzip it. Combine a few tools together and you have quite a lot of capability for complete image backups but its usually best done for the boot drives from a live USB.

  • wagesj45@kbin.run
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    Would this work

    Yes.

    or would I have problems

    Also yes.

    I used to do this backing up my “servers”. By that I mean some Raspberry Pis and random old PCs running Debian. I even did so successfully when needing to restore the images. But it was fragile and also failed at times, sometimes to great inconvenience when it was a machine serving something important.

    I’ve since moved to a different backup strategy for servers, but if I were to do this with a bare-metal machine I want to preserve, I’d use something like Clonezilla. The maintainers of that project know a whole heck of a lot more than I do of the ins and outs of disk management, backup, and restoration than I do with my simple dd commands. If it is something you’re just wanting to do for fun and experience, dd can work. If you’re concerned with the security of your data/image, I’d use Clonezilla.

    • scrion@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      Honestly, that just seems like you’re treating dd as some kind of arcanum. dd works just fine and I’ve been doing 1:1, full system backups for decades with it, no issues. Honorary mention for ddrescue / dd_rescue for recovery options, i. e. re-trying bad sector reads etc.

      In fact, when Clonezilla doesn’t know your filesystem, it will simply employ dd to copy the data sector by sector.

      I’d argue that Clonezilla (due to its use of partclone) is actually a less complete form of backup, since it will only copy used blocks, you don’t really end up with a clone of your devices, just a copy of what partclone believes to be your data. Don’t get me wrong, that is fine in most use cases, but there are some cases where this doesn’t cut it, e. g. wanting to backup / restore a storage device from a PLC where the vendor had the glorious idea to store licensing data in unused sectors, or when you want to create a forensic disk image, might want it look into d3dd then, although it absolutely works using regular old dd as well, d3dd just adds some amenities.

      All I want to say is: dd is an absolutely reliable tool and can be a one stop solution for device backups. Also, I have absolutely no quarrels with Clonezilla, if it fits what you’re trying to do and it works, great.

      • 🧟‍♂️ Cadaver@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        3 months ago

        If you dd a 1TB hard drive, it will create a 1TB image. You’d need to have a >1TB drive to store it. If you dd each partition separately, this won’t be the case.

        Plus it will be easier to discriminate between different FS and mount them accordingly.

  • nikaaa@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    It would technically work, yes.

    But also, you’re wasting a lot of storage space that way, especially if you do it often. You really only should backup your home directory, it contains all your data. You can simply re-install the rest from the internet.

  • electric_nan@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    This will definitely work. I did this recently when upgrading a Steam Deck to a bigger drive. Other suggestions below are probably faster though.

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

    Many years ago I tried it, but didn’t really read up on it. Wanted to back up my Pi’s sdcard while the system was running. I even fucking named that script “online-backup”.

    Now every time I ran that, after hours, I noticed my Pi was crashing, and never booted back up. I used chinese sd cards so I blamed it on them.

    But this happened multiple times, just to learn I was using dd absolutely wrong.

    dd was always a scary utility to me, and still is. I fucked up things with dd, regardless I quadruple checked everything 😅

    but to answer the question; it’s possible, but you really need to know what are you doing.

  • Nibodhika@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    Don’t do this. If you have a 1TB drive with only 10GB being occupied, your image will be 1TB, and you will need a >1TB drive to store it, and another to restore it.

    If you only backup the data you could do it in a much smaller size drive and it will be a lot faster to perform backups (otherwise you will need hours every time you want to create a new image).

  • Nine@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    Like everyone has said there’s way better ways of doing it.

    HOWEVER if you wanted to use dd you totally could. I’d recommend piping into something like gzip/zstd to save some space though.

    dd if=/dev/sda | gzip >/mnt/backup_disk/sda.gz

    You could also use restic backup the raw block device too.

    That being said, clonezilla is exactly what you want