XFS mount, Discard cannot be activated on /


I have several UCS VM’s on a Proxmox (PVE). The virtual hardware (SCSI controller, disk etc.) is the same for all of them.

All VM’s use XFS. I want to use the mount option within the VM. First I check (inside the VM) if the block device supports this:

root@srv01:~# cat /sys/block/sda/queue/discard_max_bytes 

and then change the /etc/fstab

UUID=ea60c69a-1648-41eb-979a-dfc7a82b65bc / xfs defaults,discard 0 0
# /var was on /dev/sda2 during installation
UUID=b0675bdf-9417-48fc-a692-65a8df0fe491 /var xfs defaults,discard 0 0

After reboot I check if the option is active.

root@cloud01:~# mount
/dev/sda1 on / type xfs (rw,relatime,attr2,inode64,noquota)
/dev/sda2 on /var type xfs (rw,relatime,attr2,discard,inode64,noquota)

It is active for the /var partition, but not for the / partition.

What am I doing wrong?

with best

XFS and discard doe not work through fstab because the /-fs get “remounted” during boot which is not supported for discard option.

So you need to tell you boot loader to already mount XFS with “discard” during first boot.

For details check this thread

On the UCS, that’s the one:


and here’s where I change the line:

GRUB_CMDLINE_LINUX_DEFAULT=" quiet loglevel=0 rootdelay=5 splash rootflags=discard"

is that correct?

I’d like to bring up that piece again.

I set the variable in the UCR:

ucr set grub/append="discard"

and in the /etc/fstab:

# / was on /dev/sda1 during installation
UUID=6b6bf66b-1d51-47b7-9f4f-8be583d900e6 /               xfs     rw,relatime,attr2,inode64,noquota,discard        0       0

but after I restarted the VM it is not active:

root@erp01:~# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=1004425,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,relatime,size=1616236k,mode=755)
/dev/sda1 on / type xfs (rw,relatime,attr2,inode64,noquota)

What am I doing wrong?

It should be in your case:

ucr set grub/append="rootflags=discard"

To preserve the existing settings:

ucr set grub/append="$(ucr get grub/append) rootflags=discard"

Thank you! This is how it works :slight_smile: