LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 07-21-2020, 04:01 AM   #1
isaqellari
LQ Newbie
 
Registered: Jul 2020
Posts: 9

Rep: Reputation: Disabled
How to extend /boot partition


Hello,

Can someone help me on how to extend /boot partition filesystem which is not formatted as LVM? I want to upgrade the CentOS 6.5 to 6.6 version but it is requiring more space in /boot partition.

[root@logger /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 32G 9.9G 20G 34% /
tmpfs 5.9G 0 5.9G 0% /dev/shm
/dev/sda2 39M 26M 11M 71% /boot
/dev/sdb1 500G 168G 332G 34% /opt/arcsight/logger/data

[root@logger /]# fdisk -l

Disk /dev/sda: 40.8 GB, 40802189312 bytes
64 heads, 32 sectors/track, 38912 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b4dcf

Device Boot Start End Blocks Id System
/dev/sda2 * 26 65 40960 83 Linux
/dev/sda3 66 32768 33487872 83 Linux
/dev/sda4 32769 38912 6291456 82 Linux swap / Solaris

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdb1 1 65271 524287999+ ee GPT

Disk /dev/sdc: 17.2 GB, 17179869184 bytes
64 heads, 32 sectors/track, 16384 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Thank you and best regards,
Ilir
 
Old 07-21-2020, 04:16 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Possible but very risky and hard. You need to shrink sda3 or sda4 and make room behind sda2. Parted might be able to do that (there is a liveCD version of parted that you should use).

Are there no files you can delete? Well, 39MB is a bit small anyway, I guess.

It's probably less work to just reinstall. By the way, Centos 6.6 is not supported anymore, and Centos 6.10 will reach end of live later this year.
 
Old 07-21-2020, 04:38 AM   #3
isaqellari
LQ Newbie
 
Registered: Jul 2020
Posts: 9

Original Poster
Rep: Reputation: Disabled
Hello berndbausch,

Thank you for your reply.
Actually there is an application installed Arcsight Logger 6.0 and I need to re-install it from the scratch and re-configure if I go for OS reinstall.
We are upgrading CentOS 6.5 as a pre-requisite for the Arcsight Logger upgrade procedure.

Can I delete any of these files? initramfs-2.6.32-431.el6.x86_64.img for example?

[root@logger boot]# ls -lah
total 21M
dr-xr-xr-x. 5 root root 1.0K Sep 9 2014 .
dr-xr-xr-x. 25 root root 4.0K Jul 20 16:27 ..
-rw-r--r--. 1 root root 103K Nov 22 2013 config-2.6.32-431.el6.x86_64
drwxr-xr-x. 3 root root 1.0K Sep 9 2014 efi
drwxr-xr-x. 2 root root 1.0K Sep 9 2014 grub
-rw-------. 1 root root 14M Apr 17 18:36 initramfs-2.6.32-431.el6.x86_64.img
drwx------. 2 root root 12K Sep 9 2014 lost+found
-rw-r--r--. 1 root root 161K Oct 26 2013 memtest86+-4.20
-rw-r--r--. 1 root root 190K Nov 22 2013 symvers-2.6.32-431.el6.x86_64.gz
-rw-r--r--. 1 root root 2.5M Nov 22 2013 System.map-2.6.32-431.el6.x86_64
-rwxr-xr-x. 1 root root 4.0M Nov 22 2013 vmlinuz-2.6.32-431.el6.x86_64
-rw-r--r--. 1 root root 166 Nov 22 2013 .vmlinuz-2.6.32-431.el6.x86_64.hmac

Best regards,
Ilir
 
Old 07-21-2020, 04:40 AM   #4
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,795
Blog Entries: 1

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
It may be possible to reconfigure the content of the initrds to make them smaller, thus reducing space required on the /boot filesystem. Certainly if the existing installation has more than one installed kernel, reducing the count to one also ought to allow to succeed to upgrade without need to do any resizing, such as uninstalling Plymouth. cf. https://forums.opensuse.org/showthre...02#post2947702
 
Old 07-21-2020, 04:57 AM   #5
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,795
Blog Entries: 1

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
Quote:
Originally Posted by isaqellari View Post
Can I delete any of these files? initramfs-2.6.32-431.el6.x86_64.img for example?

[root@logger boot]
Code:
# ls -lah
total 21M
dr-xr-xr-x.  5 root root 1.0K Sep  9  2014 .
dr-xr-xr-x. 25 root root 4.0K Jul 20 16:27 ..
drwxr-xr-x.  3 root root 1.0K Sep  9  2014 efi
drwxr-xr-x.  2 root root 1.0K Sep  9  2014 grub
-rw-------.  1 root root  14M Apr 17 18:36 initramfs-2.6.32-431.el6.x86_64.img
drwx------.  2 root root  12K Sep  9  2014 lost+found
-rwxr-xr-x.  1 root root 4.0M Nov 22  2013 vmlinuz-2.6.32-431.el6.x86_64
These would be the ones you cannot delete. However, these removals would be only a temporary workaround that lasted only until a new kernel installation or a grub upgrade. Removing memtest could be made permanent via package removal. The others are part of individual kernel packages.

There may be files within grub and efi that can also be removed and not be temporary, in part or in full also via package management. These would have to do with graphical grub and booting, such as Plymouth. I can't be more precise because I haven't even looked at CentOS in many years.
 
Old 07-21-2020, 05:05 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,119

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I take a different view. Moving partitions/filesystems these days is pretty easy and safe. That means using a current gparted liveCD if the system can be taken offline.
For such a small disk, I'd look at removing 1G (at least) from the swap and sliding the root over, and give the space to the the boot. Not sure if gparted will keep the same UUID for the swap when it reduces it, but I'd guess not, so that would have to be corrected or fstab updated. I simply delete the swap and move stuff around then reallocate/mkswap later, so I'm not sure what gparted does.
 
1 members found this post helpful.
Old 07-21-2020, 05:14 AM   #7
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Yes, there is very little you can delete. This is not your solution.

If you save the Arcsight config files and/or database and restore them at the precise locations, surely you don't have to reinstall the tool?

In case you want to try increasing /boot, I see three options.

Easiest: Remove swap from /etc/fstab, shut the server down. With an offline version of parted, remove sda4, move sda3 to the end of the disk, then grow sda2. Reboot, use resize2fs to grow /boot (assuming the filesystem is ext2/ext3/ext4, which is likely for Centos 6). If you need swap space, the next option is probably better, or you can set up file swap.

Slightly harder: Don't delete but shrink swap space (sda4) and move it to the end of the disk. Move sda3 towards the end of the disk without overlapping sda4. Grow sda2. Then grow /boot as in the first option.
Risk: If you make sda3 and sda4 overlap by mistake, you risk losing data.
EDIT: This is basically syg00's suggestion.

Hardest and riskiest: With a liveCD or recovery disk, use resize2fs to shrink root, then use parted to shrink sda3 and grow sda2. After that, use resize2fs to grow /boot.
Risk: You might shrink sda3 too much, thereby destroying data.

Last edited by berndbausch; 07-21-2020 at 05:15 AM.
 
1 members found this post helpful.
Old 07-21-2020, 05:39 AM   #8
isaqellari
LQ Newbie
 
Registered: Jul 2020
Posts: 9

Original Poster
Rep: Reputation: Disabled
Hello berndbausch,

I should delete "UUID=a4403ec6-bd19-44ff-94f0-207193d4b44c swap swap defaults 0 0" from fstab file, then boot the server with gparted Live CD?

How can I move /dev/sda3 to the end of the disk, using gparted ? Sorry, I'm not very familiar with these Linux staff.

Am I protected if I take a VMware snapshot in case something goes wrong doing these changes ?

BR,
Ilir
 
Old 07-21-2020, 07:03 AM   #9
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by isaqellari View Post

How can I move /dev/sda3 to the end of the disk, using gparted ? Sorry, I'm not very familiar with these Linux staff.
It's not Linux stuff; it's very similar to equivalent disk management tools in Windows. However I would have to read the manual to answer that question. It looks like your case is roughly addressed by https://gparted.org/display-doc.php%...een-partitions.
Quote:
Am I protected if I take a VMware snapshot in case something goes wrong doing these changes ?
If I had known it's virtual, I would have suggested you extend the disk, then move sda3 and sda4 further to the end to make room for extending sda2.

I suppose a snapshot, or better a clone of the disk is effective protection if anything goes wrong. Also take a backup, just in case.
 
1 members found this post helpful.
Old 07-21-2020, 09:26 AM   #10
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,795
Blog Entries: 1

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
Quote:
Originally Posted by isaqellari View Post
How can I move /dev/sda3 to the end of the disk, using gparted ?
When swap is its own partition in a system using LVM, it can be removed, and a new swap can be created by using LVM to free space within itself and using LVM to create the new swap. Once the original swap has been removed, the space freed is available to add to the /boot and/or the LVM partition(s).

Ultimately, a larger /boot is the right way forward. I was only suggesting workarounds that would ultimately be temporary, as kernel and initrd bloat are virtually certain to continue as time marches on.
 
Old 07-22-2020, 06:07 AM   #11
isaqellari
LQ Newbie
 
Registered: Jul 2020
Posts: 9

Original Poster
Rep: Reputation: Disabled
Hello guys,

Thank you for your suggestions.

I managed to extend /boot filesystem using gparted LiveCD. I expanded VMware virtual disk first then moved all the partitions after /boot partition to the end of the disk.
This procedure created free space for /boot partition and then I expanded it with 10GB.
Then, I ran yum update in order to upgrade CentOS 6.5 to 6.6 version but after the command completed the CentOS was upgraded to 6.10.
Is there any possibility to downgrade it to 6.6 (the one that I need) ?

BR,
Ilir
 
Old 07-22-2020, 06:54 AM   #12
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Seems to be possible, but I can't pretend I have tried.

It's probably better you create a new question in the Centos forum.
 
Old 07-22-2020, 07:02 AM   #13
isaqellari
LQ Newbie
 
Registered: Jul 2020
Posts: 9

Original Poster
Rep: Reputation: Disabled
Ok,

Thank you!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Extend Linux Partition (Extend LVM) osama.mansoor Linux - Newbie 5 11-27-2015 01:09 AM
Nagios Root partition warning - How do I extend partition? fireshooter Linux - Newbie 10 01-04-2013 07:01 AM
extend boot partition ? zafar_dandoti Linux - Newbie 3 10-14-2012 05:55 AM
How to Extend Boot Partition mselvaprakash Linux - Server 5 10-19-2010 06:21 PM
instalation can't detect my fat32 extend partition indiosmo Slackware 8 05-19-2003 03:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration