Koozali.org: home of the SME Server

Obsolete Releases => SME Server 8.x => Topic started by: itguy2012 on May 12, 2014, 12:31:16 PM

Title: Quotas on second disk
Post by: itguy2012 on May 12, 2014, 12:31:16 PM
Hi All,

I have installed SME on a server with two drives, one small drive for the installation, one larger for data.
After the install I mounted the second larger drive to /home/e-smith/files, following the adding a second hard disk guide found on this site.
http://wiki.contribs.org/AddExtraHardDisk (http://wiki.contribs.org/AddExtraHardDisk) - in particular the 4.0 alternative section

All works ok so far, apart from the quotas.
I have added usrquota,grpquota to /etc/fstab rebooted etc but no joy.

I have tried running the command  quotacheck -vugc /dev/sdb1
but this returns the following

quotacheck: Can't find mountpoint for device /dev/sdb1
quotacheck: No correct mountpoint specified.
quotacheck: Can't initialize mountpoint scan.


In the web gui, when setting the quota for a user it says it completed successfully but then lists the values as 0.00 as if nothing has been entered.

Looking in the logs it gives the following info

May 12 10:02:18 erce-gateway esmith::event[4385]: Cannot query your quota for 'test2' on '/dev/sdb1' 
May 12 10:02:18 erce-gateway esmith::event[4385]: Quota error (are you using NFS?): No quota for this user 


Is there anything that needs to do be run to reconfigure the quotas to work for the second drive?

thanks!
Title: Re: Quotas on second disk
Post by: Stefano on May 12, 2014, 01:39:40 PM
I can't help you with your issue but.. a single (big) disk? no raid?

what about backup?
Title: Re: Quotas on second disk
Post by: Daniel B. on May 12, 2014, 03:04:06 PM
To enable quota on your second disk:

- Edit the fstab entry for this disk, and make sure both usrquota and grpquota are listed in the options column
- If you just add usrquota and grpquota, you need to remount the disk so the kernel enable it:
Code: [Select]
mount -o remount /home/e-smith/files
- Last, you have to scan the FS to build the initial quota DB. The best is to do it offline (unmount the FS, and scan the block device with quotacheck) but it's also possible to do it online (in this case I recommand waiting for a low activity window)
Code: [Select]
quotacheck -cguvm /dev/sdb1

So, it looks like you've done most of it correctly, have you checked the FS is really mounted with quota enabled (with the mount command, without any arg)
Title: Re: Quotas on second disk
Post by: itguy2012 on May 12, 2014, 03:24:58 PM
Hi Daniel,

thanks for the reply,
I ran the first command you put, it didsn't show any failure, so ok in theory.
Upon running the quotacheck command I recieved the following response

quotacheck: Can't find mountpoint for device /dev/sdb1
quotacheck: No correct mountpoint specified.
quotacheck: Can't initialize mountpoint scan.

So perhaps it is not mounted correctly?
It certainly appears to be mounted ok to a point at the user data is redirected there without issue.

I have the following line for the disk in fstab
/dev/sdb1               /home/e-smith/files     ext2      usrquota,grpquota      1 2

thanks
Title: Re: Quotas on second disk
Post by: Daniel B. on May 12, 2014, 03:29:58 PM
First, it seems to be an ext2 FS, I'd strongly recommand to use ext3 (which is just a journalized ext2, and will ensure no data corruption happens if your server crashs or you have a power failure). Second, can you post the output of your mount command ?
Title: Re: Quotas on second disk
Post by: itguy2012 on May 12, 2014, 03:35:52 PM
Yes i'm planning on redoing it with ext3, it was bit of a typo on my part with 2 not 3 and as the disk had taken a while to mount and format etc I've stuck with it for now while I'm testing this new install (it's a replacement for old hardware but not in production yet)

Output of mount is

/dev/mapper/main-root on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sdb1 on /home/e-smith/files type ext2 (rw)
Title: Re: Quotas on second disk
Post by: Daniel B. on May 12, 2014, 03:41:06 PM
/dev/sdb1 on /home/e-smith/files type ext2 (rw)

Quota are clearly not enabled, so either they are not supported on ext2 (never tried), or there's something wierd with your fstab entry (looks OK here, but maybe a spacing issue somewhere ?)

You can convert ext2 to ext3 quite easily (should be safe, but of course, you should backup everything before doing it):

Code: [Select]
tune2fs -j /dev/sdb1

(I'd recommand this on an unmounted filesystem, but from the manpage of tune2fs, it seems possible to do it live)

Then, just change ext2 to ext3 in your fstab and reboot
Title: Re: Quotas on second disk
Post by: itguy2012 on May 12, 2014, 03:45:11 PM
thanks, I'll convert that now and re run the commands and report back.

thanks.
Title: Re: Quotas on second disk
Post by: itguy2012 on May 12, 2014, 05:18:48 PM
That seems to have done the trick,

Converted to ext3 and remounted, ammended fstab accordingly
rebooted
ran quotacheck which completed without errors
rebooted

running mount now shows the quotas are enabled ok.

Just reloaded the GUI and added a quota to a user and it shows the quota.
Tested with a ftp user account and the quota is working as expected.

Many thanks for your help.