Enabling noatime in Proxmox PVE (LXC)

March 9 2017

A small annoyance with LXC guests in Proxmox PVE 4.x is that there is no exposed way to pass mount options to guest volumes, in many setups (i.e. not ZFS), and there don’t seem to be any published workarounds for it either.

This is a bit of a performance disaster if you are on something like a software RAID1 array ;) (e.g. OVH and other budget dedicated).

So, here we are.

In /usr/share/perl5/PVE/LXC.pm, you will find a function mountpoint_mount which seems to be responsible for mounting volumes into the LXC containers.

You will need to identify which code path will be executing in your setup, as some refer to zfs, some to ISOs, some to block devices, etc. However, the code that invokes mount is fairly obvious and you should be able to mash noatime (and whatever else) in between the existing mount parameters, e.g.

push @extra_opts, '-o', 'usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0';

to

push @extra_opts, '-o', 'noatime,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0';

You’ll need to restart pvedaemon (which doesn’t affect running services apart from the REST API) and then restart your containers to remount the volumes.