0

I have a laptop (ASUS harman/kardon) that has two drives, a small SSD, and 1TB HDD. It came with Windows installed on the SSD, and I installed linux on the HDD.

Since I almost exclusively use the linux partition, is there any way to simply switch the linux partition over to the other drive and put Windows on the HDD (I don't want to lose my windows license).

I would like to keep the linux image how it is, I'm fine if I have to restore windows from scratch.

I understand that I may need extra space, and I have a large enough external drive to accommodate both partitions.

So is it possible to swap linux to the SSD and Windows to the HDD without having to start over on both?

Attempt 1

I shrank the linux partition on the HDD to make room for a windows partition. I then created a windows install disk to install Windows on the HDD. Unfortunately, this install disk picks up the other Windows install. It also only gives me an "Install now" button, which is very useless as I have no clue where it will install.

Looks like I have to physically remove the SSD, save my linux stuff from the HDD somewhere else, and then run the windows install and let it take control (because what kind of user needs control of the operating system anyways?). Any other ideas? Is there a way to force Windows to install somewhere specific?

Update

I made a partition on the HDD and managed to install windows on it. I then reformatted the SSD (leaving the boot partition intact) and used rsync (from the linked question) to copy all the data from the old drive to the new drive.

I then ran sudo grub-install <SSD>, but on boot, grub picks up only the installation on the HDD (and also windows boot manager, which it always has). Am I missing a step? Do I somehow need to run grub-install when booted from the new 'install'? If so, how do I boot from it?

Edit: Looks like I need to chroot to the new 'install'. However, when doing this, I lose the disk (/dev/nvme0n1) that I want to install grub onto. Is there a way to set up grub so that when it boots and this disk exists (I know it will), it will work?

5
  • For the Linux part, see this question, or this one. I'm less familiar with doing this sort of thing with Windows, though. Also, you must be very aware of your boot mode (BIOS/CSM/legacy vs. EFI/UEFI), since you may need to adjust boot loader setups appropriately.
    – Rod Smith
    Jun 21, 2017 at 13:05
  • for what it's worth, you'll find your windows licence is tied to the machine, not the HDD... so you won't lose it by moving the HDD.
    – Stese
    Jun 21, 2017 at 15:50
  • That's good news. It still looks like I have to physically remove the SSD from my machine in order to do it, which is a little unfortunate Jun 21, 2017 at 15:56
  • Could you not just create a VM on the Windows machine and then load the Linux image onto it? Sure this means you have no issues with licenses and both get to use the SSD.
    – Lelantos
    Jun 29, 2017 at 16:26
  • @DavidGolding I could, however windows makes me very angry sometimes so I'd like to only have to boot into it when I absolutely need to use Windows. Jun 29, 2017 at 16:55

1 Answer 1

0

So I finally managed to do this, and it definitely took a lot of work but it's done and it seems to be running fine (and much faster). The only thing left is to deal with swap, which is still on the HDD.

Step 1:

Make a linux live disk, boot into it and shrink the HDD to leave enough room for a Windows install (Don't worry about exact sizing as the partitions will eventually be resized). I used a linux live disk because I like gparted, and I couldn't do it with my running linux system since that drive was mounted and couldn't be resized.

Note - You can't move the windows partition after you install Windows. I made the assumption that you could. This means that if the linux partition is at the beginning of the HDD (as I had it), that space ends up wasted. I recommend moving everything to the end of the drive, and then putting the windows partition at the beginning, as it can always be expanded (this takes quite a bit of time, however)

Step 2:

Make a Windows boot disk - can be done on the windows site. Ideally, this would be on a second flash drive since when (not if) something goes awry and you have to start over, you don't have to make a new linux disk.

Step 3:

Install windows, click the "Install Now" and then go through until it lets you pick a partition, pick the partition you created when resizing the HDD(it doesn't even have to be formatted, windows will do its thing with free space on a drive). Let windows do its thing. When you log into the new windows install for the first time, it will verify the license key.

Step 4:

Copy everything you want from the original windows install.

Step 5:

Boot back into linux from your live disk (not the one installed on the HDD). Destroy the SSD and make an ext4 partition. Make sure not to touch the FAT32 partition at the beginning, this is the boot partition and it's important.

Step 6:

rsync everything over to the new drive. This involves mounting the old disk and new disk and syncing everything over (some things may fail, like /proc/devices, that's fine, but make sure you're root). This looks like:

mount /dev/sda2 oldDisk/ #the existing linux partition
mount /dev/nvme0n1p2 newDisk/ #The new, empty partition on SSD
rsync -avz oldDisk/ newDisk

Step 7:

Boot back into your original linux install (this may work on the live flash drive as well).

mount /dev/nvme0n1p2 /mnt #Mount the new drive somewhere
mount --bind /dev /mnt/dev/
grub-install --boot-device=/mnt /dev/nvme0n1 #note this is the whole device, not just the patition (akin to /dev/sda)
update-grub #so the new stuff is picked up.

This is outlined here.

That should be everything. I've since cleaned up the linux install. Windows boot manager looks like it's finally happy with itself (I guess a few reboot cycles is all it takes).

It leaves around the old linux install, which I've yet to clean up. I also don't know how to clean up the windows boot manager because that also got a little messed up with the missing windows installs, but at least it boots.

2
  • I feel this is a solution to a problem that doesn't exist. VM solved this years ago and is far easier to deal with should your linux system crash.
    – Lelantos
    Jul 4, 2017 at 15:22
  • A dedicated Linux system and a Linux VM running on windows are very different things. For example - how does networking work? Do I have to go to Windows and deal with the firewall on top of making Linux changes? Also, Windows took up 118 of the 128gb SSD, leaving little room for a Linux VM. Jul 4, 2017 at 16:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .