Id like to take my old windows laptop drive and image it so I can still use it in virtual box. For reference its a win 7 install on the drive.

Can I do this only using dd, and making the image an iso, and it will boot? Seems too easy!

  • sylver_dragon@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    4 days ago

    What you are trying to do is called P2V, for Physical to Virtual. VMWare used to have tools specifically for this. I haven’t used them in a decade or more, but they likely still work. That should let you spin up the virtual system in VMWare Player (I’d test this before wiping the drive) and you can likely convert the resulting VM to other formats (e.g. VirtualBox). Again, test it out before wiping the drive, nothing sucks like discovering you lost data because you just had to rush things.

  • frongt@lemmy.zip
    link
    fedilink
    English
    arrow-up
    2
    ·
    4 days ago

    Yes, you can, though it’s not an ISO 9660 format like a cd image, it’s just a raw binary disk image. You’ll need to do something like this: https://superuser.com/a/890806

    But virtualbox also comes with tools that will convert to vdi for you: https://docs.oracle.com/en/virtualization/virtualbox/6.0/user/vboxmanage-convertfromraw.html That talks about files, like you’d make with dd, but in linux a block device is already a file!

  • lurch (he/him)@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    2
    ·
    5 days ago

    why an iso? it should be the VMs main drive. iso’s aren’t writable. iso implies the file system for an optical drive.

    however, it’s possible you’ll run into licensing issues.

    • bridgeenjoyer@sh.itjust.worksOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      5 days ago

      Ah I see. I’m not actually certain what kind of file dd makes of drives (is it just .img?) I have only used it for optical discs in the past.

      Is it even possible to make the drive image bootable in virtualbox then?

      • lurch (he/him)@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 days ago

        dd just copies raw data. you can name it however you want. it’s not a specific format. but some file managers will react to the file extension. so if you name it .mpg they will try to launch a media player and .iso will make them think you want to burn it to a CD/DVD.

        What you may want to do is convert it to a Virtualbox Disk Image (.vdi) like so:

        VBoxManage convertfromraw <inputfile> <outputfile>.vdi --format= VDI
        #or
        VBoxManage internalcommands converthd -srcformat RAW -dstformat VDI <inputfile> <outputfile>.vdi
        #or
        VBoxManage convertdd <inputfile> <outputfile>.vdi --format VDI
        

        Also, on Linux there is a command literally called file and it will quickly probe files for what type they are. For raw disk images it will often say things like boot record or file system, because that’s what’s at the start.

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

    Don’t try to make an iso out of it, it won’t work. Depending on your hypervisor you can either pass the drive through to the VM directly or dd it to a raw disk file and attach it that way. You may have to do some conversion to make it work with your hypervisor. KVM and virtual box should work with the raw file, or you can convert to one of their native formats. VMWare will need conversion to a vmdk file to attach it.