Uni-Logo
You are here: Home Documentation bwGRiD FAQ Deleting files when quota exceeded
Document Actions

How can I delete files in my home directory. I get: rm: cannot remove file: Disk quota exceeded

On ZFS, the filesystem that carries our homedirs, you may find yourself unable to delete files with full disk quota:

bfguser@bwui:~> cp testfile1 testfile2
cp: cannot create regular file `testfile2': Disk quota exceeded

Unfortunately you can not remove a file using the 'rm' command. E.g.:

bfguser@bwui:~> rm testfile1
rm: cannot remove file `testfile1': Disk quota exceeded

Workaround:

The trick is to copy /dev/null to the file you want to delete:

bfguser@bwui:~> ls -lah testfile1
-rw-r--r-- 1 bfguser bfggroup 16M 2009-03-23 10:44 testfile1

bfguser@bwui:~> cp /dev/null testfile1
bfguser@bwui:~> ls -lah testfile1
-rw-r--r-- 1 bfguser bfggroup 0 2009-03-23 11:41 testfile1

bfguser@bwui:~> rm testfile1
bfguser@gwui:~> ls -lah testfile1
/bin/ls: testfile1: No such file or directory

Explanation:

ZFS is a copy-on-write filesystem, so a file deletion transiently takes slightly more space on disk before a file is actually deleted. It has to write the metadata involved with the file deletion before it removes the allocation for the file being deleted. This is how ZFS is able to always be consistent on disk, even in the event of a crash.

Personal tools