How to merge win10 from dual boot into root?

Hello,
I’ve got a dual boot with win10. For my root partition is full all the time I want to delete the win partition, thus creating a ‘single boot’. How do I do this with the KDE Partition Manager in my situation?

I’m afraid you cannot do this non-destructively without messing with lvm2, and if you are new to GNU/Linux, then you definitely don’t want to go there. :wink:

However, what you can do is repurpose the Windows partition. And here’s how you do it…

< insert scary music here > :fearful:

:stuck_out_tongue: :popcorn:

Reformat your Windows partition with ext4 ─ you can do this by way of the partitioning tool. Then, use lsblk in a terminal window to find out the UUID of the newly formatted partition.

lsblk

Write down the UUID on a piece of paper…

… and keep in mind that GNU/Linux is case-sensitive. Make sure you get it all correctly!

Next, log out of your GUI environment completely.

When the login screen reappears, press Ctrl+Alt+F3 to switch to a tty. Log in as yourself at the character-mode login prompt. Now issue the following command… :arrow_down:

sudo systemctl isolate rescue.target

You will now be prompted to either enter the root password or press Ctrl+D to return. Enter the root password.

Note: Depending on what you chose when you installed the system, this may or may not be the same as your sudo password. If it is different, then the root password is what you need, not the sudo password.

After entering the root password, you are now in single-user maintenance mode, as the root user. Now issue the following command to temporarily mount the new partition into the tree… :arrow_down:

mount -t ext4 /dev/nvme0n1p4 /mnt

Next, we’re going to copy over the entire content of /usr into the new partition. :arrow_down:

cp -RPpv /usr/* /mnt/

This is going to take some time, so sit back and let it finish. When it is done and the command prompt returns, verify that everything has been copied over correctly. Normally everything should have worked. :arrow_down:

ls -l /mnt | less

Press q to exit the pager.

Next, you need to modify /etc/mkinitcpio.conf. :arrow_down:

nano /etc/mkinitcpio.conf

Look for the line that starts with HOOKS=. Insert the word usr behind the word udev, with proper spacing, so that it reads something like…

HOOKS=(base udev usr autodetect modconf block keyboard keytable filesystems shutdown fsck)

… or similar enough to that. Remember, you only need to add the word usr, as well as ─ at the end of the list of hooks ─ the words shutdown and fsck.

Save the file with Ctrl+O and exit the editor with Ctrl+X. Now rebuild your initramfs:arrow_down:

mkinitcpio -P

Now, you must edit /etc/fstab. We’ll use nano again as the editor. Grab the piece of paper that you wrote that UUID on earlier, and add a blank line underneath the line for your root filesystem, with the following content… :arrow_down:

UUID=the-UUID-that-you-wrote-down  /usr  ext4  auto,ssd,noatime,defaults  0   0

If the mount options on your root partition differ from the mount options that I’ve given you here-above, then it’s safe to use those same mount options on the new partition as well. I’m only giving you a couple of generic ones for ext4 on a solid-state drive, but you may have additional ones for your root filesystem, and in that case they should be fine for use on the new /usr partition as well . :wink:

When you’re done, save the file and exit the editor ─ you already know how to do that: Ctrl+O and Ctrl+X.

Now you can finish up, but you need to take a few extra steps in order to do it all cleanly. Enter the following commands, but only if everything you did so far was successful. :arrow_down:

PATH=${PATH}:/mnt/bin
rm -rf /usr/*
update-grub
sync
systemctl reboot

Cross your fingers, but if you did everything right, then your system will come up fine again, and then your former Windows partition will now be mounted as /usr, while all of the space that /usr used to take up when it was still on the root filesystem will now be available again. :wink:

If everything went as planned, then you can pat yourself on the back for having pulled off a courageous maneuver, and for having done so without needing to chroot from the live session of the install CD/USB. But never forget this very important advice from one of my fellow Middle-Earthers… :arrow_down:

Gollum_Backupses

4 Likes

Aragorn, thanks for these very detailed instructions. I will try this during the weekend and tell you about the results!

I’ve marked this answer as the solution to your question as it is by far the best answer you’ll get.

However, if you disagree with my choice, please feel free to take any other answer as the solution to your question or even remove the solution altogether: You are in control! (If you disagree with my choice, just send me a personal message and explain why I shouldn’t have done this or :heart: or :+1: if you agree)

:innocent:
P.S. In the future, please don’t forget to come back to your question after your issue has been solved and click the 3 dots below the answer to mark a solution like this below the answer that helped you most:
Solution
so that the next person that has the exact same problem you just had will benefit from your post as well as your question will now be in the “solved” status.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.