rm: cannot remove file: Disk quota exceeded

2015年12月16日 Solaris运维 评论 1 条 阅读 2,849 次

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


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


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.

1 条留言  访客:1 条  博主:0 条

  1. 胡海琳



Copyright © 2011-2018 零下二十四度Theme By  Ality  京ICP备16007547号   关于本站