Setting quota on XFS root filesystem fails with error "setquota: No correct mountpoint specified"
This document (000021189) is provided subject to the disclaimer at the end of this document.
Environment
SUSE Linux Enterprise Server 12
SUSE Linux Enterprise Server 15
Situation
- While configuring quota on a root filesystem which is formatted with XFS, following error is observed
server:~ # setquota -u user1 5000 8000 0 0 /dev/sda4 setquota: Cannot find mountpoint for device /dev/sda4 setquota: No correct mountpoint specified. setquota: Cannot initialize mountpoint scan.
- The entry in /etc/fstab file is already configured to enable quota, however in the mount options we still see noquota being used
server:~ # cat /etc/fstab | grep ' / ' UUID=c3c2cc2a-84f7-4495-9816-f8e2df8155e0 / xfs defaults,usrquota,grpquota 0 1 server:~ # cat /proc/mounts | grep ' / ' /dev/sda4 / xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
- xfs_quota command also confirms the same
server:~ # xfs_quota -x -c 'state -v' / User quota are not enabled on /dev/sda4 Group quota are not enabled on /dev/sda4 Project quota are not enabled on /dev/sda4
Resolution
- For XFS root filesystem, quota needs to be enabled with the boot parameter "rootflags="
- Edit the file /etc/default/grub by adding "rootflags=" parameter to the line starting with GRUB_CMDLINE_LINUX_DEFAULT
GRUB_CMDLINE_LINUX_DEFAULT="boot=/dev/sda3 USE_BY_UUID_DEVICE_NAMES=1 earlyprintk=ttyS0 console=ttyS0 rootdelay=300 net.ifnames=0 dis_ucode_ldr scsi_mod.use_blk_mq=1 multipath=off rootflags=uquota,gquota,pquota"
- If not done already, check the status of quotaon service. It should be active.
server:~ # systemctl status quotaon.service
- It is always a good idea to create a backup of grub.cfg file, before generating a new grub2 configuration file
server:~ # cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bkp
- Generate a new grub2 configuration file and reboot the server
server:~ # grub2-mkconfig -o /boot/grub2/grub.cfg server:~ # systemctl reboot
- After rebooting, ensure that usrquota, grpquota (and/or prjquota) mount options are visible for root filesystem
server:~ # cat /proc/mounts | grep ' / ' /dev/sda4 / xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,usrquota,prjquota,grpquota 0 0
- Now, running xfs_quota command will report default values which can be modified by setting user, group or project quota either through command line or by using YaST
server:~ # xfs_quota -x -c 'state -v' / User quota state on / (/dev/sda4) Accounting: ON Enforcement: ON Inode: #1088896 (6 blocks, 6 extents) Blocks grace time: [7 days] Blocks max warnings: 5 Inodes grace time: [7 days] Inodes max warnings: 5 Realtime Blocks grace time: [7 days] Group quota state on / (/dev/sda4) Accounting: ON Enforcement: ON Inode: #1088897 (7 blocks, 5 extents) Blocks grace time: [7 days] Blocks max warnings: 5 Inodes grace time: [7 days] Inodes max warnings: 5 Realtime Blocks grace time: [7 days] Project quota state on / (/dev/sda4) Accounting: ON Enforcement: ON Inode: #1088898 (1 blocks, 1 extents) Blocks grace time: [7 days] Blocks max warnings: 5 Inodes grace time: [7 days] Inodes max warnings: 5 Realtime Blocks grace time: [7 days]
Cause
- For root filesystems formatted with type XFS, the default kernel mount option used is noquota. This is why setquota command or YaST fails to enable any type of quota for this filesystem.
- From the man page of xfs_quota:
Additional Information
- For detailed procedure on how to set quota using YaST, kindly refer to the following documents:
- SLES 12 : https://documentation.suse.com/sles/12-SP5/html/SLES-all/cha-y2-userman.html#sec-y2-userman-adv-quota
- SLES 15 : https://documentation.suse.com/sles/15-SP4/html/SLES-all/cha-yast-userman.html#sec-yast-userman-adv-quota
- Some useful man pages referred during the course of setting quota
- man xfs
- man xfs_quota
- man dracut.cmdline
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:000021189
- Creation Date: 01-Sep-2023
- Modified Date:01-Sep-2023
-
- SUSE Linux Enterprise Server
- SUSE Linux Enterprise Server for SAP Applications
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com