LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-14-2017, 01:01 PM   #1
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Rep: Reputation: 1
Need help managing efi entries


Hello,

I got a warning that I have low uefi disk pace.

My efi partition is 100 MB. I didn’t make the partition, it came with the laptop pre-partitioned.

I have a new machine and I am still not completely familiar with the efi system that’s why I need advise to free up space on the efi partition.

I guess some of my experiments left old entries on the efi partition that I need to be deleted somehow to free up disk space. But I don’t know how.

This is my boot directory:
Code:
[mak@jmak-pc ~]$ dir /boot/efi/EFI
antergos_grub	    antergos_grub_gmm1	arch-KDE    Dell
antergos_grub_1jst  antergos_grub_oeil	ArchLabs    grub
antergos_grub_39nr  antergos_grub_vl0n	archLXQT    Manjaro
antergos_grub_a0co  antergos_grub_wnhk	archLXQT_2  Microsoft
antergos_grub_de48  arch_enlightenment	arc_lxqt    rosa
antergos_grub_dh05  ArchKDE		Boot	    ubuntu
From the 19 items only 4 exist, the rest are none-existent leftovers from my previous experiments.

This shows that my efi partition is 96% full:
Code:
[mak@jmak-pc ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
dev             3.9G     0  3.9G   0% /dev
run             3.9G  9.2M  3.9G   1% /run
/dev/sda8        20G  7.0G   12G  38% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           3.9G  192K  3.9G   1% /tmp
/dev/sda2        96M   93M  4.0M  96% /boot/efi
tmpfs           786M  8.0K  786M   1% /run/user/1000
overlaid        786M  8.0K  786M   1% /run/user/1000/mak-chromium
/dev/sda11       73G  233M   69G   1% /run/media/mak/b6eaebe0-022c-4add-9692-c54ad69c77bf
[mak@jmak-pc ~]$
Thank you.

Last edited by jozmak; 07-17-2017 at 10:52 AM. Reason: SOLVED
 
Old 07-14-2017, 01:51 PM   #2
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Hi jozmak,

In my opinion, 100MB is way too small for an ESP. If it were me, I would use GParted Live to grow it to *at least* 200MB or if you can spare it (your df -h output suggests this is the case), 500MB.

You can do a clean-up, but in my opinion you will run into the issue again if you don't increase the size of your ESP.

Hope this helps - let us know if anything.

Cheers !
 
Old 07-14-2017, 03:04 PM   #3
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Rickkkk View Post
Hi jozmak,

In my opinion, 100MB is way too small for an ESP. If it were me, I would use GParted Live to grow it to *at least* 200MB or if you can spare it (your df -h output suggests this is the case), 500MB.

You can do a clean-up, but in my opinion you will run into the issue again if you don't increase the size of your ESP.

Hope this helps - let us know if anything.

Cheers !
Hi Rickkkk,

Thanks for replying.

I thought of this, but as far as I know you can expand a partition only if there is space right next to it.

This is my partition table:
Code:
[mak@jmak-pc ~]$ lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda       8:0    0 238.5G  0 disk 
├─sda1    8:1    0   450M  0 part 
├─sda2    8:2    0   100M  0 part /boot/efi
├─sda3    8:3    0    16M  0 part 
├─sda4    8:4    0  59.9G  0 part 
├─sda5    8:5    0    20G  0 part 
├─sda6    8:6    0    20G  0 part 
├─sda7    8:7    0    20G  0 part 
├─sda8    8:8    0    20G  0 part /
├─sda9    8:9    0    20G  0 part 
├─sda10   8:10   0     4G  0 part [SWAP]
└─sda11   8:11   0    74G  0 part /run/media/mak/b6eaebe0-022c-4add-9692-c54ad69c
[mak@jmak-pc ~]$
As you see there is a 16MB partition between the efi and the windows (sda4) partition from which I could recover the required disk space. I think the 16MB is either dell service partition or windows recovery partition.

So I don’t know how this would be possible.

As you see there is plenty of diskspace on (sda11) partition available but they are in a wrong sequence.

What do you think if I would create a second ESP partition right after the (sda11) that could work? This way I would have two ESP partitions, one for windows and one for linux.
 
Old 07-14-2017, 04:03 PM   #4
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Hi again jozmak,

You are indeed correct that you must have contiguous free space adjacent to a partition in order to be able to expand it. You would be required to do a good bit of manipulation of several partitions (shrinking, moving ...) to grow your ESP.

I can't comment on whether your suggestion of a 2nd ESP is recommendable or not - I've never done it (perhaps other members may have an opinion ... ).

I personally would greatly simplify the partitioning scheme. 11 logical partitions on a 250GB disk is, in my opinion, not optimal. I would expect that you may run into other issues down the road. That said, you may have set it up that way for a good reason - could you perhaps elaborate on what motivated you to structure it that way ?

My scheme of choice for a client machine (i.e. non-server) is simple: one ESP, one root partition (which includes home) and one swap partition (even this is optional). On my servers I have a separate home partition.
 
Old 07-14-2017, 04:21 PM   #5
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Rickkkk View Post
Hi again jozmak,

You are indeed correct that you must have contiguous free space adjacent to a partition in order to be able to expand it. You would be required to do a good bit of manipulation of several partitions (shrinking, moving ...) to grow your ESP.

I can't comment on whether your suggestion of a 2nd ESP is recommendable or not - I've never done it (perhaps other members may have an opinion ... ).

I personally would greatly simplify the partitioning scheme. 11 logical partitions on a 250GB disk is, in my opinion, not optimal. I would expect that you may run into other issues down the road. That said, you may have set it up that way for a good reason - could you perhaps elaborate on what motivated you to structure it that way ?

My scheme of choice for a client machine (i.e. non-server) is simple: one ESP, one root partition (which includes home) and one swap partition (even this is optional). On my servers I have a separate home partition.
The reason is simple, I am a kind of distro hopper. I like to check out different linux flavors.

On my desktop machine with 1 TB space I had 16 partitions.

But this is what I've found on arch forum:

https://bbs.archlinux.org/viewtopic.php?id=168503

"Having two EFI System Partitions (ESPs) on one disk is explicitly permitted by the EFI spec; however, it's inadvisable because the Windows 7 installer flakes out when presented with such a configuration. Once installed, Windows 7 seems to work normally, although I don't know if everything works fine -- there might conceivably be problems with software updates that would access the ESP, for instance...."

"Another possibility is to use two ESPs, but adjust the Linux ESP's partition type code so that it's not a regular ESP should you ever need to re-install Windows or when you install system updates or otherwise do anything that might interact with the ESP."

In the second part, what does he mean by "adjust the Linux ESP's partition type code so that it's not a regular ESP"

As far as I know the efi partition code is "ef00". Is there other efi code?

Thank you,
 
Old 07-14-2017, 06:25 PM   #6
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
If you're going to distro hop, then virtualbox is probably a lot easier than actually installing all the distros.
 
Old 07-14-2017, 06:27 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by jozmak View Post
From the 19 items only 4 exist, the rest are none-existent leftovers from my previous experiments.
Impressive - even I don't have listings like that. If you don't need all 4, just delete the appropriate directory(s) - that'll give you a "quick fix" maybe. Likewise the empty dirs. If you also want to clean up the boot list (in NVRAM), use efibootmgr from Intel; should be in one of your repos. Else check your EFI setup menu for a delete option.

As for the partition, no magic there - it's just a [V]FAT partition. Reallocate a bigger one and copy everything over. I've never allowed more than one EFI partition (change the original one after the copy), but the move to a new partition has worked fine when I've needed to do it.
 
Old 07-14-2017, 07:38 PM   #8
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by syg00 View Post
Impressive - even I don't have listings like that. If you don't need all 4, just delete the appropriate directory(s) - that'll give you a "quick fix" maybe. Likewise the empty dirs. If you also want to clean up the boot list (in NVRAM), use efibootmgr from Intel; should be in one of your repos. Else check your EFI setup menu for a delete option.

As for the partition, no magic there - it's just a [V]FAT partition. Reallocate a bigger one and copy everything over. I've never allowed more than one EFI partition (change the original one after the copy), but the move to a new partition has worked fine when I've needed to do it.
This is what my efibootmgr shows:
Code:
[mak@jmak-pc ~]$ sudo efibootmgr
[sudo] password for mak: 
BootCurrent: 0001
Timeout: 6 seconds
BootOrder: 0001,0000,0002,0003,0004,0005,0006,0007
Boot0000* Windows Boot Manager
Boot0001* manjaro
Boot0002* ArchLabs
Boot0003* antergos_grub_vl0n
Boot0004* antergos_grub_dh05
Boot0005* UEFI:CD/DVD Drive
Boot0006* UEFI:Removable Device
Boot0007* UEFI:Network Device
Boot0009* UEFI:Network Device
[mak@jmak-pc ~]$
It doesn't show the old entries because when I rearanged the boot order I left only the active ones on the list. This is a new machine, I've never had experince with efi systems before because my old machine had legacy board. When I experimented with the efibootmgr I've never knew that I will later face issues like this.

Could you instruct me how to delete those entries from the esp partition? How could I make efibootmgr to show all the boot entries?
 
Old 07-14-2017, 10:14 PM   #9
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
I found an excellent tutorial

https://websetnet.com/remove-ubuntu-...ndows-10-uefi/

which shows a simple way to remove old scrap from the efi partition.

By removing them I managed to free 10Mib disk space.

My efi partition is still close to the limit
Code:
[mak@jmak-pc ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
dev             3.9G     0  3.9G   0% /dev
run             3.9G  9.2M  3.9G   1% /run
/dev/sda8        20G  7.1G   12G  39% /
tmpfs           3.9G   41M  3.8G   2% /dev/shm
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           3.9G  4.0K  3.9G   1% /tmp
/dev/sda2        96M   82M   15M  86% /boot/efi
tmpfs           786M   23M  764M   3% /run/user/1000
overlaid        786M   23M  764M   3% /run/user/1000/mak-chromium
[mak@jmak-pc ~]$
and I still want to implement the second efi partition as I said earlier.
 
Old 07-15-2017, 01:15 AM   #10
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 567

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
Hi jozmak,

I do distro hopping too and that, since my MBR days. It is something else to actually install the systems and experiment. But whenever I installed a new distro I didn't let it install its bootloader. Instead, I have a Slackware Linux which I use as my main distro and it holds all my configs for GRUB. I would just update the /boot/grub/grub.cfg each time I installed something new.

Yes, 100MB is a bit small, but a second EFI partition can mess up multi-booting, especially with Windows there. I don't recommend this.

For your current problem, if you need to delete entries from the UEFI registered list of bootloaders, take this example:
Code:
BootCurrent: 0001
Timeout: 6 seconds
BootOrder: 0001,0000,0002,0003,0004,0005,0006,0007
Boot0000* Windows Boot Manager
Boot0001* manjaro
Boot0002* ArchLabs
Boot0003* antergos_grub_vl0n
Boot0004* antergos_grub_dh05
Boot0005* UEFI:CD/DVD Drive
Boot0006* UEFI:Removable Device
Boot0007* UEFI:Network Device
Boot0009* UEFI:Network Device

###  I would like to remove bootloader "antergos_grub_dh05", that is Boot0004:  ###

> efibootmgr -b 0004 -B
You can read the man pages of efibootmgr for more information.

Concerning all the other bootloaders which are present on the EFI partition but not listed in the output of efibootmgr, they are simply not being used at all. You can safely delete them from the EFI partition.

I will advise that in the future you boot a single instance of GRUB and just add an entry for any newly installed distro to the grub.cfg. Or if you really want to install the "new" bootloader, then you just have to think a bit more and manage the EFI space. With 11 partitions only on the hard disk I don't think you need that many as 19 bootloaders on the EFI partition, so I seriously think the 100MB can be managed.

Last edited by aragorn2101; 07-15-2017 at 01:19 AM.
 
Old 07-15-2017, 07:48 AM   #11
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by aragorn2101 View Post
Hi jozmak,

I do distro hopping too and that, since my MBR days. It is something else to actually install the systems and experiment. But whenever I installed a new distro I didn't let it install its bootloader. Instead, I have a Slackware Linux which I use as my main distro and it holds all my configs for GRUB. I would just update the /boot/grub/grub.cfg each time I installed something new.

Yes, 100MB is a bit small, but a second EFI partition can mess up multi-booting, especially with Windows there. I don't recommend this.

For your current problem, if you need to delete entries from the UEFI registered list of bootloaders, take this example:
Code:
BootCurrent: 0001
Timeout: 6 seconds
BootOrder: 0001,0000,0002,0003,0004,0005,0006,0007
Boot0000* Windows Boot Manager
Boot0001* manjaro
Boot0002* ArchLabs
Boot0003* antergos_grub_vl0n
Boot0004* antergos_grub_dh05
Boot0005* UEFI:CD/DVD Drive
Boot0006* UEFI:Removable Device
Boot0007* UEFI:Network Device
Boot0009* UEFI:Network Device

###  I would like to remove bootloader "antergos_grub_dh05", that is Boot0004:  ###

> efibootmgr -b 0004 -B
You can read the man pages of efibootmgr for more information.

Concerning all the other bootloaders which are present on the EFI partition but not listed in the output of efibootmgr, they are simply not being used at all. You can safely delete them from the EFI partition.

I will advise that in the future you boot a single instance of GRUB and just add an entry for any newly installed distro to the grub.cfg. Or if you really want to install the "new" bootloader, then you just have to think a bit more and manage the EFI space. With 11 partitions only on the hard disk I don't think you need that many as 19 bootloaders on the EFI partition, so I seriously think the 100MB can be managed.
Thanks for the idea.

So I guess I just have to live with this 100M for a while. This is a new machine and it still has 1 year warranty on it. When the warranty expires I plan to remove windows completely, repartition the harddrive creating a large enough efi partition, which I guess will solve these problems.

I tried several times before creating 40_custom boot file in grub.d but I always ended up in failure. Some time ago, I even posted a help request on archlinux forum but they couldn't figure out what was wrong with the 40_custom file. I copied it exactely from the arch wiki page and it still didn't work.
 
Old 07-15-2017, 11:57 AM   #12
plasmonics
Member
 
Registered: Jan 2009
Distribution: Fedora, Gentoo, LFS
Posts: 224

Rep: Reputation: 69
If you install Windows from an OEM CDROM and partition the hard drive manually, a 100 MiB EFI partition should be enough. On my home built desktop computer, I installed Windows 8 (subsequently upgraded to windows 10) from an OEM CDROM. Microsoft takes up about 24M on the EFI partition. Most Linux distros only use about 120K on the EFI partition. The exceptions are Fedora and CentOS which use about 8M and Ubuntu which uses about 3-6M. My 100MiB EFI partition is only 48% full. It contains Windows and 7 Linux distros.

Things are different on a laptop. My HP laptop has a 260M EFI partition that was already set up by the manufacturer. Microsoft uses 66M and HP 44M. The 7 or so Linux distros that I have on it do not take up much space. It is 53% full, mostly junk from Microsoft and HP.

From a Linux perspective, you can have more than one EFI partition per hard drive. The problem is when you try to update Windows, the process may hang if you have more than one EFI partition.

If I were you, I would back up the EFI partition using Clonezilla or some other product, and do an internet search on how to remove unnecessary Microsoft and laptop manufacturer files from the EFI. If the laptop then becomes unbootable, you can always restore the original ESP.
 
Old 07-15-2017, 12:33 PM   #13
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 567

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
Quote:
Originally Posted by jozmak View Post
I tried several times before creating 40_custom boot file in grub.d but I always ended up in failure. Some time ago, I even posted a help request on archlinux forum but they couldn't figure out what was wrong with the 40_custom file. I copied it exactely from the arch wiki page and it still didn't work.
Editing 40_custom to add distro menu entries is a bad idea.
Let's say you have a main distro, then from within your main distro you update grub like this:
Code:
grub-mkconfig -o /boot/grub/grub.cfg
It should detect all the distros you have on your machine and add an entry for them in the config file.
 
Old 07-15-2017, 01:47 PM   #14
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by plasmonics View Post
If you install Windows from an OEM CDROM and partition the hard drive manually, a 100 MiB EFI partition should be enough. On my home built desktop computer, I installed Windows 8 (subsequently upgraded to windows 10) from an OEM CDROM. Microsoft takes up about 24M on the EFI partition. Most Linux distros only use about 120K on the EFI partition. The exceptions are Fedora and CentOS which use about 8M and Ubuntu which uses about 3-6M. My 100MiB EFI partition is only 48% full. It contains Windows and 7 Linux distros.

Things are different on a laptop. My HP laptop has a 260M EFI partition that was already set up by the manufacturer. Microsoft uses 66M and HP 44M. The 7 or so Linux distros that I have on it do not take up much space. It is 53% full, mostly junk from Microsoft and HP.

From a Linux perspective, you can have more than one EFI partition per hard drive. The problem is when you try to update Windows, the process may hang if you have more than one EFI partition.

If I were you, I would back up the EFI partition using Clonezilla or some other product, and do an internet search on how to remove unnecessary Microsoft and laptop manufacturer files from the EFI. If the laptop then becomes unbootable, you can always restore the original ESP.
Hi plasmonics,

Here is the EFI partition content:
Code:
[mak@jmak-pc EFI]$ ls
antergos_grub_vl0n  ArchLabs  archLXQT_2  Boot  Dell  grub  Manjaro  Microsoft
[mak@jmak-pc EFI]$
In the Dell directory there is only two items a bios recovery file and a small log file. That's all.

The Microsoft directory on the other hand, full of language files and directories. Those are the ones that take up most of the space.

But I don't dare to touch any of those because I have no good understanding what are their functions.

This is the content of the Microsoft/Boot directory:
Code:
[mak@jmak-pc Boot]$ ls
BCD           da-DK  fr-CA           kd_02_15b3.dll  memtest.efi  sk-SK
BCD.LOG       de-DE  fr-FR           kd_02_1969.dll  nb-NO        sl-SI
BCD.LOG1      el-GR  hr-HR           kd_02_19a2.dll  nl-NL        sr-Latn-CS
BCD.LOG2      en-GB  hu-HU           kd_02_8086.dll  pl-PL        sr-Latn-RS
bg-BG         en-US  it-IT           kd_07_1415.dll  pt-BR        sv-SE
bootmgfw.efi  es-ES  ja-JP           kd_0C_8086.dll  pt-PT        tr-TR
bootmgr.efi   es-MX  kd_02_10df.dll  kdstub.dll      qps-ploc     uk-UA
BOOTSTAT.DAT  et-EE  kd_02_10ec.dll  ko-KR           Resources    zh-CN
boot.stl      fi-FI  kd_02_1137.dll  lt-LT           ro-RO        zh-HK
cs-CZ         Fonts  kd_02_14e4.dll  lv-LV           ru-RU        zh-TW
[mak@jmak-pc Boot]$

Last edited by jozmak; 07-15-2017 at 01:59 PM.
 
Old 07-16-2017, 11:10 AM   #15
plasmonics
Member
 
Registered: Jan 2009
Distribution: Fedora, Gentoo, LFS
Posts: 224

Rep: Reputation: 69
Assuming that your EFI partition is mounted at /boot/efi, you can try the following to see which application is taking up the space:
Code:
cd /boot/efi
du -h .
 
  


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
resize efi question [/boot/efi] with boot flag gparted mtdew3q Fedora 4 03-19-2017 10:02 PM
[SOLVED] Can't find /boot/efi/EFI/Slackware/vmlinuz kernel configuration ironQiu Slackware 4 02-09-2015 06:21 AM
boot efi disk with without a non-efi bios pc... masavini Programming 1 11-12-2013 08:48 PM
EFI main GPT overwritten everytime (when windows 7 runs) - structure of EFI masuch Linux - Newbie 2 07-20-2012 02:49 PM
how to sort output at latest entries without disturbing the previous entries record nabmufti Programming 4 02-11-2008 11:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:31 PM.

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