Signs of Triviality

Opinions, mostly my own, on the importance of being and other things.
[homepage] [index] [jschauma@netmeister.org] [@jschauma] [RSS]

Migrating Quotas

While migrating our NFS server, I had to also make sure that quotas are migrated as well. Unfortunately, Solaris's edquota(1M) does not have any switch to read quotas from a file generated by repquota(1M) (as IRIX's edquota(1M) does).

To export and import all quotas, I did the following:

On the IRIX host:

$ cd /home
$ for i in *; do
>    quota -v $i > /tmp/quotas/$i
> done
$ cd /tmp
$ tar cf quotas.tar quotas
On the Solaris host:
# touch /export/people/quotas
# chmod 600 /export/people/quotas
# quotaon /export/people
# cd /tmp
# tar xf quotas.tar
# cd quotas
# setenv EDITOR /bin/ed
# foreach i (*)
>    sh /tmp/mkquota.sh $i
> end

/tmp/mkquota.sh:

#!/bin/sh

LINE=`awk '/people/ { print "fs /export/people blocks (soft =
" $3 ", hard = " $4 ") inodes (soft = " $6
", hard = " $7 ")"}' $1`

(
        echo "/people"
        echo d
        echo a
        echo $LINE
        echo .
        echo w
        echo q
) | edquota $i

(Here, I'm just enstating the quota on the "/export/people" filesystem, obviously.)

Now any files already existing on the filesystem do not count towards the quota if they have been created before the quotaon(1M) command was run. To fix this, run

# quotacheck -afp
Finally, edit /etc/vfstab to add rq to the mntflags field for the relevant filesystem.

August 18, 2006


[More on Solaris 10 ZFS vs. Apple XRaid] [index] [Of course it runs NetBSD]