Enabling quotas permanently on CentOS 7 not so clear-cut

Greetings:

When I run –

# mount | grep ' / '

the output suggests quotas are installed and enabled:

/dev/sda on / type ext4 (rw,noatime,quota,usrquota,grpquota,errors=remount-ro,data=ordered)

Notice that the file system is ext4 and not the default XPS.

These 3 commands will get quotas cranking:

# ln -s /dev/sda /dev/root
# quotacheck -cugvmf -F vfsv0 /
# quotaon /

I may or may not restart the iworx service since it doesn’t seem to matter.

At which point quotas go from pink/disabled to green/enabled on the System Health page in Nodeworx. To disable quotas again all that’s needed is a reboot which loses the symlink for /dev/root and quotas can’t enable.

So my first question is what would be best practice for making this symlink permanent?

The legacy method in CentOS 6.x is to place the symlink in this file:

/etc/rc.d/rc.local

With newer distros the answer seems to be creating a systemd unit file in directory –

/etc/systemd/system/

I’ve been referring to articles like these that discuss it:

https://www.centos.org/forums/viewtopic.php?t=48140

http://forums.fedoraforum.org/showthread.php?t=295048

Interworx has a guide for quotas and CentOS 7 that involves GRUB that isn’t working for me:

From what I’ve read here in the forums the GRUB method hasn’t worked for some people. In my case GRUB entries also don’t look anything like the instructions, so I’m lost. The systemd method loses me also. Oddly enough, the legacy method for CentOS 6 seems to be loading the symlink every boot so far.

Hi sysnop

I myself have always edited grub and its works lovely

If your a little unsure, you may want to try a few tests on a test server first, but if you follow IW guide as you posted, should work

I think some users set wrong details in grub, which is why it fails

These are just my thoughts and how I setup centos 7 with IW, but we do not use centos 7 in production as yet, just test servers

Many thanks

John

Hey John,

Sorry, I updated my post because I had tried two methods with some degree of success – quotas remain on after booting. I need to study GRUB because that’s how I’d like it to work.

Thanks!

Hi sysnop

Many thanks

If it helps, if I have time next few days, I may load a test server with default centos 7, then take screenshots of what needs to be completed

Would that help

Many thanks

John

Hey John,

I’m sure it would help but that would be extra work for you unless it’s already part of your testing schedule. I think I’m getting warmer after doing some research about CentOS 7. Once I see good results I will post what I did with GRUB.

Thanks!

Hi Sysnop
Many thanks, but it was one I did specially to help.
Hopefully it will make sense, and just followed the instructions from IW as you posted.

I hope that helps and have highlighted where the code should be placed (before and after)
Many thanks
John

centos 7 grub.pdf (235 KB)

Thanks John! I will give it a try asap which may not be today but soon enough. I’m taking the day off from Interworx. IPv6 isn’t working for me either and eventually I will post a new thread about that also.

Thanks again for your screen shots, they’re easily comparable to the instructions at http://www.interworx.com/support/faq/enabling-quotas-centos7/.

I tried once more with no success: after rebooting a couple times quotas are not enabled according to the Nodeworx System Health page. Before editing GRUB I reversed the legacy method of placing a symlink in /etc/rc.d/rc.local to retain enabled quotas after rebooting (discussed above).

The rootflags= line was indeed missing before editing. Here’s my updated /etc/default/grub file:

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="vconsole.keymap=us crashkernel=auto  vconsole.font=latarcyrheb-sun16 rhgb quiet rootflags=usrquota,grpquota
"
GRUB_DISABLE_RECOVERY="true"

Output for

# grub2-mkconfig -o /boot/grub2/grub.cfg:

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-327.22.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.22.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-72863e389b584a4dab36fae7f3bffda2
Found initrd image: /boot/initramfs-0-rescue-72863e389b584a4dab36fae7f3bffda2.img
done"

Next I verified that /boot/grub2/grub.cfg existed with a current time stamp since previously it did not, which explains the error when attempting to copy a backup.

Rebooted…

Output for

# mount | grep ’ / ':

/dev/sda on / type ext4 (rw,noatime,quota,usrquota,grpquota,errors=remount-ro,data=ordered)

But quotas in Nodeworx’ health page show pink/disabled.

Next I got quotas to show green/enabled by issuing:

[B]# ln -s /dev/sda /dev/root

quotacheck -cugvmf -F vfsv0 /

quotaon /[/B]

But rebooting takes it back to pink/disabled in Nodeworx. I’ll re-issue these commands to have quotas on until the next reboot.

Hi sysnop

Many thanks and your grub looks good with quota

There are a few possibilities then as follows

Your using ext4, I did default on xps

I have not loaded IW on centos 7 yesterday - which version are you seeing this on and I’ll load tommorow if I have time

If xps with IW works, I restart using ext4

Does IW calculate quotas correctly if you reboot and leave pink

Also, are you using vps or dedicated server (I tested on a dedicated server)

I’ll update when I have loaded IW to let you know

Many thanks and have a lovely weekend

John

I’m using a VPS. Forgot to mention that earlier.

Initially I mentioned my server is ext4 since so many CentOS 7 tutorials seem to prefer xps. The OS image only offers ext4… not that I prefer xps but apparently VPS providers do.

YES! Nodeworx appears to be calculating correct numbers for Siteworx account storage and email. It’s as if quotas were always enabled and working but Interworx doesn’t agree.

Looking forward to hearing if you discover anything with an ext4 setup.

