2

I have Dual Boot. I am currently running out of space on my Windows partition (/dev/nvme0n1p3). However, there is plenty of space on my Ubuntu partition (/dev/nvme0n1p6). Therefore, I would like to move 70 GB from Ubuntu to Windows.

Image of Partitions

How can I do this, in order to safely transfer free space to Windows? I already have Ubuntu on my USB, and I know that I should use GParted from it. But I do not know how to deal with GParted, moving to right/left the spaces and so on. I don't want to mesh it up. Thanks!

edualvarado
  • 123
  • 6
  • The safest for data would be to backup and/or copy personnel important data that is on Ubuntu to another drive. Will have to delete swap partition and then shrink Ubuntu partition from the left(this is very bad for data). The easy way is to delete Ubuntu, give windows some space and re install Ubuntu. Moving/resizing a partition on left side most times will at least making booting that partition iffy. Could think about an external drive and copying/moving data from windows to it. – crip659 Jul 21 '20 at 17:07
  • Is there really no way to resize without reinstalling, or is just for my case? I have seen other people asking for similar issues and they were able to do it using GParted. Is my case difference because of the position of the data? – edualvarado Jul 21 '20 at 18:21
  • Reinstalling in your case will just be easiest way, not the only way. Backup your data is the most important step. Swap partition will have to be deleted before adding space to windows. Resize Ubuntu with gparted from USB. Resize Windows with windows tools. Do not count on Ubuntu booting without some work, at least updating/installing grub from USB, having all data in place after is getting lucky, Backup. Most of the good stuff for a partition to boot and work is at front(left side) of a partition, back end(right side) is much safer to move/adjust for data. – crip659 Jul 21 '20 at 18:37
  • Can try shrinking Ubuntu partition from right and then moving Ubuntu partition to right and then free space should open up to windows right side to be added. – crip659 Jul 21 '20 at 18:39

2 Answers2

1

I would recommend making a backup of any important data on the Ubuntu partition, though all my experience with operations like this on partitions is more than 5 years old.

As you already mentioned this should be done while booting from a live disk. As far as I see GParted can move the start sector of a partition with the following steps: GParted - Moving Space Between Partitions.

As is mentioned over there, booting to the moved partition likely will stop working. They do however also have a section in the FAQ on fixing that: GParted Manual - Fixing GRUB boot problem.

jbvo
  • 11
0

It is risky, Sometimes I take an extra precaution (depending on how bad I want to keep the OS).
1.) In ubuntu, comment out your swap line in /etc/fstab
....or if youre already in the live disk, mount the ubuntu partition and go into /etc/fstab and comment swap.

In a live disk - unmount any mounted partitions
2.) I delete swap.
3.) Right click, shrink the ubuntu partition to the new size
4.) my extra precaution... if i have enough space on some other partition or maybe before starting the machine insert another drive, to make a backup of the partition as an .iso... dd if=/dev/nv**p6 of=/sparedisklocation/mypartition.iso bs=4m status=progress
5.) Decide how much swap you want to re-create
6.) Right click, Move "most" the unallocated space (minus swap size) next to the partition to be increased and grow the partition. (Your partitions in your example are fairly close to each other, other people may have to step through this process with each partition in between the source and target partitions)
7.) make a new partition for swap with your leftover unallocated space.
8.) Try it out
9.) Add your new swap location/UUID to your /etc/fstab... delete the old entry\

if all went to hell... and I can't boot into ubuntu:
FIRST - I would try to shrink a partition down to create a small 10g space or so !!!TO THE RIGHT OF THE PARTITION!!!!. Create a small 10g partition and install a minimal installation (don't create swap) on that partition and reboot. (on one occasion, the new small install found the other ubuntu and fixed whatever broke and made it available in the new boot menu) Then I booted into my original ubuntu, deleted the small ubuntu partition and reclaimed the space by growing my current partition... i think the gnome-disks application did that pretty easy. Then update-grub so that you can remove the entry for the small-ubuntu you created. This applies if you created the little "emergency ubuntu" from space that came from a linux partition, I dont know the procedure to reclaim inside of windows. You could always grow it back easily with gparted...
Another note, this is also a surprisingly fast repair and may be easier than trying to use/follow the mount/bind/chroot/install-grub/update-grub method with a live disk if you're not experienced with it.

If that was not an option I go to the backup, boot back into the live disk:

  1. re-create the same-sized partition in old ubuntu partition (i do this out of fear, probably unnecessary)
  2. then dd if=/sparedisklocation/mypartition.iso of=/dev/nv**p6(in your case) bs=4M status=progress. This copies your backed-up partition back into the partition space.
  3. Try to boot again ..... the comfort in this for me, is no matter what is going wrong, you have a copy of your partition... I have made copies of desktop computers like this and taken them on travel with me on my laptop for use, so it is usually pretty portable and will be found by other linux systems(via update-grub) if worst comes to worst
WU-TANG
  • 3,071