17

Sometimes I wanted to do smart partitions, by doing separate /boot partition, but I only give little space. Now I am having problems with lack of space on that partition.

How to remove /boot partition and join it with /root partition?

gsedej
  • 4,914
  • 2
    Have you thought to clean out older kernels from /boot before you try merging it with the / filesystem? – Arcege Mar 12 '11 at 23:46
  • yeah, but it's some "public" pc, so I don't want to do this each few months... (ok I know I could, but still...) – gsedej Mar 13 '11 at 00:06
  • See my answer below -- you could also resize the partition, instead of changing your partitioning scheme (which is a good one) – J. Taylor Mar 13 '11 at 01:39

2 Answers2

18

You could use cp -a /boot /boot-tmp to copy the contents to a temporary directory on the root filesystem, unmount the boot partition using umount /boot, and put the files back in place with rmdir /boot && mv /boot-tmp /boot.

Once you verify that everything is fine you can remove /boot from /etc/fstab. Finally, you should double-check the GRUB configuration and run update-grub.

Adam Byrtek
  • 9,811
  • 4
    Probably want to make sure /etc/fstab is correct once you do this. – belacqua Mar 13 '11 at 02:10
  • 1
    I'd like to reiterate though that increasing the size of the boot partition is probably a better choice ... I don't understand why you wouldn't just want to do that ... – J. Taylor Mar 14 '11 at 01:49
  • 5
    @jrtayloriv: Would you care to elaborate why a separate boot partition is preferable? -- I read in some ancient guide, 100 MB for a boot partition would be ok. Now apt-get upgrade regularly fails because of insufficient disk space. I don't want to move partitions. Do you know a solution that would automatically purge ancient kernels? – krlmlr Oct 30 '12 at 20:47
  • I have tried this, but my system somehow appears to load the configuration from the (now not mounted anymore) boot partition. (I have changed /etc/default/grub, and run update-grub, but the changes were not reflected in /boot/grub/grub.cfg.) Any hints? – krlmlr Oct 31 '12 at 10:53
2

You could also just keep the /boot partitition and expand it with gparted. (Of course, as always, backup first and keep a liveCD handy in case something goes wrong)

If you've never resized partitions before, there are plenty of tutorials on the web that will tell you how to do it. Here's a good tutorial to start with: http://www.ibm.com/developerworks/linux/library/l-resizing-partitions-1/index.html

J. Taylor
  • 764
  • Thanks for answer, but I rather just join in "/" partition. I would need to resize other partitions also.... – gsedej Mar 13 '11 at 12:33
  • If that's the case, you can "merge" partitions using gparted as well. Move the files from /boot partition to / partition. Then set bootloader to boot from the new /boot directory of the root partition. If everything works, and it boots up properly, then delete the boot partition and resize the other partitions to fill the space. Again -- make backups and keep a livecd ready (and I'll reiterate that resizing is probably a much better and easier solution than merging ...) – J. Taylor Mar 14 '11 at 01:44
  • I've been reading a lot about how to increase the size of a separate boot partition. In my case I have only SSH/terminal access to the linux box and I have to say it sounds really scary! It requires deleting my data-filled partition, dd-ing the partition-less filesystem contents to a new position on disk, then recreating the partition over the new location of those contents. It feels like I'm McGyver-ing things around with paper clips and duct tape! Moving the contents of the boot partition into the root one looks like a much better choice IMO. – Chuim Jun 25 '20 at 07:11