Edit:

Sorry John, I neglected to answer a pertinent question of yours. Interworx is installed on CentOS Linux release 7.2.1511 (Core). And the kernel doesn’t appear to be stock (the server is at Linode): Linux 4.5.5-x86_64-linode69 (SMP).

You have a nice weekend too!

Hi Sysnop
Many thanks, much appreciated for your information.
Yes, your definately not on a stock centos, but think this is because it is a VPS install
My dedicated test server is using XFS (not Ext4) with the following:
InterWorx Version 5.1.23-1175
Distribution: CentOS Linux release 7.2.1511 (Core)
Operating System: Linux 3.10.0-327.22.2.el7.x86_64 (SMP)
(latest updates installed prior to installing Interworx using:
sh <((curl -sL interworx.com/inst.sh)) -r release-candidate
I can report that this test server showed Quotas not working (oh dear).
However, I know the Quotas are correctly setup in grub, so my thoughts turned to a different direction, and I have resolved it a follows:
Login to Nodeworx, Server, Settings, schroll towards the very bottom of the page and change Quota Settings from /home to /, save and check system health, which shuold show Quotas Green and working.
Reboot server as final test, and all should be good.
I will email IW though, as it is slightly confusing if the quota count is going to be correct (I expect the quota to be correct for /home as it should cover /home) but could be wrong sorry.
Please could I ask if this works for you as well
Many thanks
John

Hey John,

Making sure ‘/’ was listed as the quota partition in Nodeworx (iworx.ini) was one of the first things I checked early on (it never was listed as /home as in your case). I verified by 1) rebooting after making no changes knowing GRUB looks ok; 2) rebooting after getting quotas to show green/enabled with the symlink and quotacheck. Either way I end up with pink/disabled in Nodeworx.

Sorry about the bad news, I appreciate all your effort with this puzzle.

Richard

Hi Richard

Many thanks

Did you try set it to /home or /chroot or /chroot/home

If you look at IW-cp, login to nodeworx, server settings, it should show directories which can be set

I’m just wondering if your is a reverse of mine, as mine was originally set to /home (pink disabled) and not /, which turns it green enabled

I’ve emailed IW as I said I would but maybe an idea to open a support ticket with IW, so they can see what’s gone wrong (I do not think it has gone wrong, just that IW is not seeing quotas as active, when they are as you have shown this to be the case

Hope that helps a little

Many thanks

John

Hi Richard

A thought just came to me, do you have to turn on second level quotas as your on a vps (I forgot which vps this refers to, but there are 2 I think which need this)

Many thanks

John

Hi John,

The options for the quota partition are:

/
/dev
/dev/shm
/run
/sys/fs/cgroup

No /chroot or /chroot/home although I did see a message flash by the screen during installation referring to these directories, something about a symlink? There wasn’t enough time to take it in.

I decided to scrub the VPS and start from scratch thinking it best to have quotas enabled in GRUB before installing Interworx. Oddly, I get this now:

-bash: grub2-mkconfig: command not found

I started over a second time, still no grub2-mkconfig. Too strange.

I’m thinking it’s time to toss Linode’s CentOS 7 image in the /bin.

[QUOTE=d2d4j;28780]A thought just came to me, do you have to turn on second level quotas as your on a vps (I forgot which vps this refers to, but there are 2 I think which need this)
[/QUOTE]

If you mean do quotas need to be compiled in the kernel, I don’t believe so on a KVM virtual machine. With openVZ or Parallels I believe compiling quotas is necessary.

Hi Richard

Many thanks, and those are the 2 vps which need second level quotas (must be my age sorry)

It’s interesting that your not showing /home, and Nathan has replied to me over quotas (see below), which explains why your symlinking worked, as maybe your /home is on a different drive to sda perhaps

Is there another centos 7 image you could use or perhaps have the option to upload your own - sorry I do not use linode

Many thanks

John

You should enable quotas on the partition that contains the /home directory. I believe in our documentation we assume that /home is on the / partition, so the example commands reflect that directory.

Feel free to submit a support ticket if you’d like us to take a look at your configuration as well.

Thanks,

Nathan

Hey John,

Yes, as far as I know I could upload my own spin of CentOS or the full package I suppose. But I’m not willing to go that far.

When rolling out an OS disk at Linode there are options for reserving disk space for other partitions. I simply use all space for a single partition and a small swap partition, /dev/sda & /dev/sdb, respectively. And like Ubuntu on a laptop, no /home partition is created, just a /home directory. On the same setup page the ‘root/boot device’ can be assigned to any of these partitions but I just use the ‘standard’ and default /dev/sda.

Here’s my /etc/fstab (notice the quotas):

/dev/sda       /               ext3    noatime,errors=remount-ro,usrquota,grpquota       0 1
/dev/sdb       none            swap    sw                              0 0
/proc           /proc           proc    defaults                        0 0
tmpfs           /dev/shm        tmpfs   nodev,nosuid,noexec,mode=1777             0 0
devpts          /dev/pts        devpts  gid=5,mode=620                  0 0
sysfs           /sys            sysfs   defaults                        0 0

Interestingly, my previous VPS – also KVM but on CentOS 6.5 – didn’t have a /home partition either and was laid out much the same way as my current VPS. Quotas were working and stopped working only one time but quotacheck fixed it. Sorry I can’t compare notes between the two, the old server is long gone.

Thanks Nathan, I will start a ticket sometime today or tonight.

Richard