Monday, May 20, 2019
Thursday, May 9, 2019
Increase the size of /boot on centos
I have noticed that my /boot on one of my test machine is nearly full and I can not patch the machine any more and getting
Total 9.0 MB/s | 95 MB 00:00:10
Running transaction check
Running transaction test
Transaction check error:
installing package kernel-3.10.0-957.12.1.el7.x86_64 needs 23MB on the /boot filesystem
Error Summary
-------------
Disk Requirements:
At least 23MB more space needed on the /boot filesystem.
#
This is a virtual box machine and I did the below to fix it.
Shut the machine down and added a new 4G disk to it.
startup
create new partition using
# fdisk /dev/sdb
n
p
rest as default
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-8388607, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-8388607, default 8388607):
Using default value 8388607
Partition 1 of type Linux and of size 4 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
#
Format the drive to ext4 file system
mkfs.ext4 /dev/sdb
Copy existing contents from /boot to this new drive
mkdir -p /tmp/sdb1
mount /dev/sdb1 /tmp/sdb1
cp -a /boot/* /tmp/sdb1/
Get the UUID of the drive
# blkid /dev/sdb1
/dev/sdb1: UUID="6ae400b9-ff66-4ed0-a550-77eaf29e8d7f" TYPE="ext4"
#
un mount the drive
# umount /tmp/sdb1/
Modify /etc/fstab and add UUID of new drive.
un mount /boot and mount is back so that new drive is mounted as /boot
# umount /boot
# mount /boot
# df -h
/dev/sdb1 3.9G 194M 3.5G 6% /boot
Re- install GRUB and update configurations
[root@localhost ~]# grub2-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
[root@localhost ~]#
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-957.10.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.10.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.5.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.5.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-afcc54177a674be69136d59c73eb35bf
Found initrd image: /boot/initramfs-0-rescue-afcc54177a674be69136d59c73eb35bf.img
done
[root@localhost ~]#
Total 9.0 MB/s | 95 MB 00:00:10
Running transaction check
Running transaction test
Transaction check error:
installing package kernel-3.10.0-957.12.1.el7.x86_64 needs 23MB on the /boot filesystem
Error Summary
-------------
Disk Requirements:
At least 23MB more space needed on the /boot filesystem.
#
This is a virtual box machine and I did the below to fix it.
Shut the machine down and added a new 4G disk to it.
startup
create new partition using
# fdisk /dev/sdb
n
p
rest as default
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-8388607, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-8388607, default 8388607):
Using default value 8388607
Partition 1 of type Linux and of size 4 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
#
Format the drive to ext4 file system
mkfs.ext4 /dev/sdb
Copy existing contents from /boot to this new drive
mkdir -p /tmp/sdb1
mount /dev/sdb1 /tmp/sdb1
cp -a /boot/* /tmp/sdb1/
Get the UUID of the drive
# blkid /dev/sdb1
/dev/sdb1: UUID="6ae400b9-ff66-4ed0-a550-77eaf29e8d7f" TYPE="ext4"
#
un mount the drive
# umount /tmp/sdb1/
Modify /etc/fstab and add UUID of new drive.
un mount /boot and mount is back so that new drive is mounted as /boot
# umount /boot
# mount /boot
# df -h
/dev/sdb1 3.9G 194M 3.5G 6% /boot
Re- install GRUB and update configurations
[root@localhost ~]# grub2-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
[root@localhost ~]#
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-957.10.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.10.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.5.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.5.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-afcc54177a674be69136d59c73eb35bf
Found initrd image: /boot/initramfs-0-rescue-afcc54177a674be69136d59c73eb35bf.img
done
[root@localhost ~]#
Subscribe to:
Posts (Atom)