LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-16-2022, 10:53 AM   #1
LinuxRSA
Member
 
Registered: Apr 2015
Location: South Africa
Posts: 70

Rep: Reputation: Disabled
Shrinking /boot Partition in Ubuntu


Hi Guys

Doing some pre checks before i attempt to shrink the /boot partition on Ubuntu. Some Wizard thought 256GB would do the trick after /boot was 100% utilized.

Im trying to reduce the partition back to 256mb and plan to complete a kernel clean up / purge.

Code:
admin@vm-dev:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 16G 0 16G 0% /dev
tmpfs 3.2G 796K 3.2G 1% /run
/dev/mapper/osencrypt 248G 8.2G 240G 4% /
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sdc2 249G 245M 240G 1% /boot
/dev/sdc15 105M 4.4M 100M 5% /boot/efi
/dev/sda1 63G 53M 60G 1% /mnt
tmpfs 3.2G 0 3.2G 0% /run/user/1000
/dev/sdb1 42M 1.5K 42M 1% /mnt/_bek_disk
tmpfs 3.2G 0 3.2G 0% /run/user/1001
Code:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 64G 0 disk
└─sda1 8:1 0 64G 0 part /mnt
sdb 8:16 0 48M 0 disk
└─sdb1 8:17 0 46M 0 part /mnt/bek_disk
sdc 8:32 0 512G 0 disk
├─sdc1 8:33 0 255.7G 0 part
│ └─osencrypt 253:0 0 255.7G 0 crypt /
├─sdc2 8:34 0 256.3G 0 part /boot
├─sdc14 8:46 0 4M 0 part
└─sdc15 8:47 0 106M 0 part /boot/efi
No LVM
Code:
admin@vm-dev:~$ sudo pvs
admin@vm-dev:~$ sudo vgs
admin@vm-dev:~$
What commands or process can I use to reduce /boot from 256.3GB to 256MB ?

Thanks
 
Old 06-16-2022, 06:15 PM   #2
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
Go get yourself a gparted ivecd and use that. It's a GUI that allows you to drag the edges of the partition(s) to resize. Then apply the change.
Simple, effective, safe - but read my sigline.
 
Old 06-16-2022, 11:53 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by LinuxRSA View Post
Im trying to reduce the partition back to 256mb
That, otoh, might not be enough.
My /boot (not a separate partition) currently contains 168MB of files; say you have 2 kernels in there, you're already way beyond 256MB. I remember scenarios discussed right here on LQ where something like this happened.

tl;dr: Maybe 1GB would be better?
 
Old 06-17-2022, 02:37 AM   #4
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
Absolutely agree - meant to mention it too.
 
Old 06-17-2022, 03:05 AM   #5
LinuxRSA
Member
 
Registered: Apr 2015
Location: South Africa
Posts: 70

Original Poster
Rep: Reputation: Disabled
Hi Guys thanks.

Do i need the CD or can the below parted method be revised to work ? (The below parted adjustment was attempted before adding the storage)

Quote:
admin@vm-dev:/boot$ sudo parted /dev/sdc2
GNU Parted 3.2
Using /dev/sdc2
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Unknown (unknown)
Disk /dev/sdc2: 268MB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags:



Number Start End Size File system Flags
1 0.00B 268MB 268MB ext2



(parted) resizepart
Partition number? 1
Warning: Partition /dev/sdc2 is being used. Are you sure you want to continue?
Yes/No? yes
End? [268MB]? 512MB
Error: The location 512MB is outside of the device /dev/sdc2.
(parted)
Also, can the /boot partition be deleted and recreated ?

Thanks

Last edited by LinuxRSA; 06-17-2022 at 03:06 AM.
 
Old 06-17-2022, 04:35 AM   #6
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,492

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
Quote:
Warning: Partition /dev/sdc2 is being used. Are you sure you want to continue?
It appears that you are trying to resize from the installed Ubuntu which won't work as the warning above indicates. You can either get GParted on an iso and create a bootable USB/CD/DVD or if you still have the Ubuntu install USB or other device, you can use that as GParted is on the Ubuntu installer.
 
1 members found this post helpful.
Old 06-17-2022, 06:40 AM   #7
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,780

Rep: Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198
I would reduce the size of the /boot file system first - before reducing the partition size!
Code:
man resize2fs
Recreating /boot is possible but complicated IMHO.
A tar backup/restore seems simpler, but I have never tried it.
 
  


Reply



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
Dual Boot / Vista and Linux - Question on Shrinking Partition Morgandy Linux - Newbie 4 12-18-2009 10:34 AM
Shrinking the ext3 partition during the boot and creation of new partition saleem_ak Linux - Newbie 2 05-05-2009 01:52 AM
Shrinking Linux Partition w/ Partition Magic jrdioko Linux - Newbie 11 12-21-2003 03:46 PM
Shrinking a ext3 partition Radicalm16 Linux - Newbie 4 01-21-2003 09:37 PM
partition or shrinking? M@tt Linux - Newbie 2 11-12-2001 09:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:36 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