esp partitions should be mounted with "discard" option where applicable

Bug #1779443 reported by Tom Reynolds
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
partman-efi (Ubuntu)
Triaged
Wishlist
Unassigned

Bug Description

This is a bug report / feature request about Ubuntu installations created by either the Ubuntu Desktop or Server (both 'live' and classic/alternative) installer. 'ubiquity' may be the wrong package.

Currently, when you install any variant of Ubuntu to a storage type which supports TRIM (discards), the following is placed in /etc/fstab:

UUID=1234-ABCD /boot/efi vfat umask=0077 0 1

However, since the fstrim command cannot handle vfat file systems (and vfat file systems are thus not handled by /etc/cron.weekly/fstrim), but vfat file systems support the 'discard' option, they should be mounted with this option if the underlying storage device can be determined to support TRIM.

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: ubiquity (not installed)
ProcVersionSignature: Ubuntu 4.15.0-23.25~16.04.1-generic 4.15.18
Uname: Linux 4.15.0-23-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.18
Architecture: amd64
CurrentDesktop: XFCE
Date: Sat Jun 30 10:26:09 2018
InstallCmdLine: BOOT_IMAGE=/install/vmlinuz file=/cdrom/preseed/ubuntu-server.seed quiet ---
InstallationDate: Installed on 2017-04-29 (426 days ago)
InstallationMedia: Ubuntu-Server 16.04.2 LTS "Xenial Xerus" - Release amd64 (20170215.8)
SourcePackage: ubiquity
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Phillip Susi (psusi) wrote :

What would be the point? After the system is installed, the ESP isn't really ever written to again so there isn't anything that really needs discarded. It's also rather small, so if there was anything that could be discarded, it wouldn't be much.

Changed in ubiquity (Ubuntu):
status: New → Incomplete
Revision history for this message
Tom Reynolds (tomreyn) wrote :

On some Ubuntu systems I manage, I see regular writes to the /EFI/ubuntu location with current file modification timestamps. On a multi boot system, the content of the ESP can also change more often. So I would say there seem to be regular writes, which means discard would make sense.

Changing the default does not seem to make things worse, so I don't understand an argument of it not being worth the change, unless you think it takes a lot of effort to introduce and maintain this change (why so)?

Revision history for this message
Phillip Susi (psusi) wrote :

What files are changing? The only thing there should be the grub core image and that should only change 3 or 5 times a year, assuming you are staying on the latest release instead of LTS.

I believe we intentionally do not enable the discard option by default because it can cause some performance problems.

Revision history for this message
Tom Reynolds (tomreyn) wrote :

A 16.04 system I'm looking at shows current modification times on all files in /EFI/ubuntu/ files:

# ls -l /boot/efi/EFI/ubuntu/
total 3484
drwx------ 2 root root 4096 Apr 30 2017 fw
-rwx------ 1 root root 67536 Jan 26 18:07 fwupx64.efi
-rwx------ 1 root root 152 Jul 10 10:40 grub.cfg
-rwx------ 1 root root 1133944 Jul 10 10:40 grubx64.efi
-rwx------ 1 root root 1153336 Jul 10 10:40 mmx64.efi
-rwx------ 1 root root 1196736 Jul 10 10:40 shimx64.efi

I assume (but have not verified) that these files are overwritten (which the drive firmware may map to different sectors) whenever the kernel images' post install trigger fires, i.e. on kernel updates.

It could also be that this only occurs on grub-install, which I may have run around this time on this system.

Revision history for this message
Tom Reynolds (tomreyn) wrote :

Can you discuss how using the discard option causes performance problems when there are rare writes (<= once a week) to a partition?

Revision history for this message
Phillip Susi (psusi) wrote :

If those files are being re-copied every kernel upgrade, then that is probably something that should not be happening. They should only be copied on grub-install, not update-grub.

The performance problems caused by discard on a root fs probably do not apply to the ESP.

Changed in ubiquity (Ubuntu):
status: Incomplete → Triaged
importance: Undecided → Wishlist
affects: ubiquity (Ubuntu) → partman-efi (Ubuntu)
Revision history for this message
Tom Reynolds (tomreyn) wrote :

I looked into this a little more. Files on the ESP are not written on every kernel image update. My current understanding is that they are only written when grub-install is run.

So, yes, I think discard on ESP is not urgent at all, but still nice to have.

Revision history for this message
Phillip Susi (psusi) wrote :

It would probably be better if the FAT filesystem simply got the proper discard ioctl like the rest.

Revision history for this message
Tom Reynolds (tomreyn) wrote :

Definitely, but I do not see this happening anytime soon (do you?).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.