I recently removed windows 10 from my pc, how can i merge the unallocated space with /dev/nvme0n1p5? There’s the boot partition between so i can’t just adjust one of them and merge with the other using the resize/move button. How can i do it?
Just move the boot to the left and merge
how can i do that?
Right click, resize/move.
To add on to this, don’t click the handles on the boot block, click and drag the entire boot block itself. You’ll be able to move the boot partition to the left, then you can extend your main partition.
i’ll try this as soon as i have the time to flash the live iso. Btw i think i already tried it many times but it didn’t work. I’ve even watched tutorials. It just does nothing
It shouldn’t do “nothing”
Just in case you’re confused: GParted will let you collect a bunch of operations and previes the result. Just clicking the move button doesn’t apply changes to disk; you need to review your changes and hit the green button in the top left to actually alter your disk. This allows you to move the boot partition to the left and extend your main partition without having to wait for a progress bar halfway through your operations. Moving the partitions will take a while, so if they fail quickly, you’ll get an error message at the very least.
I moved the boot parition successfully but i’m afrad that it’s gonna break my system somehow. Do i have to reinstall the grub? How? And by the way now that the two partitions are close together if i try to resize/move the “new Partition #1” i can’t expand it nor move it anywhere, same thing with /dev/nvme0n1p5
You shouldn’t need to reinstall Grub if the ESP partition is anything to go by; that indicates the presence of a UEFI system.
I don’t know what you mean by resize/moving “new partition 1”.
This is how I would approach your situation:
- Starting position (smaller, because VM)
Make special note of the UUID of the root partition (
3d55....
). Also write down the UUID of the boot partition (not depicted here).- Move the /boot/efi partition to the left
- Grow and move root
-
Apply changes
-
Check UUIDs
If any of the UUIDs changed, mount the root partition and edit
/etc/fstab
to update the new mount location. Then run whatever your distro uses to update the bootloader (update-grub
, or an invocation ofgrub-mkconfig
), initramfs (mkinitramfs
,mkinitcpio
,dracut
, or something else) to make the configuration stick.- Reboot
Here’s a short video of the resize process:
Resizing will take longer on your machine, of course.
Alternatively, you could use this opportunity to add encryption to your system. To do that, I would move the boot partition, create a new, encrypted root partition, mount both root partitions and copy over all the files (
rsync -av /mnt/old-root /mnt/new-root
), update the partition details as above but also configure/etc/crypttab
and add the necessary crypto boot modules (if they weren’t present on your system already). Then delete the old partition, extend the crypto container, extend the root partition, and you have yourself an encrypted-at-rest system. This process would add a whole bunch of potential breaking points so don’t do it if you don’t want to take the risk, but it would make your system more secure in the process.Thanks i will try this as soon as i can
Just to add to what @skullgiver@popplesburger.hilciferous.nl said, in case you break Grub, you might want to use Boot Repair on the live disk or something similar. Then you don’t have to deal with the terminal commands people have suggested to you.
That’s a good suggestion!
Yeah i already know that
It shouldn’t do “nothing”. Once you press apply, it’s possible you get error messages, but it shouldn’t say it’s complete and do nothing. That would be a big bug!
So, I’ve had it not work before, usually for odd reasons. One thing to try is to delete the other partition, then apply, then try to move it.
Resize/move is finicky though.
Boot on GParted ISO. Moving your boot may bork grub, so you would need to chroot and update it
This might be possible by booting to a live disk and using gparted etc.
Don’t attempt to do anything while you’re using the Linux partition. That’s like trying to work on a car while it’s running.
Yeah, it’s not like gparted lets me to that by the way. If i want to make changes i need to boot into a live environment
Most filesystems only support extending themselves with space at the end of their partition. However in this case since the unallocated space is larger than the actual partition you should be able to just copy the existing partition to the start of the disk, then extend the partition and grow the filesystem. I haven’t done this before and always take backups, but you should be able to do something like:
- Make a new boot partition.
- Copy the raw boot partition data from the old partition to the new one.
- Delete the old boot partition.
- Create a new root partition.
- Copy the root partition data to the new partition.
- Delete the old root partition.
- Use the empty space to extend the root partition.
- Extend the root file system to take up the whole partition (
resize2fs
).
Since you are never overwriting data in any step this should be fairly safe. If you are cautious you should be able to boot up the system between every step to make sure that it is still working and you haven’t lost data before overwriting the old partitions.
Some gotchas are checking how your filesystems are discovered/mounted. You may need to update your boot configuration to reference the new partition ID or make sure that you use the same labels (depending on how you are referencing the root partition).
Backup and reinstall. Fiddling with partitions is a very easy way to brick a system.
Nah i won’t backup anything. I lost my soul trying to rice my ubuntu, no way i’m doing that
If you’re worried about messing anything up the safest option is to simply format the unused space and set it’s mount point to some directory of your choosing.
Another option I think would be to clone your boot partition to the beginning of the unallocated space, clone your root partition to the unallocated space after that, delete the old partitions, grow your root partition, and then reinstall and reconfigure your boot loader. All this should be done from a portable Linux install.
If I may ask, why not just format it normally and mount it to a directory in your system? Why does it need to be merged ?
If the outcome will be the same then good. How can i do that?
you can’t easily. you fucked up putting it there
Maybe you could by creating a new boot partition and then cloning the current one into that before deleting the original one and reconfiguring grub?
You could leave it unallocated and have your drive usably last for a very very long time. Just consider it a 256 gig drive.
yeah i know but i want to reclaim that unallocated space 'cause why not