Reverse dual boot (2x Manjaro, for testing purposes) back to single boot

I had some problems so i decided to do a new installation of Manjaro by splitting my drive into 2 partitions so i could keep my original installation intact but also try out a clean new installation.

So assuming the new installation is all working fine, some time in the future, I’m going to want to delete the original partition and keep the new one that seems to be working.

❰greg❙~❱✔≻ sudo fdisk -l
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Samsung SSD 860 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xb0d9b045

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sda1             2048 1306521599 1306519552   623G 83 Linux
/dev/sda2  *    1306521600 1953519615  646998016 308.5G 83 Linux

❰greg❙~❱✔≻ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 931.5G  0 disk 
├─sda1   8:1    0   623G  0 part /run/media/greg/c0628b7a-2f31-4e76-9eef-6dda7407ac6f
└─sda2   8:2    0 308.5G  0 part /
sr0     11:0    1  1024M  0 rom  

sda1 is the old OS & sda2 is the new working one. I am going to want to delete(un-allocate) sda1 and then expand sda2 to the full size of the drive so i only have 1 partition again.

Now, i never really understood all his stuff properly but i know enough to create multi boot systems but going in reverse im a bit confused.

  • If i delete sda1 and expand sda2 to the full size of the drive will it still be called sda2?
  • It would be the only partition on the drive and therefore seems odd that it would still be called sda2.
  • If it gets renamed to sda1 will this affect the OS or the grub on what was sda2?
  • Would it still look for grub on sda1(or sda2) ?
  • Would i need to update-grub and/or grub-install at all?

This is how im hoping it will go:-

  • using live usb OS
  • delete sda1
  • expand sda2 into full drive size
  • hopefully it should still boot into the OS because sda2 is marked as boot and has grub?
  • update-grub (to get rid of the old OS from the boot menu)
  • Done?

Hello, I think I’m correct, but I’m not an expert.

Absolutely.

Yes but no. There is not automatic renaming of Linux partitions. Unless you delete too sda2 and recreate a partition. The new one should be named sda1.
The order too is not automatic. From left to right you could have sda1, sda4, sda2 and sda6 by ex, depending of your previous operations in partitioning.

Still sda2. I’d recommend grub and mkinitcpio updates. And careful on which partition grub is installed. If you have it on sda1, you’d want to install it on sda2 before deleting sda1…
You may still do it afterwards in chrooting in a Live iso session.

If Grub is installed on sda2 and you had previously updated it, only sda2.

Install, depends if it’s currently on sda1 or sda2. Update, sure, you have to.

So if I read well, sda2 has grub installed already, so no need to reinstall it then.

You go into live USB environment, delete your sda1… Then if the empty space is left of sda2, it could take some time to expand and be a risk to lose data. Because all your sda2 data will be moved bit by bit at sda1 previous location. With SSD could be quite quick, with HDD, if it’s a big partition, expect some hours.

After that, a chroot in your system with a sudo update-grub and a sudo mkinitcpio -P should be good.

1 Like

All very helpful thank you, although i must admit even though i keep seeing chroot mentioned i have never got around to reading up on what it actually is or does. Probably time for me to go and look up chroot and mkinitcpio.

When you launch a live USB from a Manjaro iso, you’re in a special root session, with user manjaro.

Here you can chroot into your installed systems from sda1 or sda2 with your credentials, from the live session. And perform operations as updating grub, like if you were connected into your session.

Ahh, a brilliant explanation that just clicked the moment i read your description. I have just read the man for chroot and didn’t understand at all. Its the way they write them.

However, I’m still wondering if this last sentence of yours is needed, i mean after removing sda1 and updating grub it should work should it not?

Why do we need this “mkinitcpio” ? I mean if sda2 is going to remain as sda2 then there is nothing that has changed.

You can also try to reinstall your Manjaro installation.

I recommend that, because you have no separate /home partition.

I could, but it really is the absolute last thing i want to do because i have just spent weeks reinstalling and creating new user profiles to try and track down some intermittent issues i have had for a long while. This current installation on sda2 is the first time i have got the OS to work (touch wood) i am just now migrating all my ~/ stuff one folder at a time very slowly to be sure the faults do not reoccur.
Iv never separated /home i just back it up where it is on /.

First, backup valueable data. Then just move/delete the unwanted system partition, manjaro-chroot from live ISO into the partition you want to keep and perform a fresh grub-install with the right syntax for your system, afterwards (still in chroot environment)

mkinitcpio -P
update-grub
exit

and reboot and you should be fine.

Well i was happy with the idea that i could just delete sda1 and reboot. Since sda2 is formatted as boot and already has grub it should still boot and then i can update-grub from inside the correct session.

However, reading your link it says

The device is the disk (not a partition)

root # grub-install --force --target=i386-pc --recheck --boot-directory=/boot /dev/sdy

Which has confused me again. I thought grub is installed on specific /boot blocks so if you had multi partitions with many OS’s how would it know which one you want it on? is it the current session you are using that defines it?

No matter, i think iv got enough here to be tinkering with at the time.