0

I want to resize my /boot partition. I have gparted live CD and can do this pretty easily.

But the problem is my order of partitions:

gparted

I can shrink sbd4 or sdb5 to get some extra space.

In the end I can also extend sdb1 (without moving the head of it).

But the question is:

Can I move sdb2 and sdb3 so it does not corrupt my system?

  • 1
    Welcome to AskUbuntu, you can merge them and later separate them (if you want) does this mean 'moving' partitions in your sense? https://askubuntu.com/questions/3402/how-to-move-boot-and-root-partitions-to-another-drive – Sadaharu Wakisaka Apr 11 '20 at 01:43
  • 1
    New versions of Ubuntu do not normally need /boot partition nor swap partition as it uses a swap file. You do need the ESP - efi system partition for UEFI boot. And swap over 4GB is a waste unless you want to hibernate, which is not suggested. I would just move /boot back into / and eliminate the /boot partition. You can comment out /boot in fstab and use boot repair to totally reinstall grub & new kernel. Or copy all of /boot partition to /boot folder in / (root). – oldfred Apr 11 '20 at 02:46
  • 1
    may this help?? https://askubuntu.com/q/1073470/739431 – PRATAP Apr 11 '20 at 05:03
  • @oldfred, hibernation I actually use, so swap I would keep; but what about EFI? can I just remove it? shall I fix the system afterwards? and speaking of moving root to /, I like the idea, but a couple of guides I checked told me to copy and unmount /boot.. which is not possible to do as it is busy.. can this be done only with live cd? – Alexey Anufriev Apr 11 '20 at 19:55
  • @SadaharuWakisaka, thank you for the reference, by moving I mentioned just changing the position on the hdd – Alexey Anufriev Apr 11 '20 at 19:57
  • 1
    If you delete ESP, you will not be able to boot. You copy boot partition files to /boot folder. Then edit fstab. When you reboot it will use the files in the folder, not in partition. – oldfred Apr 11 '20 at 20:14
  • @oldfred, do I need to reinstall grub after moving or changing fstab is enough? – Alexey Anufriev Apr 11 '20 at 21:08
  • You may have to as its core.img looks for boot. – oldfred Apr 11 '20 at 21:12
  • @oldfred, unfortunately, this will not work, as I want encryption on / partition. Can I still move via gparted? will it be harmful to move efi partition? – Alexey Anufriev Apr 11 '20 at 23:10
  • Normally encrypted is full drive with LVM - logical volumes. You did not show LVM as part of your system? And yes LVM usually uses a separate /boot partition. – oldfred Apr 12 '20 at 02:29
  • @oldfred, no, I do not have LVM, just normal partitions. But root partition I still can encrypt. It is only boot must be separate. Still to the problem, do you think I can move efi and swap? – Alexey Anufriev Apr 12 '20 at 09:37
  • 1
    Moving file should not change UUID and normally is ok. Again good backups. I would consider deleting swap and moving it to end of drive. But then you have to edit fstab with new swap's UUID before rebooting. Maybe comment out old swap, so system will reboot. Then create new swap from live installer. Then you can boot & easily change fstab. Always after fstab edit: sudo mount -a I normally have ESP a first partition and used to have swap as last partition as those would not normally ever be changed. But now use swap file as newer Ubuntu uses swap file. – oldfred Apr 12 '20 at 13:59

2 Answers2

1

if you install a new kernel and it complains about no space on /boot, simply purge the old kernel. no need to resize /boot. to do that, install purge-old-kernels command

sudo apt-get install byobu

then run sudo purge-old-kernels, this is going to clean up the old kernels.

also, if you really want to resize, left-shrink your swap space by 500MB or 1GB, that's more than sufficient to accommodate your /boot folder. This has very little impact to your system performance (if your swap is over 8GB - in face, 14GB is quite generous).

FangQ
  • 367
0

In my case to get extended /boot I did the following:

  1. Boot with GParted live CD
  2. Cut 1 GB at the end of sdb4
  3. Copy sdb1 to this newly allocated space and fully resize this copy to 1 GB
  4. Generate new UUID for sdb1 so it does not collide with its copy (as UUID is also copied)
  5. Apply all the changes

Done!

Pros:

  • easy and fast operation

Cons:

  • sdb1 is now unused