TransWikia.com

Installing Windows 10 from Ubuntu 20.4, do I need to remove Ubuntu to install Windows? How?

Ask Ubuntu Asked by Tommaso D'Amico on December 16, 2020

I’m trying to install a Windows partition on my xps 13 laptop, it currently only has an Ubuntu 20.04 partition.
From guides I’ve been looking at Windows needs to be installed in the first partition to work. So I’m looking for a way to backup or move my current Ubuntu setup so that I can install windows and then reinstall ubuntu.

I’ve seen some guides online but nothing quite in the same fashion. Does anyone have experience in the matter? How can I get Windows 10 running on a dualboot with my current Ubuntu machine?

One Answer

Windows doesn't like to share and doesn't play nice with other OSes.

The "easy" way is to use a new drive or an NVME USB drive.

If you absolutely must use that drive without wiping its partition table (dd if=/dev/zero of=/dev/sda bs=512 count=100 will wipe it), you can try to arrange your partitions as follows, as from a stock XPS 13, before installation. You can of course skip the recovery partition. There's no guarantee that it will work, but it's worth a shot - IIRC I couldn't get the recovery installation to work, but it did work for me the last time I tried it on a different machine with the downloadable installation media.

$ sudo gdisk

GPT fdisk (gdisk) version 1.0.3

Type device filename, or press <Enter> to exit: /dev/sda
Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sda: 250069680 sectors, 119.2 GiB
Model: LITEON CV8-8E128
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 328435D2-72A8-4168-AB1E-13EC6E1E182B
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 250069646
Partitions will be aligned on 2048-sector boundaries
Total free space is 5130 sectors (2.5 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1023999   499.0 MiB   EF00  EFI system partition
   2         1024000         1286143   128.0 MiB   0C01  Microsoft reserved
   3         1286144        89128546   41.9 GiB    0700  Basic data partition
   4       248039424       250066943   990.0 MiB   2700  Recovery Partition
   5        89128960       248039423   75.8 GiB    8300  Linux

There are a bunch of utilities that you might find useful, such as ntfs-resize, resize2fs, grub-install and more.

But really, just do the USB NVME install. You can even clone it and run it on similar PC's. Although if the CPU or peripherals change, you'll need to reactivate it, or buy a new license.

The other option is to run it in a VM:

$ qemu-img create -f qcow2 win10.qc2 50G
$ sudo qemu-system-x86_64 -enable-kvm -m 4G  
   -drive file=win10.qc2,cache=none,format=qcow2,if=virtio 
   -vnc :1 -device usb-ehci -device usb-tablet  
   -netdev type=tap,id=n0,ifname=tap2  
   -device virtio-net-pci,mac=00:12:23:34:45:56,netdev=n0  
   -localtime -cpu host -monitor stdio -smp cores=1 -vga vmware 
   -cdrom win10cdorusb.img -boot d # keep this last line only for installation

In another terminal:

$ while sleep 1; do xtightvncviewer :1; done

Or you can use virt-admin, virt-manager, or any of the other GUI's such as virtualbox.

Answered by Dagelf on December 16, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP