Problem with quota on IRIX xfs filesystem - SGI

This is a discussion on Problem with quota on IRIX xfs filesystem - SGI ; Hi. I have a need to pre-allocate quota on an xfs filesystem, before initiating a file transfer from another server. I'm taking the tack of seeking past the end of the file I'm appending, and writing a single character - ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Problem with quota on IRIX xfs filesystem

  1. Problem with quota on IRIX xfs filesystem

    Hi. I have a need to pre-allocate quota on an xfs filesystem, before
    initiating a file transfer from another server. I'm taking the tack
    of seeking past the end of the file I'm appending, and writing a
    single character - creating a sparse file. For example, if I need to
    append 500 characters to the end of the file, I do something like
    this:


    /* Open the file */
    open(somefilename,O_WRONLY | O_CREAT, 0600);
    /* Seek past the end of the file */
    lseek(fd,500,SEEK_END);
    /* Write a single character, creating a sparse file */
    if ((pos = write(fd,'K',1)) < 0)
    {
    do_some_error_stuff();
    }
    close fd;



    to get 500 bytes past the end, and then write a single character,
    which creates the file of the size that I need.

    It seems to work fine, unless the user is near (but not necessarily
    at) quota. For example, I have a user whose quota looks like this:

    Filesystem usage quota limit timeleft files quota limit
    timeleft
    /u 191388 0 191432 1558 0 0


    (/u is a quota-enforced filesystem). According to this, this user
    should have sufficient quota for a 500-byte file. If the file doesn't
    exist, it doesn't even get to the lseek() - the file creation in the
    open() fails.

    Can anyone point me to something I'm doing incorrectly? It appears to
    be something specific to xfs - I can do the same thing on a FreeBSD
    ufs filesystem with no errors.

    Thanks,
    Rich

  2. Re: Problem with quota on IRIX xfs filesystem

    Perhaps I should rephrase my issue.

    In the example below, the user has 12 K of available space. Why
    should a simple file creation fail with EDQUOT?


    bash$ quota -v
    Disk quotas for XXXXXX (uid XXXXX):
    Filesystem usage quota limit timeleft files quota limit
    timeleft
    /u 191400 0 191412 1558 0 0
    bash$ touch foo
    Cannot create foo: Disc quota exceeded

    The filesystem has a 4096-byte minimum, but quota is reporting ample
    space. Why is this failing? Am I missing an important piece of this
    puzzle?

    Thanks,
    Rich

+ Reply to Thread