this post was submitted on 10 Sep 2023
45 points (97.9% liked)

Linux

48375 readers
1629 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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?

all 27 comments
sorted by: hot top controversial new old
[–] [email protected] 16 points 1 year ago (1 children)

Just move the boot to the left and merge

[–] [email protected] 9 points 1 year ago (1 children)
[–] [email protected] 13 points 1 year ago (2 children)
[–] [email protected] 10 points 1 year ago

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.

[–] [email protected] 3 points 1 year ago (3 children)

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

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago) (2 children)

[This comment has been deleted by an automated system]

[–] [email protected] 2 points 1 year ago (2 children)

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

[–] [email protected] 4 points 1 year ago (1 children)

Just to add to what @[email protected] 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.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

[This comment has been deleted by an automated system]

[–] [email protected] 1 points 1 year ago

Yeah i already know that

[–] [email protected] 1 points 1 year ago

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.

[–] [email protected] 1 points 1 year ago

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!

[–] [email protected] 10 points 1 year ago (1 children)

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.

[–] [email protected] 3 points 1 year ago

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

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago)

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:

  1. Make a new boot partition.
  2. Copy the raw boot partition data from the old partition to the new one.
  3. Delete the old boot partition.
  4. Create a new root partition.
  5. Copy the root partition data to the new partition.
  6. Delete the old root partition.
  7. Use the empty space to extend the root partition.
  8. 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).

[–] [email protected] 2 points 1 year ago (1 children)

Backup and reinstall. Fiddling with partitions is a very easy way to brick a system.

[–] [email protected] 2 points 1 year ago

Nah i won't backup anything. I lost my soul trying to rice my ubuntu, no way i'm doing that

[–] sun_is_ra 1 points 1 year ago (1 children)

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 ?

[–] [email protected] 1 points 1 year ago (1 children)

If the outcome will be the same then good. How can i do that?

[–] MaliciousKebab 1 points 1 year ago

Just create a new partition, then in your home folder or somewhere else idk, create a folder and choose that as mount point.

[–] [email protected] 1 points 1 year ago

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.

[–] [email protected] -4 points 1 year ago (1 children)

you can't easily. you fucked up putting it there

[–] [email protected] 1 points 1 year ago

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?