Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This is the full file name I get when I do ls -lt from my current directory.

EXPORT_v1x0_20120811_11_T_065800_070000.dat.gz

File names also consist of date as well. In the above file date is 20120811.

So I am trying to delete all the files which starts with EXPORT_v1x0 and whose date is less than 20120825.

I am using the below script from the command line to delete the files

find . -name "EXPORT_v1x0*" | awk -F'_' '$3<20120825' | xargs rm

But whenever I use the above command to delete the files, I always get this below exception.

rm: ./EXPORT_v1x0_20120811_11_T_065800_070000.dat.gz not removed: Disc quota exceeded

Can anyone tell me what does this exception means? And how to overcome this problem?

I am running SunOS.

bash-3.00$ uname -a
SunOS lvsaishdc3in0001 5.10 Generic_142901-02 i86pc i386 i86pc
share|improve this question

migrated from stackoverflow.com Feb 4 '13 at 7:01

This question came from our site for professional and enthusiast programmers.

    
Maybe it helps to truncate the file first, with echo -n > EXPORT_v1x0_20120811_11_T_065800_070000.dat.gz. –  Anton Kovalenko Feb 3 '13 at 21:28
    
What version of SunOS are you using? What's the output of quota -v? –  Keith Thompson Feb 3 '13 at 21:37
    
Updated the question with version name as well. I am running 5.10 If I interpret correctly the version name. And I tried quota -v but it says quota: command not found. Why? –  TechGeeky Feb 3 '13 at 21:41
    
@AntonKovalenko, Can you tell me how should I truncate the files. I tried the way you told me as well. echo -n > EXPORT_v1x0_20120811_11_T_065800_070000.dat.gz. Again I got same Disc Quota Exception as well –  TechGeeky Feb 3 '13 at 21:49
    
You're on ZFS. do cp /dev/null EXPORT_v1x0_20120811_11_T_065800_070000.dat.gz and you should be able to rm the file afterwards. –  Petesh Feb 3 '13 at 23:16

2 Answers 2

up vote 1 down vote accepted

You'll need to do something like cat /dev/null > file (or echo > file) to get back under the quota such that you can use rm again.

share|improve this answer
    
Thanks Paul for the suggestion. If I need to add this /dev/null in my command as I mentioned in my question then how should I modify it, so that I am not getting this exception again? Any thoughts? –  TechGeeky Feb 3 '13 at 21:35
    
You should try it for a single file (preferably a big one) to get under quota, then find and rm might begin to work again. I don't know, maybe a file deletion wants to allocate a block for the directory first (yep, strange). –  Anton Kovalenko Feb 3 '13 at 21:39
    
Anton is correct: it'd be best to truncate one file, then run the full command to rm them all (rm should work once you get back under the quota). You could first run your find using the -size flag and use that to identify the candidates for truncation. –  Paul Kehrer Feb 3 '13 at 21:45
    
I tried truncating the files as you told me. echo -n > EXPORT_v1x0_20120811_11_T_065800_070000.dat.gz. Again I got same Disc Quota Exception as well. –  TechGeeky Feb 3 '13 at 21:49

I would guess that either you don't have permissions to remove the file or it's read only. Try rm -f. The quota message comes from something trying to write to disk.

share|improve this answer
    
You can actually use disk in the sense that you have to write to a directory when you call unlink - the syscall rm uses. Over quota means no write access. –  jim mcnamara Feb 4 '13 at 15:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.