Any user-friendly instructions on extending the /boot partition? Appreciate any assistance or step-by-step guidance
The older version of the SafeSquid ISO installer suggests a default partition layout with /boot partition size of 232 megabytes.
This was sufficient for older versions of the operating system (older than ubuntu 18.04 LTS) however, with newer versions of ubuntu /boot partitions get utilized rather quickly.
Example of an obsolete filesystem structure.
Moreover /boot partition gets populated with old kernel modules and other leftover upgrades.
SafeSquid ISO installs, which are not recent may have issues with /boot partition utilized to 100%
This can prevent system updates and security patches essential for server security.
Example of such an error.
Preparing to unpack .../06-libcupsimage2_2.2.7-1ubuntu2.9_amd64.deb ...
Unpacking libcupsimage2:amd64 (2.2.7-1ubuntu2.9) over (2.2.7-1ubuntu2.8) ...
Preparing to unpack .../07-libcups2_2.2.7-1ubuntu2.9_amd64.deb ...
Unpacking libcups2:amd64 (2.2.7-1ubuntu2.9) over (2.2.7-1ubuntu2.8) ...
Preparing to unpack .../08-libmagickcore-6.q16-3-extra_8%3a6.9.7.4+dfsg-16ubuntu6.13_amd64.deb ...
Unpacking libmagickcore-6.q16-3-extra:amd64 (8:6.9.7.4+dfsg-16ubuntu6.13) over (8:6.9.7.4+dfsg-16ubuntu6.12) ...
Selecting previously unselected package linux-modules-4.15.0-188-generic.
Preparing to unpack .../09-linux-modules-4.15.0-188-generic_4.15.0-188.199_amd64.deb ...
Unpacking linux-modules-4.15.0-188-generic (4.15.0-188.199) ...
dpkg: error processing archive /tmp/apt-dpkg-install-DPzMI2/09-linux-modules-4.15.0-188-generic_4.15.0-188.199_amd64.deb (--unpack):
cannot copy extracted data for './boot/System.map-4.15.0-188-generic' to '/boot/System.map-4.15.0-188-generic.dpkg-new': failed to write (No space left on device)
In a newer version of SafeSquid ISO install, the problem of a smaller boot partition has been resolved.
/boot is configured to have comparatively large disk space.
Example of existing filesystem structure.
Workaround for users with older installs and smaller boot partitions can extend their /boot partition size.
Below is a guide on how to extend your /boot partitions.
How to extend /boot partition for an older version of SafeSquid install
(Note: Test for extending /boot portion was performed on newer SafeSquid install as we do not have SafeSquid with the older install, although execution remains similar.)
Default filesystem for SafeSquid ISO install
Add a new disk with a minimum of 2GB and a maximum of 5GB to your SafeSquid server.
(Note: Adding a new disk will not be covered here, you can find resources online to achieve the same based on your system type)
Validate disk status.
lsblk
- List all storage devices.
For me, after adding a new storage device, the existing sda storage device is now referred to as sdb and new storage device is referred to as sda
Create a new filesystem of type ext4.
(Note: In this example, the new storage device is referred to as sda and the existing boot partition is referred to as /dev/sdb1.
If you are following this guide please make sure that you have selected the appropriate partitions before performing any given task.)
mkfs.ext4 /dev/<sda>
Create new directory in /usr/local/src/old_boot for mounting old boot partition.
mkdir -p /usr/local/src/old_boot
umount /dev/<sdb1> ; mount /dev/sdb1 /usr/local/src/old_boot
Mount new partition to /boot directory
mount /dev/<sda> /boot
use rsync to copy all files with their permissions from the old boot directory to the new boot directory.
rsync -avz /usr/local/src/old_boot /boot
Edit /etc/fstab to modify the UUID of /boot directory.
To get the UUID of your storage device, use the below command.
blkid| grep /dev/<sda>| awk '{print $2}' | awk -F = '{print $2}' | awk -F \" '{print $2}'
copy UUID and edit /etc/fstab file.
vim /etc/fstab
Hit “Esc” and
:wq!
to save and exit from vim.
restart your server.
Validate if /dev/sda has automounted in /boot directory.
lsblk
Executing the below command if you have any unattended updates
apt update && apt upgrade -y
The system should now update without any errors.