3

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
8
  • 1
    Maybe it helps to truncate the file first, with echo -n > EXPORT_v1x0_20120811_11_T_065800_070000.dat.gz. Feb 3, 2013 at 21:28
  • What version of SunOS are you using? What's the output of quota -v? Feb 3, 2013 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, 2013 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, 2013 at 21:49
  • 1
    All the files. It's a ZFS 'feature' where you need a little bit more space before you can rm the files. Feb 3, 2013 at 23:36

4 Answers 4

8

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.

4
  • 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, 2013 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). Feb 3, 2013 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, 2013 at 21:45
  • 3
    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, 2013 at 21:49
2

Delete manually the tiniest files that you find until you go below quota, then you will be able to delete with the standard methods.

I don't know why @Volodymyr Savchenko's answer was downvoted. Actually that was the only trick that worked for me too.

I am working in a HPC and I ran out of quota.

-Trying pretty much any command was taking ages.

-rsync remotely with --remove-source-files was not working:

rsync -avz --remove-source-files -e "ssh -p ####" usr@host:path/file.dat ./
receiving file list ... done
rsync: sender failed to remove file.dat: Disk quota exceeded (122)

-rm most of the files was not working:

[usr@server ~]$ rm  path/file.dat
rm: cannot remove 'path/file.dat': Disk quota exceeded

-doing

cat /dev/null path/file

would apparently work, but rm'ing it wouldn't (yet with the quota exceeded error message) (which I cannot understand why).

Nevertheless, deleting tinny files that I had only 'touched', (i.e., empty files with very tinny size) would work, and gave me the chance to go below quota and be able to delete files normally.

0

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.

1
  • 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. Feb 4, 2013 at 15:35
0

I had the same problem, and none of the usually suggested solutions, the ones you list, worked.

But I realized that it was possible to delete the smallest files < 1kb. I just had to find enough small files to be able again to clean up large ones with rm.

edit: I want to clarify that things like cat /dev/null > some-file did not work for me. It was one of the suggested solutions I mentioned.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .