Jump to content

Changing structure of partitions on drive without affecting Linux installation

Go to solution Solved by Guest,

You got EFI installed. Basically grub is installed into the EFI system partiton, unless you delete it there is no change for breaking grub.
I would however suggest you to chroot into the only Linux distro you like, then running again grub-install and update-grub just for clearing others grub entries
This requires (In case you are on a USB live)

  • mount /dev/sdaX /mnt where sdaX is your Linux install you wish to keep
  • mount -t proc proc /mnt/proc
  • mount --rbind /sys  /mnt/sys
  • mount --rbind /dev /mnt/dev
  • chroot /mnt
  • mount /dev/sdaY /boot/efi where sdaY is your fat32 efi partition

Then do, grub-install

then update-grub (or grub-mkconfig -o /boot/grub/grub.cfg)

 

You may want to re-run update-grub into your working linux system if you don't find all the grub entries (like Windows)

I am wondering as to how I would easily modify the following partitions without disrupting my current Linux installation located on sda5. 

image.png.1b9db2f25d18b26728a7318a9755d89b.png

sda4 is my old Ubuntu 18.04 installation that is kinda dead, and sda3 is the original windows 10 installation, with its ugly sda2. I wish to remove sda2, sda3, and sda4 while keeping sda5 intact without breaking grub as I would still like to boot this laptop, as it is my main laptop. However knowing my luck, I would probably end up fucking everything up if I blindly changed partitions around, so that is why im asking for help as to how I would go about doing this, I already have u bootable Gparted USB I can use for changing the partitions without having to worry about sda5 currently being mounted as it should be booting off of sdb at that time. Also I would not recommend using Ubuntu as it is quite unstable when compared to other distros.

Also could somebody please tell me why sda5 is before sda4.

 

Also a quick edit:

   If i had to modify entries in grub, how would i go about doing that?

Edited by Shoe_Eater
more questions are always needed

Sadness is the one true emotion, and happiness, well, that's just a lie, sadness is all many of us feel, and is all we need to feel, because having it any other way, would just be wrong, why be happy when you can just be miserable like myself. 

Link to comment
Share on other sites

Link to post
Share on other sites

Simply delete all the partitions you want to then from terminal issue

 

Sudo Update-grub

Main Rig:-

Ryzen 7 3800X | Asus ROG Strix X570-F Gaming | 16GB Team Group Dark Pro 3600Mhz | Corsair MP600 1TB PCIe Gen 4 | Sapphire 5700 XT Pulse | Corsair H115i Platinum | WD Black 1TB | WD Green 4TB | EVGA SuperNOVA G3 650W | Asus TUF GT501 | Samsung C27HG70 1440p 144hz HDR FreeSync 2 | Ubuntu 20.04.2 LTS |

 

Server:-

Intel NUC running Server 2019 + Synology DSM218+ with 2 x 4TB Toshiba NAS Ready HDDs (RAID0)

Link to comment
Share on other sites

Link to post
Share on other sites

You got EFI installed. Basically grub is installed into the EFI system partiton, unless you delete it there is no change for breaking grub.
I would however suggest you to chroot into the only Linux distro you like, then running again grub-install and update-grub just for clearing others grub entries
This requires (In case you are on a USB live)

  • mount /dev/sdaX /mnt where sdaX is your Linux install you wish to keep
  • mount -t proc proc /mnt/proc
  • mount --rbind /sys  /mnt/sys
  • mount --rbind /dev /mnt/dev
  • chroot /mnt
  • mount /dev/sdaY /boot/efi where sdaY is your fat32 efi partition

Then do, grub-install

then update-grub (or grub-mkconfig -o /boot/grub/grub.cfg)

 

You may want to re-run update-grub into your working linux system if you don't find all the grub entries (like Windows)

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks for your help people, and somehow my sda5 partition is still called sda5 instead of sda2. and i can say IT WORKS and that i also have to remove the windows boot entry and the old linux boot entry in the uefi, alhtough that is the easiest part. thankyou for your help people

 

 

Sadness is the one true emotion, and happiness, well, that's just a lie, sadness is all many of us feel, and is all we need to feel, because having it any other way, would just be wrong, why be happy when you can just be miserable like myself. 

Link to comment
Share on other sites

Link to post
Share on other sites

Nice that you got it working!

 

Just a few things (for future and people eavesdropping): Partition entries (numbers) have nothing to do with the actual order they are on the disk (has been like this on MSDOS type partition tables IIRC and still is on GPT). The number which will be assigned, will be the first free number (but I suppose a partition utility could assign any free number, but this is what they will usually do).

 

If you delete and add partitions, you might end up with any kind of partition numbers and their orders. But it is nothing to worry about, as it irrelevant what numbers the partitions are given; generally, it is not recommended to rely on them (or even disk device nodes) in any case, but use partition or FS UUIDs.

 

Moreover, GUI partition utilities might not give all relevant information. For example, the listing in OP does not state where a partition starts and ends - it only gives their sizes. They could be in order (they are on the disk), but this is only an assumption, and not a safe one (say, you want to resize a partition - it might be more difficult than anticipated).

 

Best to use command line (since those are DE agnostic and same for all, and even work for example if your DE fails) or figure out how to get more information out of that GUI thing, whatever it is (perhaps there is an option to display more columns with more information?).

 

To answer your original question: the approach is to make sure GRUB does not have anything on the previous Linux installation. It is possible it is installed that way, in case the installation was left over from your previous Linux installation. Most Linux distributions will install their bootloader, unless specified otherwise - so usually the one which was installed last will be "in charge".

 

Lukyp outlined what is needed. You can do this from the already booted Linux installation (no need to bind mount nor chroot).

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×