1

(pre-dual boot on single drive) Bought new SSD, how to partition it to allocate space to both Linux and Windows?

Current Specs: 512GB SSD pre-installed in laptop. Running Dual Boot with Win11 and Debian. Win11 has ~380GB and Debian has ~120GB.

Installed a new 500GB SSD today since linux was maxing out.

Desired output - have ~500GB each for both my OS

Option 1 (i heard this is a less encouraged option)

  • partition the new drive, divide it into two and allocate ~200GB to each win11 and debian

Option 2

  • Go for one-drive-one-OS. This means moving over all my linux data into the new drive, as-it-is, preserving everything.
  • Reclaiming the pre-installed/older SSDs full space in Win11

For either of the options, i am nearly not as experienced to pull it off without messing anything up. Please help in whatever way you can!

This is my drive details as pulled from df -h

╰─ df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.7G 0 7.7G 0% /dev
tmpfs 1.6G 2.5M 1.6G 1% /run
/dev/nvme0n1p7 23G 17G 5.5G 75% /
tmpfs 7.7G 117M 7.6G 2% /dev/shm
tmpfs 5.0M 12K 5.0M 1% /run/lock
/dev/nvme0n1p11 104G 73G 27G 74% /home
/dev/nvme0n1p10 1.6G 16M 1.5G 2% /tmp
/dev/nvme0n1p8 9.1G 4.0G 4.6G 47% /var
/dev/nvme0n1p1 256M 66M 191M 26% /boot/efi
tmpfs 1.6G 96K 1.6G 1% /run/user/1000

This is output from lsblk

╰─ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 476.9G 0 disk
├─nvme0n1p1 259:1 0 260M 0 part /boot/efi
├─nvme0n1p2 259:2 0 16M 0 part
├─nvme0n1p3 259:3 0 202.2G 0 part
├─nvme0n1p4 259:4 0 29.3G 0 part
├─nvme0n1p5 259:5 0 103.2G 0 part
├─nvme0n1p6 259:6 0 1G 0 part
├─nvme0n1p7 259:7 0 23.3G 0 part /
├─nvme0n1p8 259:8 0 9.3G 0 part /var
├─nvme0n1p9 259:9 0 977M 0 part [SWAP]
├─nvme0n1p10 259:10 0 1.6G 0 part /tmp
└─nvme0n1p11 259:11 0 105.8G 0 part /home
nvme1n1 259:12 0 476.9G 0 disk

Couldn't find solutions for scenarios similar to mine online, and too afraid to completly rely on AI for this kindof stuff, I don't wanna hear the typical "Oh you're right, I'm sorry I overlooked XYZ, your data is all gone but I can help you setup your system fresh!"

Thank you in advance

cas
83k8 gold badges134 silver badges203 bronze badges
asked Aug 16 at 15:50
1
  • 1
    If both drives are SSD or NVMe, I would suggest one drive, one install. Or if faster drive and you primarily use one install, put it on faster drive. If installing Windows, it wants so many partitions, best to install it first & let it choose partitions. For Linux. I always suggest new clean install & restore from backup. Then good test of backup while you still have old drive's data. I prefer larger / and only separate data partition for most data normally in /home. Your swap seems a bit small, most suggest 4+GB. Commented Aug 16 at 18:40

1 Answer 1

2

Option 2 (one drive per OS) is the best option. IMO, the only option worth considering.

The easiest way would be to download the GParted Live USB image, write it to a flash drive and then reboot to that. Then:

  1. Make complete backups of all of your Linux and Windows filesystems.

    I really should have said this when I first wrote my answer. Better late than never.

    Any time you're changing your partition tables is an opportunity for user error or hardware problems or power outages or whatever to destroy all your data. Hopefully you won't need to actually use the backups, but to avoid any regrets, make a backup before doing anything.

  2. Clone the entire nvme0n1 drive to nvme1n1 - it's only 512GB so shouldn't take too long. e.g. with dd:

    dd if=/dev/nvme0n1 of=/dev/nvme1n1
    
  3. Randomise the PARTUUIDs on the clone:

    sgdisk --randomize-guids /dev/nvme1n1
    

    Note: this will randomise the UUIDs of the partitions themselves, not the UUIDs of filesystems on the partitions.

  4. You may need to run partx (as root) or reboot to get the kernel to recognise the newly cloned partitions on nvme1n1. If you have to reboot, make sure you reboot back in to the GParted Live USB. Otherwise just continue on to the next step.

  5. Using the gparted GUI partitioning program, delete the Windows partitions on nvme1n1 and move and resize the Linux partitions as needed.

  6. Use gparted again to delete the Linux partitions on nvme0n1, and move and/or resize the Windows partitions.

