How to Install Linux DiskQuota: Difference between revisions

From QNAPedia
Jump to navigation Jump to search
Created page with "This page describes how to install and use [http://sourceforge.net/projects/linuxquota/ Linux DiskQuota] on the QNAP TS-459U-SP+ (but this will probably work on most other QNA..."
 
Glenn (talk | contribs)
 
Line 56: Line 56:


If anyone finds a way to feasibly install DiskQuota on the QNAP system without having to do this hack, please let the user community know.
If anyone finds a way to feasibly install DiskQuota on the QNAP system without having to do this hack, please let the user community know.
[[Category:Adding new services]]

Latest revision as of 17:50, 26 October 2015

This page describes how to install and use Linux DiskQuota on the QNAP TS-459U-SP+ (but this will probably work on most other QNAP NAS systems too).

The reason for this page is that the QNAP software only comes with user disk quotas for users that are on the QNAP system. I want to use Linux DiskQuota (i.e. quota, edquota, etc.) instead so that I don't have to create an account for each user that I want to set up a quota for.

For example, in my environment, I have close to 100 workstations that mount a QNAP shared folder via NFS. This shared folder contains over 1,000 user home directories. I don't want to create a user account for all those users on my QNAP system, so I use Linux DiskQuota to set a disk quota for each home directory's UID since the QNAP system won't be able to recognize what user the UID belongs to. Once I set the disk quota for a user, it is enforced across all the NFS mounts on all my workstations.

Installation

The following will show how I "installed" DiskQuota. I put installed in quotes because it's sort of a hack. I intended to install DiskQuota by source, but it had too many dependencies most of which were not available as ipkg packages. Compiling DiskQuota requires the rpcgen compiler which is included with glibc-common. To make a long story short, installing glibc from source is a major pain and I eventually gave up on the rabbit trail of dependencies.

The instructions here show a hack that will allow you to get DiskQuota up and running for your needs. Until QNAP enables a more robust Quota feature in their software, this page may be useful.

To start, you will need to access a Linux machine that is using Intel i686 hardware. For me, I used Fedora 12 Intel i686 VM.

Log onto this machine and download DiskQuota.

# wget http://sourceforge.net/projects/linuxquota/files/quota-tools/4.00-pre1/quota-4.00-pre1.tar.gz/download

DiskQuota requires some prerequisites that hopefully your system already has installed:

  • gcc
  • glib
  • glibc
  • glibc-common

On my system these were already installed from RPM packages.

Compile DiskQuota, but don't install it on your system.

# tar -xzf quota-4.00-pre1.tar.gz
# cd quota-tools
# ./configure
# make

The binaries are now compiled, but we do not need to run make install since we are intending to put these binaries on our QNAP system.

The default install location for the binaries are configured to go into /usr/local, but you can change this if you want when you run ./configure. For the sake of this HOWTO, I will assume it is to go into /usr/local.

Copy the necessary binaries to the QNAP system.

# scp -p quotacheck quotaon edquota repquota warnquota quotastats setquota quot xqmstats convertquota rpc.rquotad admin@<QNAP system>:/usr/local/sbin/

# scp -p warnquota.conf quotatab quotagrpadmins admin@<QNAP system>:/usr/local/etc/

# scp -p quota admin@<QNAP system>:/usr/local/bin/

# ssh admin@<QNAP system> ln -sf /usr/local/sbin/quotaon /usr/local/sbin/quotaoff

# ssh admin@<QNAP system> mkdir -p /usr/local/include/rpcsvc

# scp -p rquota.h rquota.x admin@<QNAP system>:/usr/local/include/rpcsvc

Make sure $PATH is contains /usr/local/bin and /usr/local/sbin. If not, add these to your .profile or /etc/profile on the QNAP system.

Once I did this, I was able to start using edquota to set up quotas by UIDs of files in my shared folders. The quotas were then enforced on the other systems that NFS mounted the shared folder.

If anyone finds a way to feasibly install DiskQuota on the QNAP system without having to do this hack, please let the user community know.