0

I got a new dedicated server which have 500GB SSD holding the operating system and the other HDDs have the data. By default the /boot partition is considered small I wanna extend it same applies to EFI as shown below:

Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                  32G     0   32G   0% /dev
tmpfs                     32G     0   32G   0% /dev/shm
tmpfs                     32G  9.4M   32G   1% /run
tmpfs                     32G     0   32G   0% /sys/fs/cgroup
/dev/mapper/cl-root      402G  8.1G  394G   3% /
/dev/sda2               1014M  172M  843M  17% /boot
/dev/sda1                200M   12M  189M   6% /boot/efi
/dev/loop0               3.9G  8.4M  3.7G   1% /tmp
tmpfs                    6.3G     0  6.3G   0% /run/user/0

I'm trying to extend /boot and EFI partitions using resize2fs but the system isn't allowing me and I don't wanna create an LVM for them. I have 20GB free with LVM which I'm trying to unallocate from LVM as a free space then I can use fdisk to delete boot partitions and re-create them with the new space.

Any help how to unallocate the LVM free space and use them for fdisk? Or other solutions of expanding /boot.

Map of Physical Drive /dev/sda

[root@example ~]# fdisk -l /dev/sda
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sda: 499.6 GB, 499558383616 bytes, 975699968 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 2B62023B-35F9-4A40-B259-B0088B5FA7A8

#         Start          End    Size  Type            Name
 1         2048       411647    200M  EFI System      EFI System Partition
 2       411648      2508799      1G  Microsoft basic
 3      2508800    975697919  464.1G  Linux LVM

Thank you!

5
  • By which criteria is an almost 1 GiB /boot partition small? If you want to move partitions you need to provide their physical position on the hard drive: fdisk -l /dev/sda. – Piotr P. Karwasz Feb 3 '20 at 23:41
  • is 1GB enough for boot what about updates will fill the partition which requires manual actions? – David Buik Feb 4 '20 at 0:04
  • The /boot partition basically contains pairs of kernel (about 5 MiB) and initial RAM disk (about 50 MiB) and some bootloader configuration. You need around 20 kernels to fill it. New distributions automatically delete old kernels on upgrade. – Piotr P. Karwasz Feb 4 '20 at 0:25
  • We are still waiting for a map of your physical partitions: fdisk -l /dev/sda – Piotr P. Karwasz Feb 7 '20 at 20:03
  • @PiotrP.Karwasz thank you I've added the map to the question. – David Buik Feb 8 '20 at 8:56
0

To increase the size of the /boot partition you need access to a rescue mode: i.e. your server can not boot from the hard drive. Once you have that, you can:

  1. Shrink the physical volume /dev/sda3 as much as you can. E.g.:

    pvresize --setphysicalvolumesize 400G /dev/sda3
    
  2. Shrink the physical partition, i.e. delete it and create a new one. You must take care to leave the starting sector (2508800) the same and at least 400G on the partition. Leave enough space at the end of the disk for another partition.

  3. Resize the physical volume /dev/sda3 to fill the new partition:

    pvresize /dev/sda3
    
  4. Create a new partition (/dev/sda4 for example), format it and copy the files from /dev/sda2.

  5. Update your bootloader to use the new partition.

Warning: moving partitions can break your system for what I believe is little to no gain: you will never really need more than a . Different tools can use different units: e.g. some use mebibytes, while some use megabytes. With some effort, you might also be able to move the beginning of /dev/sda3 further away to make more space for /dev/sda2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.