I had multiple disks in my PC, one with Windows and one with Linux. The drive with Linux had the boot record I guess; I removed and replaced that one with a new disk and again installed Linux on it (so the Windows disk has been the same the while time), but I can no longer log into Windows while this new disk is installed and the old disk is removed. I can log into Linux while the new disk is installed, and if I swap back to the old disk I can log into Windows.

How do I fix things so I can not into Windows or new Linux while the new disk is installed? I don’t mind reinstalling my Linux OS, but I really don’t want to reinstall Windows.

  • Skull giver@popplesburger.hilciferous.nl
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    1 year ago

    It’s possible Windows installed its bootloader and boot partition onto the drive you removed.

    Assuming the rest of your system is on the drive you didn’t swap out, you can try copying the Windows boot sector byte for byte from the swapped out disk to a partition on the new disk. Make sure to also set the necessary partition flags. Then you can probably boot a Windows installer and use the common boot fixes (fixboot.exe and friends).

    Assuming you have a modern Windows system, you also need to make sure the UEFI partition (a FAT32 partition that contains a file path something like /EFI/grub/grubx64.efi) also contains the Windows bootloader.

    On a single disk you would end up with something like this:

    Disk name Partition 1 Partition 2 Partition 3
    /dev/disk/by-diskseq/1 UEFI (a few GB, FAT32) Windows partition (hundreds of GBs) Windows boot partition (±300MB)
    /dev/disk/by-diskseq/2 Linux boot partition (1-2GB) Linux swap partition (same size as your RAM) Linux partition (hundreds of GBs)

    Your Linux layout will depend on your settings. If you use LVM, all partitions are probably virtual partitions within one large partition. One or more may be wrapped inside an encrypted partition as well.

    • svenjoypro@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Thanks for the response.

      you can try copying the Windows boot sector byte for byte from the swapped out disk to a partition on the new disk

      How would I go about doing this? Macrium Reflect?

      • Skull giver@popplesburger.hilciferous.nl
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        1 year ago

        On Linux my go to tool for resizing and creating partitions is GParted, with some help from command line tools like dd to copy the data over.

        Gnome’s disk utility GUI has the option to create a disk image from a partition that you can later restore.

        If you want to do a direct copy, without a temporary copy somewhere, I only know the terminal command line:

        dd if=/dev/disk/by-id/ata-Samsung_SSD_850_EVO_250GB_S21PNXAG803885Y-part1 of=/dev/disk/by-id/wwn-0x5002538d403dda0c-part3 statusprogress bs=8m
        

        This would make a direct, byte for byte copy from the first partition of my Samsung SSD to the third partition of my Crucial SSD. Other ways of addressing the disk also exist (i.e. /dev/sda3 to /dev/sdb1, or in the other ways you can refer to a disk or partition somewhere in /dev/disk).

        I’m sure there are Windows based tools that can do the same, I don’t have experience with many of them. Last time I had to mess with this type of disk partitioning for Windows installs I think I used a tool called EaseUS?