You should now have Windows on the original drive and Linux on the new drive. Linux has no problem with being moved around (and you won't even have to edit /etc/fstab because the cloned partitions will have the same filesystem UUIDs), but Windows can be very temperamental about being moved (it can assume that any change to the underlying hardware is proof of wicked piracy. because windows is anti-consumer garbage)

  1. From a root shell, update grub's configuration.

    This step is optional if grub is configured to use the /boot and root filesystems' UUIDs (which is the default these days).

mount /dev/nvme1n1p7 /mnt
# If you have a separate /boot partition, mount it now as
# /mnt/boot **before** mounting /mnt/boot/efi
mount /dev/nvme0n1p1 /mnt/boot/efi
# You can probably skip mounting var, tmp, and home but it
# doesn't hurt to mount them.
mount /dev/nvme1n1p8 /mnt/var
mount /dev/nvme1n1p10 /mnt/tmp
mount /dev/nvme1n1p11 /mnt/home
# bind-mount the various dirs required in the /mnt chroot by grub 
for d in proc dev sys /sys/firmware/efi/efivars dev/pts ; do
 mount -o bind /$i /mnt/$i ;
done
chroot /mnt
update-grub
exit

You should now be able to reboot into either Linux or Windows, each running on their own separate drive.

BTW, you'll have two EFI partitions now. You can either keep them separate (and they'll eventually get out of sync), or you can make an mdadm raid-1 device out of them as long as you use mdadm metadata version 1.0.

See, for example: RAID 1 of /boot/efi partition on Debian


BTW, do you really need a separate /tmp partition? If you have enough ram, you're probably better off just using a tmpfs for /tmp - it'll be faster and avoid some wear and tear on the nvme drive.

And do you need separate /home and /var partitions? A long time ago in the dim dark ages of the 1990s it was recommended to have separate partitions for everything. These days, it's more common to just have one big / partition, mostly because people got sick and tired of running out of space on / when there was lots of free space on /home.

IMO the only time it's worth the hassle of having them separate these days if you are running ZFS or btrfs which can share all the available space from the pool amongst all the datasets (or "sub-volumes" in btrfs terminology). Or maybe LVM, which at least makes it easy to resize partitions.

If you don't have a specific reason for having them separate, I suggest moving swap to just after the EFI partition, and increase it to 4GB or more. Then move / to immediately after swap and expand it to take all the space between / and /var.

Then copy everything from the var and home partitions to /var and /home subdirs of the / partition, delete the var, tmp, and home partitions, and expand / again to take up all available space.

Don't forget to edit /etc/fstab to match the new partitioning scheme.

All of this should be done from the GParted Live USB.

answered Aug 17 at 4:31
3
  • Although I'm not entirely sure, I think there's at least a chance moving the filesystem/partition which consists of /boot/grub to an another disk would break grub. By that I mean you'd need to re-install grub (instead of regenerating grub.cfg). (It probably won't happen if the OP makes the UEFI firmware loads grub from the ESP of the new drive though, but in that case I think he better remove EFI/Microsoft from it and make sure the grub menu entry for Windows chainloads WBM from the ESP on the old drive, if that's how he choose among them.) Commented Aug 17 at 15:00
  • Also, it's probably worth mentioning that grub on the new ESP won't be registered to the UEFI firmware (and even if Debian's grub has duplicate EFI executable at the fallback path, it's has likely been overwritten with WBM's). So to make the firmware loads grub from the new/cloned ESP, the OP would either need to register the executable manually with efibootmgr, or re-install grub. Commented Aug 17 at 15:09
  • Depends on the BIOS, I guess. All modern UEFI bioses that I've seen scan all EFI partitions and can boot from any appropriate executable whether they're registered or not. I can't remember ever having to run efibootmgr -c. Running grub-install wouldn't hurt, but probably isn't necessary. Feel free to add a step 7 if you think it would be useful. As for windows monopolising the EFI partition by helpfully deleting non-windows boot loaders, that's a good reason not to make them an mdadm RAID-1...even if Windows trashes one of the EFI partitions, the second should still be OK to boot with. Commented Aug 17 at 15:38

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.