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?

  • kevincox@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    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).

  • Floey@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    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.

    • Gush@lemmy.mlOP
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

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